Adding For Each Loop to Blueprint function containing local variables causes crash

If there are local variables in a Blueprint function and you attempt to add a for each loop or for each loop with break, the engine will crash. I’m able to reproduce this time after time and it only happens on version 4.2. 4.1.1 is fine. I had a co-worker try on his engine and he has the same problem.

Looking at the crash report it points to what appears to be a hard coded drive letter of d:. I don’t have a d:\ drive on my system, unless this is something internal to the engine.

Crash Report
!Id:63ab3f8dfed3f134ea44146e01766ca2

Unknown exception - code 00000001 (first/second chance not available)

Assertion failed: InVariableScope [File:d:\buildfarm\buildmachine_++depot+ue4-releases+4.2\engine\intermediate\build\win64\inc\blueprintgraph…//…//…//…//…//Source//Editor//BlueprintGraph//Classes//EdGraphSchema_K2_Actions.h] [Line: 558]

KERNELBASE + 37901 bytes
UE4Editor_Core + 2998748 bytes
UE4Editor_Core + 1620298 bytes
UE4Editor_Core + 1561376 bytes
UE4Editor_BlueprintGraph + 512208 bytes
UE4Editor_Kismet + 2580596 bytes
UE4Editor_Kismet + 2517528 bytes
UE4Editor_Kismet + 2532301 bytes
UE4Editor_GraphEditor + 1485159 bytes
UE4Editor_Kismet + 2803023 bytes
UE4Editor_Kismet + 1180073 bytes
UE4Editor_Kismet + 1035134 bytes
UE4Editor_Kismet + 787480 bytes
UE4Editor_Kismet + 806973 bytes
UE4Editor_Engine + 1030035 bytes
UE4Editor_UnrealEd + 8188582 bytes
UE4Editor_BlueprintGraph + 475074 bytes
UE4Editor_BlueprintGraph + 474795 bytes
UE4Editor_Kismet + 1952481 bytes
UE4Editor_Kismet + 1753176 bytes
UE4Editor_GraphEditor + 1194729 bytes
UE4Editor_GraphEditor + 1383314 bytes
UE4Editor_GraphEditor + 994668 bytes
UE4Editor_GraphEditor + 975442 bytes
UE4Editor_GraphEditor + 1380292 bytes
UE4Editor_Slate + 633935 bytes
UE4Editor_Slate + 592823 bytes
UE4Editor_Core + 2624539 bytes
UE4Editor_Core + 2558849 bytes
UE4Editor_Core + 2629279 bytes
UE4Editor_Core + 2547554 bytes
user32 + 105425 bytes
user32 + 104666 bytes
UE4Editor_Core + 2630294 bytes
UE4Editor!FEngineLoop::Tick() + 3135 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.2\engine\source\runtime\launch\private\launchengineloop.cpp:2073]
UE4Editor!GuardedMain() + 476 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.2\engine\source\runtime\launch\private\launch.cpp:132]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.2\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.2\engine\source\runtime\launch\private\windows\launchwindows.cpp:207]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

Hey zuppers,

Thanks for your report–we were able to reproduce this internally and have filed a defect report to have it fixed as soon as possible.

Cheers,

-Steve

What can we do to workaround this issue? The crash does actually happen in 4.1.1, and I can replicate it under any conditions using a macro of any kind inside of a blueprint function, even without local variables. Essentially, I can’t use blueprints if I have to use any of the standard macros.

I was not able to replicate this issue in 4.1.1. Both macros and local variables work just fine for me. If you haven’t done so already, create a new test project and try adding a macro to your Blueprint. If it doesn’t crash then you may want to evaluate any C++ code or Blueprints in your project that is crashing. If it does crash on a new project, you can verify your install by opening the UE4 launcher and clicking Library. Once in the library click on the down arrow next to your engine version and choose verify. I should note that I am using executable build of the engine and I did not build it from the source code.