Description

This issue was created for this UDN post: https://udn.unrealengine.com/questions/306933/hotreload-crashbad-behavior-when-addingremoving-pa.html

This repro is based off his last repro, cutting it down as much as I could to simplify it.

Having PreInternalvar not set to a value, will NOT crash.
Having the PreInternalvar declaration inside a #if or not doesn't matter- it will crash.

Steps to Reproduce
  1. Create a new First Person Code template project (Compile if on source)
  2. Right click in thr Content browser and create a new C++ class based on Character named: HRChar.
  3. Copy-Paste the following code into HRChar.h, overwriting all other code in the file:
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "GameFramework/Character.h"
#include "HRChar.generated.h"


USTRUCT(BlueprintType)
struct FFTestCompileIssue
{
	GENERATED_USTRUCT_BODY()

		// After opening the blueprint editor, change this to 1 and recompile.
#if 0
		// fire rate in shots per second for how fast the bullets come out
		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HotFiring")
		float PreInternalVar = 5;
#endif

	// what is launched when weapon fires
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HotFiring")
		TSubclassOf<class AActor> InternalClass;
};

UCLASS()
class HR_API AHRChar : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AHRChar();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

	/** Saved translation offset of mesh. */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "CrashTestProperties")
		TSubclassOf<class AActor> ActorClassBeforeBadProperty = nullptr;

	// Leave this one alone - if it is "#if 0"-d out then the other change won't crash it.
#if 1
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "CrashTestProperties")
		bool bNewFlag = true;
#endif

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "CrashTestProperties")
		FFTestCompileIssue HotReloadStruct;

	// ADD THESE FIRST
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "CrashTestProperties")
		TSubclassOf<class AActor> ActorClassAfterBadProperty = nullptr;

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "CrashTestProperties")
		int PrimaryIntegerValueOneFifty;

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "CrashTestProperties")
		int PrimaryIntegerValueTwoFifty;	
};
  1. Close the Editor and Rebuild the project in IDE.
  2. After it builds, open the project in Editor.
  3. In HRChar.h, change the first "#if 0" to "#if 1"
  4. Click the compile button in the editor.

Result:
Crash:
Access violation - code c0000005 (first/second chance not available)

Callstack
UE4Editor_HotReload!`FHotReloadClassReinstancer::SerializeCDOProperties'::`2'::FCDOWriter::operator<<() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:119]
UE4Editor_CoreUObject!UObjectProperty::SerializeItem() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\propertyobject.cpp:53]
UE4Editor_CoreUObject!FPropertyTag::SerializeTaggedProperty() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\propertytag.cpp:147]
UE4Editor_CoreUObject!UStruct::SerializeTaggedProperties() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\class.cpp:1153]
UE4Editor_CoreUObject!UScriptStruct::SerializeItem() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\class.cpp:2031]
UE4Editor_CoreUObject!UStructProperty::SerializeItem() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\propertystruct.cpp:113]
UE4Editor_CoreUObject!FPropertyTag::SerializeTaggedProperty() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\propertytag.cpp:147]
UE4Editor_CoreUObject!UStruct::SerializeTaggedProperties() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\class.cpp:1153]
UE4Editor_CoreUObject!UObject::SerializeScriptProperties() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\obj.cpp:1079]
UE4Editor_HotReload!FHotReloadClassReinstancer::SerializeCDOProperties() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:189]
UE4Editor_HotReload!FHotReloadClassReinstancer::RecreateCDOAndSetupOldClassReinstancing() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:249]
UE4Editor_HotReload!FHotReloadClassReinstancer::FHotReloadClassReinstancer() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:316]
UE4Editor_HotReload!FHotReloadClassReinstancer::Create() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreloadclassreinstancer.h:114]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClass() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreload.cpp:1228]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClasses() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreload.cpp:1219]
UE4Editor_HotReload!TBaseRawMethodDelegateInstance<0,FHotReloadModule,void __cdecl(void)>::ExecuteIfSafe() [d:\james.fox_t6726_main\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:638]
UE4Editor_CoreUObject!UClassReplaceHotReloadClasses() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:688]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\james.fox_t6726_main\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:835]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\james.fox_t6726_main\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:1017]
UE4Editor_Core!TBaseMulticastDelegate<void>::Broadcast() [d:\james.fox_t6726_main\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:921]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\james.fox_t6726_main\engine\source\runtime\core\private\modules\modulemanager.cpp:461]
UE4Editor_Core!FModuleManager::LoadModule() [d:\james.fox_t6726_main\engine\source\runtime\core\private\modules\modulemanager.cpp:322]
UE4Editor_HotReload!FHotReloadModule::DoHotReloadInternal() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreload.cpp:828]
UE4Editor_HotReload!UE4Function_Private::TFunctionRefCaller<<lambda_845f9b2944b03bbc30be1e1f4a8d7f4b>,void __cdecl(TMap<FString,FString,FDefaultSetAllocator,TDefaultMapKeyFuncs<FString,FString,0> > const & __ptr64,bool,enum ECompilationResult::Type)>::Call() [d:\james.fox_t6726_main\engine\source\runtime\core\public\templates\function.h:246]
UE4Editor_HotReload!FHotReloadModule::CheckForFinishedModuleDLLCompile() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreload.cpp:1877]
UE4Editor_HotReload!FHotReloadModule::Tick() [d:\james.fox_t6726_main\engine\source\developer\hotreload\private\hotreload.cpp:566]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\james.fox_t6726_main\engine\source\editor\unrealed\private\editorengine.cpp:1021]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\james.fox_t6726_main\engine\source\editor\unrealed\private\unrealedengine.cpp:371]
UE4Editor!FEngineLoop::Tick() [d:\james.fox_t6726_main\engine\source\runtime\launch\private\launchengineloop.cpp:2842]
UE4Editor!GuardedMain() [d:\james.fox_t6726_main\engine\source\runtime\launch\private\launch.cpp:156]
UE4Editor!GuardedMainWrapper() [d:\james.fox_t6726_main\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\james.fox_t6726_main\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255]
kernel32
ntdll

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-35474 in the post.

1
Login to Vote

Unresolved
ComponentCore - Hot Reload
Affects Versions4.13
CreatedSep 1, 2016
UpdatedSep 7, 2017