Description

Performing a Hot Reload after creating a custom UClass class can result in a crash.

This was reported on Linux, but reproduced on Windows. Additional testing will be done on Linux to confirm the issue there as well.

Steps to Reproduce
  1. Create a new Basic Code project.
  2. Build the project.
  3. Open the project in the Editor.
  4. Add a new class to the project derived from Object.
  5. Close the Editor.
  6. Change the parent class of the new class from UObject to UClass.
    • There should be nothing in this class other than a GENERATED_BODY() macro.
  7. Build the project.
  8. Open the project in the Editor.
  9. Click the "Compile" button.
    • This step may need to be repeated a few times.

RESULT:
The Editor crashes due an assertion: Assertion failed: ClassAddReferencedObjects != 0

EXPECTED:
The Hot Reload completes successfully and the Editor does not crash.

Callstack

Assertion failed: ClassAddReferencedObjects != 0 [Link Removed] [Line: 2193]

UE4Editor_Core!FWindowsErrorOutputDevice::Serialize() [d:\main-builds\stream\engine\source\runtime\core\private\windows\windowserroroutputdevice.cpp:79]
UE4Editor_Core!FOutputDevice::LogfImpl() [d:\main-builds\stream\engine\source\runtime\core\private\misc\outputdevice.cpp:71]
UE4Editor_Core!FDebug::AssertFailed() [d:\main-builds\stream\engine\source\runtime\core\private\misc\assertionmacros.cpp:446]
UE4Editor_Core!FDebug::CheckVerifyFailedImpl() [d:\main-builds\stream\engine\source\runtime\core\private\misc\assertionmacros.cpp:424]
UE4Editor_CoreUObject!UClass::AssembleReferenceTokenStream() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:2193]
UE4Editor_CoreUObject!UClass::AssembleReferenceTokenStreams() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\class.cpp:4373]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClasses() [d:\main-builds\stream\engine\source\developer\hotreload\private\hotreload.cpp:1228]
UE4Editor_HotReload!TBaseRawMethodDelegateInstance<0,FHotReloadModule,void __cdecl(void)>::ExecuteIfSafe() [d:\main-builds\stream\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:518]
UE4Editor_CoreUObject!TBaseMulticastDelegate<void>::Broadcast() [d:\main-builds\stream\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:977]
UE4Editor_CoreUObject!UClassReplaceHotReloadClasses() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:860]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:1017]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(FName,bool)>::ExecuteIfSafe() [d:\main-builds\stream\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:813]
UE4Editor_Core!TBaseMulticastDelegate<void,FName,bool>::Broadcast() [d:\main-builds\stream\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:977]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\main-builds\stream\engine\source\runtime\core\private\modules\modulemanager.cpp:529]
UE4Editor_Core!FModuleManager::LoadModule() [d:\main-builds\stream\engine\source\runtime\core\private\modules\modulemanager.cpp:367]
UE4Editor_HotReload!FHotReloadModule::DoHotReloadInternal() [d:\main-builds\stream\engine\source\developer\hotreload\private\hotreload.cpp:789]
UE4Editor_HotReload!UE4Function_Private::TFunctionRefCaller<<lambda_9c48366a887b61ded2fa445a677e9fc1>,void __cdecl(TMap<FName,FString,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FName,FString,0> > const &,bool,enum ECompilationResult::Type)>::Call() [d:\main-builds\stream\engine\source\runtime\core\public\templates\function.h:487]
UE4Editor_HotReload!FHotReloadModule::CheckForFinishedModuleDLLCompile() [d:\main-builds\stream\engine\source\developer\hotreload\private\hotreload.cpp:1853]
UE4Editor_HotReload!FHotReloadModule::Tick() [d:\main-builds\stream\engine\source\developer\hotreload\private\hotreload.cpp:1421]
UE4Editor_Core!FTicker::Tick() [d:\main-builds\stream\engine\source\runtime\core\private\containers\ticker.cpp:95]
UE4Editor!FEngineLoop::Tick() [d:\main-builds\stream\engine\source\runtime\launch\private\launchengineloop.cpp:4277]
UE4Editor!GuardedMain() [d:\main-builds\stream\engine\source\runtime\launch\private\launch.cpp:173]
UE4Editor!GuardedMainWrapper() [d:\main-builds\stream\engine\source\runtime\launch\private\windows\launchwindows.cpp:145]
UE4Editor!WinMain() [d:\main-builds\stream\engine\source\runtime\launch\private\windows\launchwindows.cpp:275]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-71566 in the post.

3
Login to Vote

Fixed
ComponentUE - Foundation - Cpp Tools - Hot Reload
Affects Versions4.224.23
Target Fix4.22
Fix Commit5415461
Main Commit5415463
Release Commit5415461
CreatedMar 14, 2019
ResolvedMar 15, 2019
UpdatedApr 4, 2019
View Jira Issue