Imports System
Imports System.Text
Public Module Module1
Public Sub Main()
Try
Try
Dim sb As StringBuilder
sb.Append("vb.net")
Catch ex1 As Exception
Throw New ApplicationException("Catch ex1: ", ex1)
End Try
Catch ex2 As Exception
Console.WriteLine("Catch ex2: " & ex2.Message)
Console.WriteLine("ex2.StackTrace: " & ex2.StackTrace)
If ex2.InnerException IsNot Nothing Then
Console.WriteLine("ex2.InnerException: " & ex2.InnerException.Message)
Console.WriteLine("ex2.StackTrace: " & ex2.StackTrace)
End If
End Try
End Sub
End Module
' run:
'
' Catch ex2: Catch ex1:
' ex2.StackTrace: at Module1.Main()
' ex2.InnerException: Object reference not set to an instance of an object.
' ex2.StackTrace: at Module1.Main()
'