如何确定windbg输出的崩溃原因?

时间:2013-10-03 14:14:05

标签: .net exception clr windbg

我正在尝试找出应用程序在特定计算机上崩溃的原因。

当应用程序崩溃时,它表示故障模块为kernel32.dll

请参阅windbg下面的输出。它似乎在调用MyClass.Start时崩溃。

如何更详细地找出崩溃的实际原因?

ModLoad: 69840000 69a05000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web.Services\b66225f7bf51912a34f21181b36f800f\System.Web.Services.ni.dll
ModLoad: 68180000 68cdc000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web\88803928914c8cc4b21ca1ad19f3d40f\System.Web.ni.dll
ModLoad: 6e0c0000 6e0d0000   Microsoft.ReportViewer.ProcessingObjectModel.dll
ModLoad: 10840000 10850000   Microsoft.ReportViewer.ProcessingObjectModel.dll
ModLoad: 6e0c0000 6e0d0000   C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.ProcessingObjectModel.dll
ModLoad: 10890000 109af000   vbc.exe 
ModLoad: 6e500000 6e646000   C:\Windows\SysWOW64\browseui.dll
ModLoad: 6ed70000 6eda0000   C:\Windows\SysWOW64\DUser.dll
ModLoad: 6e010000 6e020000   MyDll.dll
ModLoad: 101e0000 101f0000   MyDll.dll
ModLoad: 6e010000 6e020000   C:\Program Files (x86)\AppName\MyDll.dll
ModLoad: 69690000 69835000   C:\Windows\assembly\NativeImages_v2.0.50727_32\Microsoft.VisualBas#\268869655c671d09c3af0f81165da32e\Microsoft.VisualBasic.ni.dll
03/10/2013 21:49:50: MyClass.Start: started
(1b48.1b84): CLR exception - code e0434f4d (first chance)
(1b48.1b84): CLR exception - code e0434f4d (first chance)
(1b48.1b84): CLR exception - code e0434f4d (first chance)
(1b48.1b84): CLR exception - code e0434f4d (first chance)
(1b48.1b84): CLR exception - code e0434f4d (first chance)
(1b48.1b84): CLR exception - code e0434f4d (first chance)
(1b48.1b84): CLR exception - code e0434f4d (!!! second chance !!!)
eax=109cf4c0 ebx=e0434f4d ecx=00000001 edx=00000000 esi=109cf548 edi=19033980
eip=7575d8cb esp=109cf4c0 ebp=109cf510 iopl=0         nv up ei pl nz ac pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000216
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\syswow64\kernel32.dll - 
kernel32!RaiseException+0x59:
7575d8cb c9              leave
0:027> g
WARNING: Continuing a non-continuable exception
(1b48.1b84): Break instruction exception - code 80000003 (first chance)
eax=00000001 ebx=00000000 ecx=00000000 edx=109cf4ec esi=00000000 edi=746a4bd4
eip=77ba0004 esp=109cf04c ebp=109cf4f8 iopl=0         nv up ei pl nz na po nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202
ntdll!DbgBreakPoint:
77ba0004 cc              int     3
0:027>

以下是!printexception的输出:

Exception object: 0934bc08
Exception type: System.InvalidOperationException
Message: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
InnerException: <none>
StackTrace (generated):
    SP       IP       Function
    10DCF63C 715FE2AF System_Windows_Forms_ni!System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)+0x85997f
    10DCF6DC 70DA4830 System_Windows_Forms_ni!System.Windows.Forms.Control.BeginInvoke(System.Delegate, System.Object[])+0x50
    10DCF710 10BC8E2D Microsoft_ReportViewer_WinForms!Microsoft.Reporting.WinForms.ReportViewer.OnRenderingComplete(Microsoft.Reporting.WinForms.ProcessThreadResult, Microsoft.Reporting.WinForms.PostRenderArgs)+0x5d
    10DCF72C 10BC8DB9 Microsoft_ReportViewer_WinForms!Microsoft.Reporting.WinForms.ProcessThreadArg.OnComplete(Microsoft.Reporting.WinForms.ProcessThreadResult)+0x11
    10DCF734 10BC4EB3 Microsoft_ReportViewer_WinForms!Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(System.Object)+0x38b
    10DCF790 739838E2 mscorlib_ni!System.Threading.ThreadHelper.ThreadStart_Context(System.Object)+0x72c8b2
    10DCF79C 7326051F mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x6f
    10DCF7B4 7375D43A mscorlib_ni!System.Threading.ThreadHelper.ThreadStart(System.Object)+0x4a

StackTraceString: <none>
HResult: 80131509

2 个答案:

答案 0 :(得分:2)

Kernel32.dll是引发CLR异常的地方(这是在CLR应用程序中任何异常时引发到外部非托管世界的异常),这就是运行时看到它的原因作为问题的原因,但当然不是。

如果您可以在目标计算机上运行Windbg并附加到使用此dll的进程,那么有一篇相当出色的文章here,它说明了如何在异常中断并查看异常的实际堆栈跟踪+打印出它的一些细节,这应该有助于确定托管代码中掉落的部分。

答案 1 :(得分:1)

输出在线程1b48.1b84上显示托管异常。来自SOS / PSSCOR的!threads命令也显示了每个线程的异常。

输出还表明您当前正处于失败的线程,因此!printexception(也来自SOS / PSSCOR)将在该线程上为您提供托管异常。