The link in the accepted answer is no longer available (domain has lapsed), but the information is still available through the Wayback Machine. I'm going to repeat the entire post here, with credit to the original author. If that's not the right thing to do I'm sure someone will be along to correct it...
ExecutionEngineException when raising the PropertyChanged event
Posted on April 23, 2009 by ceiled, on (their?) "Occam Says" blog.
If you’ve ever seen an ExecutionEngineException in .NET, you know that it’s nasty. It even sounds intimidating. It’s the error that’s thrown by Environment.FailFast() — MSDN describes it as "the exception that is thrown when there is an internal error in the execution engine of the common language runtime." Before last night, the only time I’d ever seen it was when I was generating and running my own IL assembly code and I did something wrong like pop too many values off the stack or something.
However, last night I got it while raising a PropertyChanged event on my INotifyPropertyChanged object, immediately after using PropertyChangedEventManager to subscribe to it. I scratched my head…how the hell did I manage to cause an internal error in the CLR? I restarted Visual Studio, I rebooted my machine, I tried it on other machines to see if it was some sort of crazy corruption on my system, but it was completely repeatable.
Finally, in desperation, I set up .NET source stepping (something I’ve been meaning to do for a while anyway) and ran it again — this time, instead of showing up on the line where I raised the PropertyChanged event, the exception stopped on this code in WeakEventManager.cs:
bool condition = listener.ReceiveWeakEvent(managerType, sender, args);
if (!condition)
{
Invariant.Assert(condition, SR.Get("ListenerDidNotHandleEvent"), SR.Get("ListenerDidNotHandleEventDetail", new object[] { listener.GetType(), managerType }));
}
That’s right…when ReceiveWeakEvent returns false (indicating that the listener did not handle the event being raised), WeakEventManager calls Environment.FailFast(). This is the software equivalent of people in horror movies choosing to shoot themselves in the face rather than turn into a zombie and possibly hurt their friends. It writes an event to the Event Viewer that says "Unrecoverable system error."
This may be the most ridiculously over-reactive error processing I’ve ever seen in my life, and for some reason, Google is completely unhelpful on this subject. Searching for "PropertyChangedEventManager ExecutionEngineException" turns up virtually nothing — the only result in English was a 404, and Google’s cached version didn’t have either keyword in it, for some reason. Hopefully this will save someone the intense frustration I experienced when I accidentally returned false from a random event handler somewhere, and was told that my execution engine had become unrecoverably corrupt and would be shut down for its own protection. If this post helps you, please tell me so in the comments so I’ll know my time wasn’t completely wasted.