FObjectFinder crash with Niagara

Hello!

In UE4.26 I found out that UE-72592 is relevant again. In my actor constructor:

SnowAndRain = CreateDefaultSubobject<UNiagaraComponent>(TEXT("SnowAndRainComponent"));

static ConstructorHelpers::FObjectFinder<UNiagaraSystem> RainAndSnowAsset(TEXT("NiagaraSystem'/Game/Particles/Rain_and_Snow.Rain_and_Snow'") );
if (RainAndSnowAsset.Succeeded()) {
	SnowAndRain->SetAsset(RainAndSnowAsset.Object);
} 

After adding this actor to scene, save and restart editor I have crash:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000008

UE4Editor_CoreUObject!UObject::ConditionalPostLoad() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1046]
UE4Editor_Niagara!UNiagaraEmitter::PostLoad() [D:\Build++UE4\Sync\Engine\Plugins\FX\Niagara\Source\Niagara\Private\NiagaraEmitter.cpp:483]
UE4Editor_CoreUObject!UObject::ConditionalPostLoad() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1082]
UE4Editor_CoreUObject!EndLoad() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1628]
UE4Editor_CoreUObject!::operator()() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1257]
UE4Editor_CoreUObject!LoadPackageInternal() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1363]
UE4Editor_CoreUObject!LoadPackage() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1458]
UE4Editor_CoreUObject!ResolveName() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:787]
UE4Editor_CoreUObject!StaticLoadObjectInternal() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:849]
UE4Editor_CoreUObject!StaticLoadObject() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:924]
UE4Editor_Survey!ConstructorHelpersInternal::FindOrLoadObject() [E:\Epic\UE_4.26\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h:36]
UE4Editor_Survey!AWeather::AWeather() [E:\Unreal\SurveyUE\Source\Survey\Private\Actors\Weather.cpp:28]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:3707]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectBase.cpp:908]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectBase.cpp:997]
UE4Editor!FEngineLoop::PreInitPostStartupScreen() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3017]
UE4Editor!GuardedMain() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:127]
UE4Editor!GuardedMainWrapper() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

1 Like

Maybe it will be useful for someone. I faced similar problem, adding include “NiagaraFunctionLibrary.h” helped

Thanks a lot. It worked. But Is there someone to tell me the reason?

For someone still have same problem, Adding also “NiagaraSystem.h” too helped