Home > DeveloperSection > Interviews > How has exception handling changed in .NET Framework 4.0?

Posted on    August-27-2014 11:49 PM

 C# C# 
 1 Answer(s)
  1201  View(s)
Rate this:

Sumit Kesarwani

Total Post:782

Posted on    August-27-2014 12:00 AM

In .NET 4.0, a new namespace, System.Runtime.ExceptionServices, has been introduced which contains the following classes for handling exceptions in a better and advanced manner:

HandleProcessCorruptedStateExceptionsAttribute Class - Enables managed code to handle the corrupted state exceptions that occur in an operating system. These exceptions cannot be caught by specifying the try...catch block. To handle such exceptions, you can apply this attribute to the method that is assigned to handle these exceptions.

FirstChanceExceptionEventArgs Class - Generates an event whenever a managed exception first occurs in your code, before the common language runtime begins searching for event handlers.

Don't want to miss updates? Please click the below button!

Follow MindStick