Description

A packaged project will crash if a TMap that uses an enum as the key is accessed.

This was also tested by launching the same project onto an Android device, which showed the same results.

Steps to Reproduce
  1. Create a new code project.
  2. Add a new Actor code class to the project.
  3. Add the following code to the top of the header file for the new code class:
    UENUM(BlueprintType)
    enum class ECharacterCommandType : uint8
    {
    	None,
    	Fire,
    	CastSkill1,
    	CastSkill2,
    	CastSkill3,
    	CastItemSkill,
    };
    
    inline uint32 GetTypeHash(const ECharacterCommandType& A)
    {
    	return (uint32)A;
    }
    
  4. Add the following property to the code class:
    UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Skill)
    TMap<ECharacterCommandType, float> DefaultCharacterCommandToSkill;
    
  5. Create a Blueprint of the new code class.
  6. In the new Blueprint, locate the TMap property from step 4 and add 2 or more elements to it, with a different value for each element.
  7. Create a new Actor Blueprint.
  8. In the new Actor Blueprint, add a new variable that is a class of the Blueprint from step 5.
  9. In the Event Graph of the same Blueprint, create the graph shown in the attached BP_Setup image.
  10. Place an instance of the Blueprint from step 5 into the level.
  11. Start PIE.
    • Note that the value for the element is printed to the screen.
  12. Stop PIE.
  13. Package the project for Win64.
  14. Run the packaged project.

RESULT:
The packaged project crashes and shows the following error: Assertion failed: PropertyFlags & CPF_HasGetValueTypeHash

EXPECTED:
The value is printed to the screen as it was in PIE.

Callstack
Assertion failed: PropertyFlags & CPF_HasGetValueTypeHash [File:D:\Main-Builds\Stream\Engine\Source\Runtime\CoreUObject\Private\UObject\Property.cpp] [Line: 1315] 



TestTMapEnum!FDebug::AssertFailed() [d:\main-builds\stream\engine\source\runtime\core\private\misc\assertionmacros.cpp:349]
TestTMapEnum!UProperty::GetValueTypeHash() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\property.cpp:1316]
TestTMapEnum!FScriptSet::Find() [d:\main-builds\stream\engine\source\runtime\core\public\containers\set.h:1453]
TestTMapEnum!FScriptMap::FindPair() [d:\main-builds\stream\engine\source\runtime\core\public\containers\map.h:1333]
TestTMapEnum!FScriptMap::FindValue() [d:\main-builds\stream\engine\source\runtime\core\public\containers\map.h:1350]
TestTMapEnum!UBlueprintMapLibrary::GenericMap_Find() [d:\main-builds\stream\engine\source\runtime\engine\private\blueprintmaplibrary.cpp:30]
TestTMapEnum!UBlueprintMapLibrary::execMap_Find()
TestTMapEnum!UFunction::Invoke() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\class.cpp:4469]
TestTMapEnum!UObject::CallFunction() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:722]
TestTMapEnum!UObject::ProcessContextOpcode() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2165]
TestTMapEnum!UObject::execLetBool() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2067]
TestTMapEnum!UObject::ProcessInternal() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:943]
TestTMapEnum!UObject::CallFunction() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:845]
TestTMapEnum!UObject::ProcessInternal() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:943]
TestTMapEnum!UFunction::Invoke() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\class.cpp:4469]
TestTMapEnum!UObject::ProcessEvent() [d:\main-builds\stream\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1313]
TestTMapEnum!AActor::ProcessEvent() [d:\main-builds\stream\engine\source\runtime\engine\private\actor.cpp:689]
TestTMapEnum!AActor::ReceiveBeginPlay()
TestTMapEnum!AActor::BeginPlay() [d:\main-builds\stream\engine\source\runtime\engine\private\actor.cpp:3134]
TestTMapEnum!AActor::DispatchBeginPlay() [d:\main-builds\stream\engine\source\runtime\engine\private\actor.cpp:3102]
TestTMapEnum!AWorldSettings::NotifyBeginPlay() [d:\main-builds\stream\engine\source\runtime\engine\private\worldsettings.cpp:184]
TestTMapEnum!AGameStateBase::HandleBeginPlay() [d:\main-builds\stream\engine\source\runtime\engine\private\gamestatebase.cpp:177]
TestTMapEnum!UWorld::BeginPlay() [d:\main-builds\stream\engine\source\runtime\engine\private\world.cpp:3424]
TestTMapEnum!UEngine::LoadMap() [d:\main-builds\stream\engine\source\runtime\engine\private\unrealengine.cpp:10285]
TestTMapEnum!UEngine::Browse() [d:\main-builds\stream\engine\source\runtime\engine\private\unrealengine.cpp:9551]
TestTMapEnum!UGameInstance::StartGameInstance() [d:\main-builds\stream\engine\source\runtime\engine\private\gameinstance.cpp:421]
TestTMapEnum!FEngineLoop::Init() [d:\main-builds\stream\engine\source\runtime\launch\private\launchengineloop.cpp:2579]
TestTMapEnum!GuardedMain() [d:\main-builds\stream\engine\source\runtime\launch\private\launch.cpp:155]
TestTMapEnum!GuardedMainWrapper() [d:\main-builds\stream\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
TestTMapEnum!WinMain() [d:\main-builds\stream\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
TestTMapEnum!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

3
Login to Vote

Fixed
ComponentUE - Foundation - Core
Affects Versions4.15.14.16
Target Fix4.16
Fix Commit3353658
Main Commit3386123
CreatedMar 31, 2017
ResolvedApr 3, 2017
UpdatedSep 16, 2019