StackTrace Property


StackTrace Property

Location

My.Application.Info.StackTrace

Syntax

     Dim result As String = My.Application.Info.StackTrace 

Description

The StackTrace property returns the current stack trace information. The stack appears in order, from the closest procedure down to the original procedure, each on a separate text line.

Usage at a Glance

  • This property is read-only.

  • Some fields may be absent from the returned trace if debugging symbols have been excluded from the project build.

  • An exception is thrown if the stack trace is out of range or cannot be gathered from the current context.

Example

Creating a new Windows Forms project and adding the following code to Form1's source code:

     Public Class Form1        Private Sub Form1_Click(ByVal sender As Object, _              ByVal e As System.EventArgs) Handles Me.Click           MsgBox(My.Application.Info.StackTrace)         End Sub     End Class 

produced these results when clicking on the form (slightly formatted to fit this page):

     at System.Environment.GetStackTrace(Exception e,        Boolean needFileInfo)     at System.Environment.get_StackTrace(  )     at Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.        get_StackTrace(  )     at WindowsApplication1.Form1.Form1_Click(Object sender,        EventArgs e) in C:\temp\WindowsApplication1\Form1.vb:line 4     at System.Windows.Forms.Control.OnClick(EventArgs e)     at System.Windows.Forms.Control.WmMouseUp(Message& m,        MouseButtons button, Int32 clicks)     at System.Windows.Forms.Control.WndProc(Message& m)     at System.Windows.Forms.ScrollableControl.WndProc(Message& m)     at System.Windows.Forms.ContainerControl.WndProc(Message& m)     at System.Windows.Forms.Form.WndProc(Message& m)     at System.Windows.Forms.Control.ControlNativeWindow.        OnMessage(Message& m)     at System.Windows.Forms.Control.ControlNativeWindow.        WndProc(Message& m)     at System.Windows.Forms.NativeWindow.DebuggableCallback(        IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)     at System.Windows.Forms.UnsafeNativeMethods.        DispatchMessageW(MSG& msg)     at System.Windows.Forms.Application.ComponentManager.        System.Windows.Forms.UnsafeNativeMethods.        IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID,        Int32 reason, Int32 pvLoopData)     at System.Windows.Forms.Application.ThreadContext.        RunMessageLoopInner(Int32 reason, ApplicationContext context)     at System.Windows.Forms.Application.ThreadContext.        RunMessageLoop(Int32 reason, ApplicationContext context)     at System.Windows.Forms.Application.Run(        ApplicationContext context)     at Microsoft.VisualBasic.ApplicationServices.        WindowsFormsApplicationBase.OnRun(  )     at Microsoft.VisualBasic.ApplicationServices.        WindowsFormsApplicationBase.DoApplicationModel(  )     at Microsoft.VisualBasic.ApplicationServices.        WindowsFormsApplicationBase.Run(String[] commandLine)     at WindowsApplication1.My.MyApplication.Main(String[] Args)        in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 76     at System.AppDomain.nExecuteAssembly(Assembly assembly,        String[] args)     at System.AppDomain.ExecuteAssembly(String assemblyFile,        Evidence assemblySecurity, String[] args)     at Microsoft.VisualStudio.HostingProcess.        HostProc.RunUsersAssembly(  )     at System.Threading.ThreadHelper.        ThreadStart_Context(Object state)     at System.Threading.ExecutionContext.Run(        ExecutionContext executionContext,        ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart(  ) 

Related Framework Entries

  • Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.StackTrace Property

  • System.Environment.StackTrace Property

See Also

Info Object (My.Application)




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net