Bicubic
Bicubic

Reputation: 504

How to get Exception details without debugger?

I'm testing a .net 4 application on a stock windows install and get a crash as it starts up. The "View problem details" from the error dialog tells me that its a System.IO.FileNotFoundException but does not show the exception data so I have no idea what file it's trying to load.

Is there a way to get some more detailed data about the exception without installing visual studio?

Upvotes: 1

Views: 1729

Answers (3)

Hans Passant
Hans Passant

Reputation: 941237

Write an event handler for AppDomain.CurrentDomain.UnhandledException. Log or display the value of e.ExceptionObject.ToString() to get the exception message and the stack trace.

Upvotes: 1

Rytmis
Rytmis

Reputation: 32037

You can also try looking at the Windows Event Log. For example, a quick search on my machine found the following error from MetroTwit (a .NET Twitter client):

Application: MetroTwit.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
   at System.Windows.Application.GetResourcePackage(System.Uri)
   at System.Windows.Application.LoadComponent(System.Object, System.Uri)
   at MetroTwit.View.ErrorView.InitializeComponent()
   at MetroTwit.View.ErrorView..ctor(System.String)
   at MetroTwit.App.Application_DispatcherUnhandledException(System.Object,     System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)
   at System.Windows.Threading.Dispatcher.CatchException(System.Exception)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object,         
    System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate, System.Object, 
    Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.InvokeImpl(
    System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, 
    System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(
    System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run()
   at MetroTwit.App.Main()

The error level was Error and the source was ".NET Runtime"

Upvotes: 1

Tokk
Tokk

Reputation: 4502

You could use ProcMon to Monitor your application to find out wich file it tries to find. (When starting Procmon you should filter out every thing else before starting your App)

Upvotes: 1

Related Questions