Freeze due to Map(Dictionary) after upgrading from 4.15 -> 4.16

I don’t know how to reproduce this in a new project, however I do know what is causing the problem.

I have an actor component that has a map (name → struct) in it. After upgrading to 4.16, I was attempting to add an interface to this actor component, and after hitting compile was presented with a hang (not a crash).

I was able to fix this hang by simply deleting the map and recreating it, I’m now fully able to add any interface I want with no problem.

I’ve narrowed down the problem to the CopyValuesInternal function in the UMapProperty class as seen below.

What happens is that in the for loop SrcMapHelper.IsValidIndex function

always fails, this means that the condition for decrementing Num is never met and SrcIndex just keeps counting and counting, and we enter an infinite loop, which is why we get a hang and not just a straight crash.

An interesting side note and something that may shed more light on the root cause is that if an interface is added that has NO declared functions in it the compile would continue as normal, though that may be because nothing is actually being regenerated I’m not super familiar with how Unreal handles when it rebuilds certain things.