Description

This is a regression.
This does not affect UE5.

Creating a function with parameter type TEnumAsByte<MyEnum> will crash while compiling. In 4.26 and UE5 the code compiles without issue, and the user is able to access the enum.

Steps to Reproduce
  1. Create a blank c++ project without starter content
  2. Make a new public c++ class derived from DataAsset named MyDataAsset
    • In the Add C++ Class dialog enable Show All Classes
    • In the Search field type DataAsset then select DataAsset under Object
    • Click Next
    • Name the class MyDataAsset then click Public
    • Click Create Class
  3. Press Reload All when Visual Studio opens
  4. In the MyDataAsset.h add the following code:
    • Above #include "MyDataAsset.generated.h" add
      #include "Containers/EnumAsByte.h"
    • Below #include "MyDataAsset.generated.h" add
      UENUM()
      enum Button
      {
      N UMETA(DisplayName = "N"),
      E UMETA(DisplayName = "E"),
      S UMETA(DisplayName = "S"),
      W UMETA(DisplayName = "W"),
      };
      
    • Below GENERATED_BODY() add
      public:
      UFUNCTION(BlueprintPure)
      uint8 ReturnTwo(TEnumAsByte<Button> SelectedButton);
      

      5. Open MyDataAsset.cpp if it isn't already (Soulution Explorer: Source/<ProjectName>/Private)
      6. In MyDataAsset.cpp below the '#include' add:

uint8 UMyDataAsset::ReturnTwo(TEnumAsByte<Button> SelectedButton)
{
return 2;
}

      7. Press Ctrl+Shift+S to save all
      8. Back in the Editor Press Compile in the Toolbar

Expected Results:
The code compiles and the user is able to reference the Enum in blueprints by search MyDataAsset with Context Sensitive disabled.

Actual Results:
Editor Crashes while compiling, and will crash on launch.

Callstack
Windows GetLastError: The operation completed successfully. (0)
 Error: === Critical error: ===
 Error: 
 Error: Assertion failed: !GeneratedWrappedTypes.Contains(TypeRegistryName) [File:D:/Build/++UE4/Sync/Engine/Plugins/Experimental/PythonScriptPlugin/Source/PythonScriptPlugin/Private/PyWrapperTypeRegistry.cpp] [Line: 1780] 
 Error: 
 Error: 
 Error: 
 Error: [Callstack] 0x00007fff1c69a839 KERNELBASE.dll!UnknownFunction []
 Error: [Callstack] 0x00007ffec2f60216 UE4Editor-Core.dll!ReportAssert() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsPlatformCrashContext.cpp:1644]
 Error: [Callstack] 0x00007ffec2f64218 UE4Editor-Core.dll!FWindowsErrorOutputDevice::Serialize() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsErrorOutputDevice.cpp:78]
 Error: [Callstack] 0x00007ffec2c8242d UE4Editor-Core.dll!FOutputDevice::LogfImpl() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Misc\OutputDevice.cpp:61]
 Error: [Callstack] 0x00007ffec2bd6a45 UE4Editor-Core.dll!AssertFailedImplV() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:104]
 Error: [Callstack] 0x00007ffec2bd80a0 UE4Editor-Core.dll!FDebug::CheckVerifyFailedImpl() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:461]
 Error: [Callstack] 0x00007ffe75ab07db UE4Editor-PythonScriptPlugin.dll!FPyWrapperTypeRegistry::GenerateWrappedEnumType() [D:\Build\++UE4\Sync\Engine\Plugins\Experimental\PythonScriptPlugin\Source\PythonScriptPlugin\Private\PyWrapperTypeRegistry.cpp:1780]
 Error: [Callstack] 0x00007ffe75ab458d UE4Editor-PythonScriptPlugin.dll!FPyWrapperTypeRegistry::GenerateWrappedTypesForReferences() [D:\Build\++UE4\Sync\Engine\Plugins\Experimental\PythonScriptPlugin\Source\PythonScriptPlugin\Private\PyWrapperTypeRegistry.cpp:544]
 Error: [Callstack] 0x00007ffe75ab3ac3 UE4Editor-PythonScriptPlugin.dll!FPyWrapperTypeRegistry::GenerateWrappedTypesForModule() [D:\Build\++UE4\Sync\Engine\Plugins\Experimental\PythonScriptPlugin\Source\PythonScriptPlugin\Private\PyWrapperTypeRegistry.cpp:493]
 Error: [Callstack] 0x00007ffe75a2f787 UE4Editor-PythonScriptPlugin.dll!FPythonScriptPlugin::OnModulesChanged() [D:\Build\++UE4\Sync\Engine\Plugins\Experimental\PythonScriptPlugin\Source\PythonScriptPlugin\Private\PythonScriptPlugin.cpp:1344]
 Error: [Callstack] 0x00007ffe75a11b5c UE4Editor-PythonScriptPlugin.dll!TBaseRawMethodDelegateInstance<0,FPythonScriptPlugin,void __cdecl(FName,enum EModuleChangeReason),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:469]
 Error: [Callstack] 0x00007ffec2cc1af8 UE4Editor-Core.dll!TMulticastDelegate<void __cdecl(FName,enum EModuleChangeReason),FDefaultDelegateUserPolicy>::Broadcast() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:955]
 Error: [Callstack] 0x00007ffec2ce1665 UE4Editor-Core.dll!FModuleManager::LoadModuleWithFailureReason() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Modules\ModuleManager.cpp:547]
 Error: [Callstack] 0x00007fff05176433 UE4Editor-Projects.dll!FModuleDescriptor::LoadModulesForPhase() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Projects\Private\ModuleDescriptor.cpp:643]
 Error: [Callstack] 0x00007fff0517674f UE4Editor-Projects.dll!FProjectManager::LoadModulesForProject() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Projects\Private\ProjectManager.cpp:62]
 Error: [Callstack] 0x00007ff625455642 UE4Editor.exe!FEngineLoop::LoadStartupModules() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3880]
 Error: [Callstack] 0x00007ff625459000 UE4Editor.exe!FEngineLoop::PreInitPostStartupScreen() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3263]
 Error: [Callstack] 0x00007ff625450d2c UE4Editor.exe!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:132]
 Error: [Callstack] 0x00007ff6254510ba UE4Editor.exe!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
 Error: [Callstack] 0x00007ff6254540dd UE4Editor.exe!LaunchWindowsStartup() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:273]
 Error: [Callstack] 0x00007ff625465984 UE4Editor.exe!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:320]
 Error: [Callstack] 0x00007ff62546853a UE4Editor.exe!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
 Error: [Callstack] 0x00007fff1cc77bd4 KERNEL32.DLL!UnknownFunction []
 Error: [Callstack] 0x00007fff1e8cced1 ntdll.dll!UnknownFunction []
 Error: 
 Executing StaticShutdownAfterError

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Editor - Workflow Systems
Affects Versions4.27
Target Fix5.0
Fix Commit16023636
Main Commit16023636
CreatedJan 11, 2022
ResolvedJan 19, 2022
UpdatedJan 22, 2024
View Jira Issue