We are working with some legacy DLLs on our C#/.NET project. Why some exception on the legacy code cannot be caught and the application crashes? What makes the difference with standard .NET exceptions?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Jeffrey Ritcher, in his magnificent “CLR via C#”, tells us: some unmanaged-code failures are considered “corrupted state exceptions” (CSEs) by the .Net Runtime (CLR). Usually (see later), these exceptions cannot be caught by us mere mortals. Even
finallyblocks aren’t executed upon one of these failures, which include:You can, however, apply the HandleProcessCorruptedStateExceptionsAttribute and the SecurityCriticalAttribute attributes to the specific method in which you expect CSEs to happen. Inside this method you can code a
try...catchblock which will catch the CSE.Much more detailed information can be found in this article: http://msdn.microsoft.com/en-us/magazine/dd419661.aspx