お客様の 1 人がクラッシュを報告しました。彼女は、未処理の例外の後に次の標準エラー メッセージを見ました。
「アプリケーションが処理できない例外を生成しました... アプリケーションを終了するには [OK] をクリックしてください。アプリケーションをデバッグするには [キャンセル] をクリックしてください。」
DebugDiag を使用して、このプロセスのダンプを生成しました。私は今、ダンプを見ています。
!threads は、マネージド スレッドで例外を示しました。ネストされた例外がいくつかありました。これは一番下にありました:
0:000> !pe -nested
...
Nested exception -------------------------------------------------------------
Exception object: 14015a98
Exception type: System.AccessViolationException
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
InnerException: <none>
StackTrace (generated):
SP IP Function
0013E958 7B6EEF3B System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.OnThreadException(System.Exception)+0x8b
0013E994 7B6F7916 System_Windows_Forms_ni!System.Windows.Forms.Control.WndProcException(System.Exception)+0x16
0013E9A0 7B6FA39C System_Windows_Forms_ni!System.Windows.Forms.Control+ControlNativeWindow.OnThreadException(System.Exception)+0xc
0013E9A4 7B1C8512 System_Windows_Forms_ni!System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)+0x72
0013EC70 7B1D8D2E System_Windows_Forms_ni!System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)+0x24e
0013ED0C 7B1D8997 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)+0x177
0013ED60 7B1D87E1 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)+0x61
0013ED90 7B6EDE2B System_Windows_Forms_ni!System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)+0x33
0013EDA4 7B7225AB System_Windows_Forms_ni!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)+0x373
0013EE30 0DF41E76 PDILibReportProcessor!profdata.com.Library.libReportRenderCrystal.RenderToDisplay(System.Windows.Forms.IWin32Window, profdata.com.Library.libOutputSettings, profdata.com.Library.libApplicationConfig)+0xb6
0013EE4C 0DF416EB PDILibReportProcessor!profdata.com.Library.libReportProcessor.Process(System.Windows.Forms.IWin32Window)+0x153
0013EE60 07B37644 PDILibReportProcessor!profdata.com.Library.libReportProcessor.ProcessCrystalReport(System.String, System.Type, System.Data.DataSet, profdata.com.Library.libOutputSettings, profdata.com.Library.libApplicationConfig, System.Windows.Forms.IWin32Window, System.String)+0x74
0013EEA4 07B375B8 PDILibReportProcessor!profdata.com.Library.libReportProcessor.ProcessReport(System.String, System.Type, System.Data.DataSet, profdata.com.Library.libOutputSettings, profdata.com.Library.libApplicationConfig, System.Windows.Forms.IWin32Window)+0x18
0013EEB8 07B333C4 APRPTCashRequirements!profdata.com.AccountsPayable.frmAPCashRequirements.RunProcessOrReport()+0x7e4
StackTraceString: <none>
HResult: 80004003
コードは Crystal Report をフォームでユーザーに表示しました。レポートの表示中にアプリケーションが何かをしようとして、System.AccessViolationException を受け取りました。
NativeWindow.Callback ソースを見ると、次のようになります。
private IntPtr Callback(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam)
{
Message m = Message.Create(hWnd, msg, wparam, lparam);
try
{
// calls WndProc or DefWndProc
}
catch (Exception exception)
{
this.OnThreadException(exception);
}
finally {...}
}
例外の原因となったメッセージ、wParam、および lParam 引数を知りたいです。(正しい例外オブジェクトを見ていることも確認したいと思います。)これは、UI スレッドへの呼び出しである可能性があります。または、通常の Windows イベントである可能性があります。
スレッド環境ブロックを取得しました:
0:000> !teb
TEB at 7ffdf000
ExceptionList: 00134144
StackBase: 00140000
StackLimit: 00130000
そしてスタックメモリをダンプしました:
0:000> !dqs 00130000 00140000
...
0013e968 00000000`00000000
0013e970 00000000`00000000
0013e978 00000000`00000000
0013e980 140ea9fc`00000000
0013e988 0013e998`0013ea44
0013e990 140c1d4c`7b6f7916
0013e998 7b6fa39c`0013ea54 <--- is NativeWindow.Callback
0013e9a0 0013ea6c`7b1c8512
0013e9a8 0013ec60`79edd757
0013e9b0 0013ec60`00000000
0013e9b8 0013ea6c`e0434f4d
0013e9c0 00000000`0013ea1c
0013e9c8 00000000`00000000
...
したがって、署名が次の場合: SP IP 0013E9A4 7B1C8512 NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)+0x72
- スタック上のパラメーターは正確にはどこにありますか?
- それらを調べて値を取得するにはどうすればよいですか?
根本的な原因を見つけたような気がしません。ThreadException ハンドラがあります。なぜ呼ばれなかったのですか?何が原因System.AccessViolationException
ですか?
ユーザーが「アプリケーションが例外を生成しました...」というエラー ダイアログで停止したため、!analyze -v
報告されたことに注意してください。STATUS_BREAKPOINT