UStruct getting garbage collected

Hi!
I’ve a weird problem in my Network game. My UStruct(FMinionData) gets garabage collected after 60 seconds. The wierd thing is that it works just fine when i run it in NON-debug mode, but when i start the project from visual studio i run into the problem.

Setup:

  1. UClass that wraps a UStruct

    UCLASS()
    class UMinionDataWrapper : public UJackersSimpleBaseObject
    {
    GENERATED_UCLASS_BODY()

    public:

    	UFUNCTION(BlueprintCallable, Category = "MinionData")
     	void SetMinionData1(FMinionData MinionDataIn){ MinionData = MinionDataIn; };
     	
     UFUNCTION(BlueprintCallable, Category = "MinionData")
     	FMinionData GetMinionData(){ return MinionData; };
     
    UPROPERTY(BlueprintReadWrite, Replicated, Category = "Preplan")
     FMinionData MinionData;
    

    };

  2. My UStruct

    USTRUCT(BlueprintType)
    struct FMinionData
    {
    GENERATED_USTRUCT_BODY()

    public:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “MinionData”)
    FString Name;

     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	EMinionCharacterClassTypeEnum CharacterClass;
    
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	int32 MinionId;
    
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	int32 CharacterTypeId;
    
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	int32 WalkSpeed;
    
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	USkeletalMesh* SkeletalMeshObj;
    
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	UAnimBlueprint* AnimInstanceMember;
    
     // Max health of the Pawn
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	float MaxHealth;
    
     /** Current health of this Pawn */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	float CurrentHealth;
    
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "MinionData")
     	int32 OwnerId;
    
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	EMinionSymbolTypeEnum Symbol;
    
     /** Current health of this Pawn */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MinionData")
     	float VisionRadius;
    
     FMinionData()
     {
     	CurrentHealth = 100;
     	MaxHealth = 100;
     	WalkSpeed = 600;
     	VisionRadius = 3000;
     }
    
     //UFUNCTION(BlueprintCallable, Category = "Logic")
     FORCEINLINE bool operator==(FMinionData CompareVar) {
     	if (CompareVar.MinionId == MinionId)
     		return true;
     	else
     		return false;
     }
    

    };

Error then occurs in BlueprintGeneratedClass.cpp (line 701)

class FPersistentFrameCollectorArchive : public FSimpleObjectReferenceCollectorArchive
{
public:
	FPersistentFrameCollectorArchive(const UObject* InSerializingObject, FReferenceCollector& InCollector)
		: FSimpleObjectReferenceCollectorArchive(InSerializingObject, InCollector)
	{}

protected:
	virtual FArchive& operator<<(UObject*& Object) override
	{
		const bool bWeakRef = Object ? !Object->HasAnyFlags(RF_StrongRefOnFrame) : false;
		Collector.SetShouldHandleAsWeakRef(bWeakRef); 
		return FSimpleObjectReferenceCollectorArchive::operator<<(Object);
	}
};

Application “??\D:\devtools\androidnvidia\android-sdk-windows\platform-tools\adb.exe” found in cache
Application “??\D:\devtools\androidnvidia\android-sdk-windows\platform-tools\adb.exe” found in cache
The thread 0x1530 has exited with code 0 (0x0).
The thread 0xefc has exited with code 0 (0x0).
The thread 0xdbc has exited with code 0 (0x0).
Application “??\D:\devtools\androidnvidia\android-sdk-windows\platform-tools\adb.exe” found in cache
The thread 0x1248 has exited with code 0 (0x0).
Application “??\D:\devtools\androidnvidia\android-sdk-windows\platform-tools\adb.exe” found in cache
Application “??\D:\devtools\androidnvidia\android-sdk-windows\platform-tools\adb.exe” found in cache
First-chance exception at 0x00007FF85C257B18 (UE4Editor-Engine.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Unhandled exception at 0x00007FF85C257B18 (UE4Editor-Engine.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

When i do not set my struct it always works.

Best regards.

Solved it:
The problem was that my UObjects in the struct wasnt initialized in all cases. The solution is to set all UObjects equal to nullptr If they have not been set to any value. They can now be interpretated as a valid object by the GC handler.