P
Phill W.
Can anyone supply me with the code (C# or VB) that lies within the
Exception.ToString() method?
I'm writing Custom Exception classes and want to ensure that mine will
be consistent (as far as Logging goes) with those defined in the
Framework (particularly where Exceptions are nested).
So far, I've pulled mscorlib apart and rummaged around the IL Code
therein, and come up with this ...
Public Overrides Function ToString() As String
Dim sRC As String _
= Me.GetType().ToString() & ": " & Me.Message
If Not (Me.InnerException Is Nothing) Then
sRC &= " ---> " & Me.InnerException.ToString() _
& Environment.NewLine & " " _
& System.Environment.GetResourceString(
"Exception_EndOfInnerExceptionStack" )
End If
sRC &= Environment.NewLine & " " & Me.StackTrace
Return sRC
End Function
.... but the GetResourceString bit falls flat on its face and, to be
honest, I'm not entirely sure what it should be doing!
TIA,
Phill W.
Exception.ToString() method?
I'm writing Custom Exception classes and want to ensure that mine will
be consistent (as far as Logging goes) with those defined in the
Framework (particularly where Exceptions are nested).
So far, I've pulled mscorlib apart and rummaged around the IL Code
therein, and come up with this ...
Public Overrides Function ToString() As String
Dim sRC As String _
= Me.GetType().ToString() & ": " & Me.Message
If Not (Me.InnerException Is Nothing) Then
sRC &= " ---> " & Me.InnerException.ToString() _
& Environment.NewLine & " " _
& System.Environment.GetResourceString(
"Exception_EndOfInnerExceptionStack" )
End If
sRC &= Environment.NewLine & " " & Me.StackTrace
Return sRC
End Function
.... but the GetResourceString bit falls flat on its face and, to be
honest, I'm not entirely sure what it should be doing!
TIA,
Phill W.