在庫ウィンドウのインストールで.net 4アプリケーションをテストしていて、起動時にクラッシュします。 エラーダイアログボックスの「問題の詳細を表示」には、System.IO.FileNotFoundExceptionが表示されますが、例外データは表示されないため、どのファイルが読み込もうとしているのかわかりません。デバッガなしで例外の詳細を取得するには?
Visual Studioをインストールせずに例外に関する詳細データを取得する方法はありますか?
在庫ウィンドウのインストールで.net 4アプリケーションをテストしていて、起動時にクラッシュします。 エラーダイアログボックスの「問題の詳細を表示」には、System.IO.FileNotFoundExceptionが表示されますが、例外データは表示されないため、どのファイルが読み込もうとしているのかわかりません。デバッガなしで例外の詳細を取得するには?
Visual Studioをインストールせずに例外に関する詳細データを取得する方法はありますか?
書くましたAppDomain.CurrentDomain.UnhandledExceptionのイベントハンドラです。例外メッセージとスタックトレースを取得するには、e.ExceptionObject.ToString()の値を記録または表示します。
私は上記の提案をすべて試しましたが、ProcMonは非常に冗長で、読み込みに失敗したものを特定できませんでした。システムログは追加情報をほとんど得ず、見つからなかったファイルを特定しませんでした。トップレベルの例外をフックし、それらをログすることは間違いなく最も簡単な選択でした。 – Bicubic
ProcMonを使用すると、アプリケーションを監視して見つけようとしているファイルを見つけることができます。 (Procmonを起動するときは、アプリケーションを起動する前に他のすべてを除外する必要があります)
Windowsイベントログを調べることもできます。例えば、私のマシン上のクイック検索はMetroTwitから次のエラー(.NETのTwitterクライアント)が見つかりました:
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()
エラーレベルがエラーだったが、ソースは「.NETランタイム」
これは自動ではないので、コードを書く必要があります。 –
*は自動で非常に便利です。 –
これは自動ですが、例外の詳細のほとんどはログに記録されません。しかし、これは間違いなく簡単にスタックトレースをしたいだけです! – Bicubic
問題がライブラリ/依存関係の問題のように見えます。その場合、フレームワークは例外の詳細をWindowsイベントログにダンプしている可能性があります。そこを見てください。 –