'************************************************** ' FILE : CircularReferenceException.vb ' AUTHOR : Paulo Santos ' CREATION : 9/30/2007 12:12:13 AM ' COPYRIGHT : Copyright © 2007 ' PJ on Development ' All Rights Reserved. ' ' Description: ' Represents an error when a macro has a circular reference. ' ' Change log: ' 0.1 9/30/2007 12:12:13 AM ' Paulo Santos ' Created. '*************************************************** Imports System.Runtime.Serialization Imports System.Security.Permissions ''' ''' Represents an error when a macro has a circular reference. ''' _ Public Class CircularReferenceException Inherits Exception Dim __Path As String ''' Initializes an instance of the class. ''' This is the default constructor for this class. Public Sub New() MyBase.New(My.Resources.CircularReferenceException_Message) End Sub ''' Initializes an instance of the class. ''' The path of the circular reference. Public Sub New(ByVal circularReferencePath As String) MyBase.New(My.Resources.CircularReferenceException_Message) __Path = circularReferencePath.Replace("}{", "} -> {") End Sub ''' Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. ''' The path of the circular reference. ''' The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. Public Sub New(ByVal circularReferencePath As String, ByVal innerException As System.Exception) MyBase.New(My.Resources.CircularReferenceException_Message, innerException) __Path = circularReferencePath.Replace("}{", "} -> {") End Sub ''' ''' Initializes an instance of the class. ''' ''' The message that describes the error. ''' The path of the circular reference. Public Sub New(ByVal message As String, ByVal circularReferencePath As String) MyBase.New(message) __Path = circularReferencePath.Replace("}{", "} -> {") End Sub ''' ''' Initializes an instance of the class. ''' ''' The message that describes the error. ''' The path of the circular reference. ''' The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. Public Sub New(ByVal message As String, ByVal circularReferencePath As String, ByVal innerException As System.Exception) MyBase.New(message, innerException) __Path = circularReferencePath.Replace("}{", "} -> {") End Sub ''' Initializes a new instance of the class with serialized data. ''' The that holds the serialized object data about the exception being thrown. ''' The that contains contextual information about the source or destination. ''' The parameter is null. ''' The class name is null or is zero (0). Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) MyBase.New(info, context) __Path = info.GetString("__Path") End Sub ''' ''' Gets the path of the circular reference. ''' ''' The path of the circular reference. Public ReadOnly Property CircularReferencePath() As String Get Return __Path End Get End Property ''' When overridden in a derived class, sets the with information about the exception. ''' The that holds the serialized object data about the exception being thrown. ''' The that contains contextual information about the source or destination. ''' The parameter is a null reference (Nothing in Visual Basic). ''' 2 ''' ''' ''' ''' _ Public Overrides Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) MyBase.GetObjectData(info, context) info.AddValue("__Path", __Path, GetType(String)) End Sub End Class