Name

Exception

Synopsis

This is the base class for all .NET exceptions. .NET Framework exceptions are generally derived from SystemException, and user-defined exceptions are generally derived from ApplicationException.

In some cases, one exception may throw another; this is often the case when using layered architectures. For example, a persistence layer may throw a persistence-related exception (DatabaseNotFoundException), whose semantics are undefined at a higher level (such as the UI layer). In this case, a middle layer may throw a new exception-derived type (such as PersistenceException), but doesn’t wish to lose the original source of the exception — instead, it wraps the original exception by setting it to be the InnerException. In this way, a layer can communicate a lower-level exception to higher layers without losing information or violating encapsulation.

The StackTrace property is a string containing the stacktrace. This permits determination of the call sequence leading up to the line that threw the exception. HelpLink contains a link to a help file with information about the exception. Message contains a text message that describes the exception.

Public Class Exception : Implements System.Runtime.Serialization.ISerializable
' Public Constructors
   Public Sub New() 
   Public Sub New( ByVal message As String) 
   Public Sub New(ByVal message As String, 
        ByVal innerException As Exception) 
' Protected Constructors
   Protected Sub New( ByVal info As System.Runtime.Serialization.SerializationInfo, ...

Get VB.NET Core Classes in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.