4.7.2 hotreaload Crash for FStringAssetReference

Hi,

During HotReloading, the process crash during FStringAssetReference property reloading.

Here is the definition:
UPROPERTY(EditDefaultsOnly, Category = Test)
FStringAssetReference MyClass;

It is declared inside a Struct with USTRUCT() attribute.

This was working perfectly in 4.6.1.

Could you please look at it?

Error in FArchive& FArchive::operator<<(struct FStringAssetReference& Value):
UE_LOG(LogSerialization, Fatal, TEXT(“FArchive does not support FAssetPtr serialization. Use FArchiveUObject instead.”));

Stack Trace

UE4Editor-Core.dll!FArchive::operator<<(FStringAssetReference & Value) Line 160	C++
UE4Editor-CoreUObject.dll!FStringAssetReference::Serialize(FArchive & Ar) Line 26	C++
UE4Editor-CoreUObject.dll!UStructProperty::SerializeItem(FArchive & Ar, void * Value, int MaxReadBytes, const void * Defaults) Line 124	C++
UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FArchive & Ar, UProperty * Property, unsigned char * Value, int MaxReadBytes, unsigned char * Defaults) Line 139	C++
UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FArchive & Ar, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1250	C++
UE4Editor-CoreUObject.dll!UStructProperty::SerializeItem(FArchive & Ar, void * Value, int MaxReadBytes, const void * Defaults) Line 147	C++
UE4Editor-HotReload.dll!FHotReloadClassReinstancer::UpdateDefaultProperties() Line 418	C++
UE4Editor-HotReload.dll!FHotReloadModule::ReinstanceClass(UClass * OldClass, UClass * NewClass) Line 849	C++
UE4Editor-CoreUObject.dll!UClassReplaceHotReloadClasses() Line 703	C++
UE4Editor-CoreUObject.dll!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() Line 921	C++
UE4Editor-Core.dll!TBaseMulticastDelegate<void>::Broadcast() Line 1030	C++
UE4Editor-Core.dll!FModuleManager::LoadModuleWithFailureReason(const FName InModuleName, EModuleLoadResult & OutFailureReason, const bool bWasReloaded) Line 359	C++
UE4Editor-Core.dll!FModuleManager::LoadModule(const FName InModuleName, const bool bWasReloaded) Line 238	C++
UE4Editor-HotReload.dll!FHotReloadModule::DoHotReloadInternal(bool bRecompileFinished, ECompilationResult::Type CompilationResult, TArray<UPackage *,FDefaultAllocator> Packages, TArray<FName,FDefaultAllocator> InDependentModules, FOutputDevice & HotReloadAr) Line 654	C++
UE4Editor-HotReload.dll!FHotReloadModule::DoHotReloadCallback(bool bRecompileFinished, ECompilationResult::Type CompilationResult, TArray<UPackage *,FDefaultAllocator> Packages, TArray<FName,FDefaultAllocator> InDependentModules, FOutputDevice & HotReloadAr) Line 620	C++
UE4Editor-HotReload.dll!TBaseRawMethodDelegateInstance<0,FHotReloadModule,TTypeWrapper<void> __cdecl(bool,enum ECompilationResult::Type),TArray<UPackage * __ptr64,FDefaultAllocator>,TArray<FName,FDefaultAllocator>,FOutputDevice & __ptr64>::Execute(bool <Params_0>, ECompilationResult::Type <Params_1>) Line 492	C++
UE4Editor-HotReload.dll!TBaseRawMethodDelegateInstance<0,FHotReloadModule,void __cdecl(bool,enum ECompilationResult::Type),TArray<UPackage * __ptr64,FDefaultAllocator>,TArray<FName,FDefaultAllocator>,FOutputDevice & __ptr64>::ExecuteIfSafe(bool <Params_0>, ECompilationResult::Type <Params_1>) Line 582	C++
UE4Editor-HotReload.dll!FHotReloadModule::CheckForFinishedModuleDLLCompile(const bool bWaitForCompletion, bool & bCompileStillInProgress, bool & bCompileSucceeded, FOutputDevice & Ar, bool bFireEvents) Line 1473	C++
UE4Editor-HotReload.dll!FHotReloadModule::Tick() Line 433	C++
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 946	C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 347	C++
UE4Editor.exe!FEngineLoop::Tick() Line 2257	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191	C++

Do you need more information?

Thanks,

Hey -

i added a new class based on Actor but when creating the struct I’m receiving some compile errors related to the FStringAssetReference. Are there any #includes other than the auto-generated ones that you’ve added or anything else I would need to add to compile?

Cheers

have you added “CoreUObject” in the private dependency of the Build.cs?

I had been working in a blueprint based project that I added code to. Recreating the project as a code base, I double checked that CoreUObject was included and recreated the Actor class with the struct. I did not crash when hot reloading however. Are you able to reproduce the crash in a new project with no additional content?

Ok You can find attached the project to reproduce the error.

You need to create a Blank C++
Overwrite the source folder by the one provided
Copy from the Source folder the 2 assets in Content/StarterContent.
Compile
Open the editor
Change something in TestHotReloadGameMode.h
Click on Compile in the editor and you should see the error.

It seems to be linked to hotreload issue when loading a package with FStringREference from a constructor.link text

I forgot that you need to define in DEfaultEngine.ini

[/Script/Engine.Engine]
GameSingletonClassName=/Game/Global_sing.Global_sing_C

have you been able to reproduce the issue with my sources?

Hi ,

I was able to use the files that you provided to reproduce this issue. Thank you for making those files available to us. I also saw a crash in our latest internal build. Unfortunately I was unable to verify that this was working in 4.6.1. I have submitted a report to have this issue investigated further (UE-11600).

Great to know you have been able to reproduce the issue.

To be quite honest I’m not sure it was working in 4.6.1.
I only understand the issue when making the source files for you (I thought it was just the Type FstringReference that was causing an issue anot the way it was managed).

In all case, I hope you will be able to fix it soon as Hot Reload is really useful ^^

Hi ,

I wanted to give you a quick update on this issue. A fix has been put in place for the crash you described, and it will be available in a future release of the Engine if you are using the binary version installed by the Launcher. If you built the Engine from source code, you can find the fix here and merge that into your Engine code to see if it corrects the issue you are experiencing.

Thanks for the update. That’s an excellent news.
For the moment I’m based on the Launcher version, but I may switch to the GitHub one to get this fix.
In all case, I’m glad you fix it.