Strange Crashes in VS2013: Release Mode Only

Help! I’m getting weird crashes on Release configurations while building for WPhone 8.1. They don’t show up on Debug configurations at all. The crash is always the same:
An unhandled exception of type ‘System.ExecutionEngineException’ occurred in XYZ.NI.DLL
Funny thing is, XYZ.dll is sometimes Assembly-CSharp, sometime’s it’s System.Core; basically all over the place, but it also happens to crash at one specific point in the game (during a tutorial step). I thought at first it might be something to do with memory, but I’m running the game on a Lumia 830, which has 1GB RAM, and I checked in the profiler: the game is using around 200mb. WP8.1 Emulator doesn’t crash either.

When I build the same project using Windows Phone 8 platform, I don’t get the crash.

Other (maybe) relevant build settings:
Api Compatibility Settings: 2.0
Compilation Overrides: None

Thanks :slight_smile:

Looks pretty serious.
Have tried using .NET Core compilation override? Maybe there’s something unsupported in your code.

1 Like

Hmmm. I’m getting a lot of compilation errors when I switch to the .NET Core compilation override. I’ll fix them up and then try again. Funny though, that it works in some cases and crashes in others. I even made a Universal build and deployed it on my desktop running W8.1. Worked perfectly. Any idea why something like this would occur by the way?

System.ExecutionEngineException means that the CLR crashed from the inside. I don’t think this can be caused by using unavailable APIs, more than likely there’s something wrong with the compiled assemblies (or the plugins). Chances are, we produce buggy metadata when building the player in some weird edge case and you’re hitting it. It could also be a bug in the CLR. If you submitted a bug, we’d be happy to look into it.

As for why it doesn’t happen on Windows: Windows and Windows Phone run a little different flavour of CLR, even though if they’re sharing the base class library. This specific crash might be specific to the Windows Phone variant.

1 Like

Well, clearing the 200 or so compile errors worked for me. It isn’t crashing any more, thanks a load! :). I was using a lot of unsupported Reflection methods, replacing them with supported ones did the job.