C# Seminar based on Role of .NET in Exception Handling presented by Asrarulhaq Maktedar as a seminar topic. The Short PowerPoint Presentation will help you to understand the role of .NET in exception handling
2. ERRORS, BUGS
& EXCEPTION
Errors: These are caused by end-user of the
application.
For Ex: entering un-expected value in a textbox, say
USN.
Bugs: These are caused by the programmer.
For Ex: → making use of NULL pointer or
→ referring array-index out of bound
Exceptions: These are regarded as runtime anomalies
that are difficult to prevent.
For Ex: → trying to connect non-existing database
→ trying to open a corrupted file
→ trying to divide a number by zero
3. THE ROLE
OF .NET
EXCEPTION
HANDLING
Programmers have a well-defined
approach to error handling which is
common to all .NET aware languages.
Identical syntax used to throw &
catch exceptions across assemblies,
applications & machine boundaries.
Exceptions are objects that contain a
human readable description of the
problem.
The end-user can be provided with
the help-link information.
Help-link information point to a URL
that provides detailed information
regarding error at hand.
4. THE ATOMS
OF .NET
EXCEPTION
HANDLING
• Programming with structured exception
handling involves the use of 4 key elements:
• i) A 'type' that represents the details of the
exception that occurred.
• ii) A method that throws an instance of the
exception-class to the caller.
• iii) A block of code that will invoke the
exception-ready method (i.e. try block).
• iv) A block of code that will process the
exception (i.e. catch block).
• C# offers 4 keywords {try, catch, throw and
finally} that can be used to throw and handle
exceptions.
• The type that represents the problem at
hand is a class derived from
System.Exception.
5. CORE MEMBERS OF SYSTEM.EXCEPTION
TYPE
Member Meaning
Message This returns textual description of a given error. The
error-message itself is set as a constructor-parameter.
TargetSite This returns name of the method that threw the exception.
Source This returns name of the assembly that threw the exception.
HelpLink This returns a URL to a help-file which describes the error in
detail.
StackTree This returns a string that identifies the sequence of calls that
triggered the exception.
InnerException This is used to obtain information about the previous
exceptions that causes the current exception to occur.