4.17 Editor crashing during load, Cast of REINST to ActorComponent

Fatal error: [File:D:\Build++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Templates\Casts.cpp] [Line: 10] Cast of REINST_ChooseResearchFocus_C_166 /Engine/Transient.REINST_FactionBase_C_259:Default__FactionBase_C.REINST_ChooseResearchFocus_C_0 to ActorComponent failed

The editor crashes at ~72% during the initial loading of our project in 4.17. I’ve submitted the report through the crash reporter but also the logs are attached below.

Walking through the code and it seems to be happening in KismetReinstanceUtilities.cpp :: ReplaceInstancesOfClass_Inner() - on line 1805 the ensureMsg is being hit by the debugger before the crash point further down when the cast happens.

The actor component is a blueprint class inheriting from its C++ base class which is inheriting from UOBJECT

Note that this issue has been in 4.17 previews as well but we have no issues in 4.15 (our production version) and 4.16 (test bed).

[UPDATED - To note issue persists in 4.17 release version]

link text

Hey Raf-

Do you have any reproduciton steps to help me see the crash you are? If I understand correctly you created an UObject->C++ class->Blueprint hierarchy and then added that blueprint as an actor component to another blueprint? Can you explain the setup used for this? Is possible, can you post a screenshot of the code/blueprint graph where the cast is taking place?

Hey !

I have attached screenshots of the graph and header files.

The inheritance chain for TileCanUpgradeBuilding is like so:
UObject (Engine C++) → UDataClassBase (C++) → UtilityConsideration (C++) → TileCanUpgradeBuilding (BP)

TileCanUpgradeBuilding (BP) is instanced from RequestUpgradeBuildingBase (BP) which itself has a similar hierarchy chain

UObject (Engine C++) → UDataClassBase (C++) → UtilityAction (C++) → UColony_BaseAction (C++) → RequestUpgradeBuildingBase (BP).


Further testing and walking through the engine code and comparing to 4.16.2, here are my findings which may be helpful

BlueprintCompilationManager.cpp
FBlueprintCompilationManagerImpl::FlushReinstancingQueueImpl() is never called during editor loading in 4.16.2

where as in 4.17p3 it is called with 787 ClassesToReinstance in our project, not all of them cause the ensure and cast that causes the crash but some do. Furthermore its trying to cast to an actor component when the BP is a UObject, just as the OldName doesn’t match the OldObject.

I tried deleting TileCanUpgradeBuilding and RequestUpgradeBuildingBase (and removing all references), it would just crash on another blueprint at ~72% loading mark. So it’s not these particular BPs the issue.

in 4.17 Preview1 and 2 the issue didn’t happen during loading of the editor, but it did when trying to load the blueprint inside the editor. I think this is because the behavior was changed.

I have reason to believe this might have to do after the changes in 4.17 to fix the CDO bug (UE-46534).
In 4.16.2 the CDO bug exists (waiting for 4.16.3) and while that breaks other things we didn’t have the REINST issues.
We don’t have neither of these issues in 4.15 but the engine code is quite different in these parts so it’s not surprising.

If you need more info please let me know or anything we can do to get to the bottom of this issue. Thanks!

link text

Tested our project in 4.16.3 and had no such issues. So this is strictly in 4.17.

Issue persists in 4.17 release version.

So it looks like the problem is due to the New Blueprint Compilation Manager.

Disabling it in the DefaultEditor.ini has allowed us to load the editor without it crashing and now our project runs in 4.17.

[/Script/UnrealEd.BlueprintEditorProjectSettings]
bUseCompilationManager=False

Just to add a little data. We just upgraded our 4.16.3 project to 4.17.1. Had a consistent editor crash when trying to compile an actor component bp and likewise any bp that referenced that component. Disabling the Compilation Manager as indicated above resolved the problem.

Thank you! Had a hard time figuring out why a specific BP was causing UE4 to crash on compilation after updating to 4.17 but this solution did the trick!

In case you’re still struggling with this issue, I’ve managed to fix it:

KismetReinstanceUtilities.cpp:1600

   const bool bIncludeDerivedClasses = false;
    ObjectsToReplace.Empty(); // ObjectsToReplace array wasn't cleared so below line added elements at the back to array, and next Object to fix had all previous ObjectsToReplace...
    GetObjectsOfClass(OldClass, ObjectsToReplace, bIncludeDerivedClasses);

Someone forgot to clear the array of objects to fix REINSTs :slight_smile:

Are you still running with the compilation manager disabled or have subsequent point releases addressed all the issues in your project? I believe the issue described originally was fixed in 4.17.2 but would love to be able to confirm (or get a repro for the bug you’ve found!).

Actually haven’t considered it until your comment, but yes, 4.17.2 appears to have corrected the problem.

Correction: Our project isn’t crashing, but using the compilation manager actually increases compilation times by a factor of 2 or 3. We’ve disabled it again.

Thank you for sharing!
I am still having the same error with UE 4.27.1. I looked up the KismetReinstanceUtilities.cpp. And, found they’ve added “ObjectsToReplace.Reset();”. Does that do the same as the empty. Or should I also add ObjectsToReplace.Empty() as well?

Im getting a similar error in 4.27 trying to spawn an object from c++ from a TSubClassOf after editing the derived blueprint in the editor.