We have a situation where our application sometimes raises an ExecutionEngineException
. I thought that when it happens, the application should crash, but it does not crash. And even if the event viewer claims that the application was terminated - it continues running! Only seems that the offending thread is silently killed.
The problem is that we are unable to recreate the conditions when it occurs - the suspected code is executed thousands of times before the exception occurs. There is nothing in the logs. In short - we are puzzled.
I would like to be able to generate this exception at will in order to learn how our application behaves when it happens. Of course, it must be thrown by the framework itself, issuing throw new ExecutionEngineException
does not count.
So, my question is - how can I cause it reliably? Please, provide a code sample.
We are on .NET 4, moving soon to .NET 4.5