#919 – Think Twice about Handling Corrupted State Exceptions
August 29, 2013 1 Comment
Corrupted State Exceptions are exceptions that indicate that the memory state of the current process is likely corrupt. These CSEs by default cannot be caught by your code. This is normally what you want, since you typically don’t want to continue execution when one of these exceptions occurs. You can, however, use the HandleProcessCorruptedStateExceptions attribute to indicate that you do want to handle CSEs.
Be very careful when handling Corrupted State Exceptions. When an exception in this category is thrown, there is a good chance that the memory space of your process is corrupt. Continuing execution may lead to unpredictable behavior and could even cause other data to become corrupt.
If you do catch Corrupted State Exceptions, you should execute as little code as possible and exit your application as soon as possible. You might, for example, just log the fact that the CSE occurred and then exit.