#919 – Think Twice about Handling Corrupted State Exceptions

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.


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #919 – Think Twice about Handling Corrupted State Exceptions

  1. Michał says:

    Great article. Together with 918 and 917 it helped me a lots. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: