TArray or structs passed to delegate crashes

Hi, I’m having troubles working with TArray of custom structs in Bleuprints in UE 4.27.

Summary

This text will be hidden

I have FCustomStruct that is a USTRUCT(BlueprintType).
It has some fields and of course Generated Body.
I simply allocate structs by calling AddDefaulted in the array.
Then I pass array const reference to the Delegate and broadcast it.
In Blueprints when I’m iterating over array and trying to access an array element’s field, I crash.
The same delegate works with array of pointers to UObjects but that’s not what I need

Hello!
A few things to consider. Make sure all the fields inside the struct are market as UPROPERTY(BlueprintReadOnly) or UPROPERTY(BlueprintReadWrite).

Also, since you are using AddDefaulted, consider that all the struct instances will be constructed with their default values. You probably want to make sure that in your struct declaration, you are setting default values to each property or else they could be filled with garbage. Particularly, if any of these fields is a pointer, they will probably be null and you can get a crash if you access them.

If this doesn’t work, can you share the code where you declare your struct, and the crash stack trace?