.Net 4.0里面try/catch没有抓住的exception

像try{…}catch(Exception){…}这样的代码,我们知道是抓不住Non CLS Compliant的Exception的。但是就一定能抓住CLS Compliant的Exception吗?事实发现从.net 4.0开始未必。

 

QA报告了一个问题,说点了一个按钮之后系统弹了一个框说Fatal Application Error,提示重启。QA抓了一下log和dump就重启继续测了。这个问题之前从来没发生过,之后也重现不出来,但就发生了那么一次,而且是很normal的workflow。这种对话框是我们系统处理AppDomain.CurrentDomain.UnhandledException的标准错误框,这种问题我们的日志里面会有详细的Exception的call stack,一般来说应该在某个地方加条件判断或者try/catch一下,轻松搞定.Net 4.0里面try/catch没有抓住的exception

 

看了一下日志,全是底层的函数,没见我们的代码。

ExceptionName: System.Runtime.InteropServices.COMException

ExceptionString: System.Runtime.InteropServices.COMException (0x80040064): Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)

InnerException:

MachineName: DR2014227932

StackTrace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC& formatetc, STGMEDIUM& medium)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)

然后又看了一下Button Click代码,类似是这样的

try

{

Clipboard.GetDataObject();

Clipboard.SetDataObject()

}

catch (Exception ex)

{

//log and ignore

}

这个… Exception没抓住! 为什么?为什么?! .Net 4.0里面try/catch没有抓住的exception 

只能看dump了

#看看主线程在干嘛

0:000> !clrstack

OS Thread Id: 0xe7c (0)

Child SP IP Call Site

000000000021d6a8 00000000775a186a [NDirectMethodFrameStandalone: 000000000021d6a8] System.Windows.Forms.UnsafeNativeMethods.OleFlushClipboard()

000000000021d660 000007fef1a7227f System.Windows.Forms.Clipboard.SetDataObject(System.Object, Boolean, Int32, Int32)

000000000021d7a0 000007ff029023f9 TheControls.CCDeliveryStatusDisplayControl.InsertDestinationIcon(CCOutputRow)

000000000021d810 000007ff029020bf TheControls.CCDeliveryStatusDisplayControl.InsertDestinationIcon(CCOutputRow)

000000000021d960 000007ff029013b0 TheControls.CCDeliveryStatusDisplayControl.WriteOutputRows(CCOutputRow[])

000000000021dac0 000007ff02717b5a TheSystem.CCMultiFormatConfiguration2.ShowDeliveryStatusPanel(Boolean)

000000000021db00 000007ff028fc1ea TheSystem.CCMultiFormatConfiguration2.buttonPrint_Click(System.Object, System.EventArgs)

000000000021db50 000007ff01fbab9e TheControls.CCButton.OnClick(System.EventArgs)

…<cut to save space>…

嗯,QA确实是点了一个按钮,然后当前call stack也看不出更多信息。(~* e!clrstack也没啥有用信息)

#看看unmanaged call stack吧

0:000> kb

RetAddr : Args to Child : Call Site

000007fe`fdd11430 : 0074006c`00750061 00650078`0065002e 00000000`00000000 00000000`00000000 : ntdll!NtWaitForMultipleObjects+0xa

00000000`76e92ce3 : 00000000`0021bf80 00000000`0021bf70 00000000`00000000 00000000`00000000 : KERNELBASE!GetCurrentProcess+0x40

00000000`76f09105 : 00000000`055a0000 00000000`0021c1f0 00000000`00000000 00000000`0021d470 : kernel32!WaitForMultipleObjectsExImplementation+0xb3

00000000`76f09287 : 00000000`00000000 01000000`00000080 00000000`00001920 00000000`00000000 : kernel32!WerpReportFaultInternal+0x215

00000000`76f092df : 00000000`0021c1f0 00000000`00000001 00000000`00000000 00000000`000d6910 : kernel32!WerpReportFault+0x77

00000000`76f094fc : 00000000`00000000 00000000`00000001 00000000`00000001 000007fe`ff095d58 : kernel32!BasepReportFault+0x1f

00000000`776368df : 00000000`0021c1f0 000007fe`00000006 00000000`00000000 00000000`00000001 : kernel32!UnhandledExceptionFilter+0x1fc

00000000`775a1163 : 00000000`0021cef0 00000000`0021ca00 00000000`00220000 00000000`775a11f5 : ntdll!RtlNewInstanceSecurityObject+0x11f

00000000`77579d2d : 00000000`00220000 00000000`0021c3a8 00000000`0021c330 000007fe`ff146454 : ntdll!KiUserApcDispatcher+0x93

00000000`775691cf : 00000000`00220000 00000000`772d6388 00000000`00012f00 00000000`000bd960 : ntdll!RtlDecodePointer+0xad

00000000`775a1248 : 00000000`0021cef0 00000000`0021ca00 00000000`00000000 000007fe`00000000 : ntdll!RtlUnwindEx+0xbbf

000007fe`ff095d58 : 00000000`005a37a8 00000000`0021d190 00000000`0021d178 000007fe`f9d55a48 : ntdll!KiUserExceptionDispatcher+0x2e

000007fe`ff09719b : 00000000`005a37a8 00000000`2c7cf190 00000000`0021d270 00000000`0000c004 : ole32!GetDataFromStorage+0x118 [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 915]

000007fe`ff0a940f : 00000000`80004005 00000001`00000001 00000000`00000000 00000000`00000000 : ole32!GetNative+0x8b [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 1288]

000007fe`ff0b5157 : 00000000`000608ac 00000000`00000000 00000000`00000000 00000000`00000001 : ole32!RenderFormat+0x4f [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 3707]

00000000`77259bd1 : 00000000`00000000 00000000`000608ac 00000000`00000000 00000000`76ebe379 : ole32!ClipboardWndProc+0x97 [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 518]

00000000`772572cb : 00000000`00000000 000007fe`ff0b50c0 00000000`00000000 00000000`00000000 : user32!UserCallWinProcCheckWow+0x1ad

00000000`77256829 : 00000000`0021d458 00000000`000d6910 00000000`00000000 00000000`00000000 : user32!DispatchClientMessage+0xc3

00000000`775a11f5 : 00000000`00000000 00000000`0021d4a0 00000000`005a37a8 000007fe`f969694b : user32!_fnDWORD+0x2d

00000000`7725e86a : 00000000`7725e894 00000000`03c13498 00000000`000d6910 00000000`00000000 : ntdll!KiUserCallbackDispatcher+0x1f

00000000`7725e894 : 00000000`03c13498 00000000`000d6910 00000000`00000000 000007fe`f981723e : user32!ZwUserGetClipboardData+0xa

000007fe`ff0b0f10 : 00000000`3d0cc610 00000000`00000000 00000000`00000000 00000000`00000000 : user32!GetClipboardData+0x20

000007fe`f96919c2 : 00000000`0000000a 00000000`0021d610 00000000`00000000 00000000`16c03378 : ole32!OleFlushClipboard+0xe0 [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 2217]

000007fe`f1a7227f : 00000000`0021d6a8 00000000`162d4808 00000000`0021df20 00000000`162fcae8 : clr!DoNDirectCallWorker+0x62

000007ff`029023f9 : 00000000`16c03378 00000000`00000001 00000000`0000000a 00000000`00000064 : System_Windows_Forms_ni+0xa0227f

000007ff`029020bf : 00000000`162fcae8 00000000`16c034d0 00000000`0021d4b0 00000000`00000000 : 0x7ff`029023f9

000007ff`029013b0 : 00000000`162fcae8 00000000`162d4808 00000000`0021d580 00000000`00000008 : 0x7ff`029020bf

000007ff`02717b5a : 00000000`162fcae8 00000000`173d6b90 00000000`162d4808 000007ff`0219b848 : 0x7ff`029013b0

000007ff`028fc1ea : 00000000`16304ff0 00000000`16317bb0 00000000`1005e6fc 00000000`00000000 : 0x7ff`02717b5a

000007ff`01fbab9e : 00000000`162d98d0 00000000`162dbea8 00000000`1669b668 00000000`00000000 : 0x7ff`028fc1ea

000007fe`f19c8700 : 00000000`162dbea8 00000000`1669b668 00000000`775d72ac 00000000`000c0c64 : 0x7ff`01fbab9e

000007fe`f1f6cf5b : 00000000`162dbea8 000007ff`01e8afe1 00000000`12e35bb0 000007ff`01eafc08 : System_Windows_Forms_ni+0x958700

000007fe`f13a0cec : 0000008a`003b4b91 00000000`000003e4 00000000`00000002 00000000`00000000 : System_Windows_Forms_ni+0xefcf5b

000007fe`f1c31b50 : 00000000`162dc250 00000000`00000000 00000000`00000202 00000000`00000000 : System_Windows_Forms_ni+0x330cec

000007fe`f97ff517 : 00000000`00000000 000007fe`f96ad960 00000000`000d6910 00000000`00000000 : System_Windows_Forms_ni+0xbc1b50

00000000`77259bd1 : 00000000`0021e178 00000000`00000000 00000000`00000000 00000000`00000038 : clr!UMThunkStubAMD64+0x77

00000000`772598da : 00000000`0021e4d8 00000000`02633d2c 00000000`0021e4d8 00000000`010385f0 : user32!UserCallWinProcCheckWow+0x1ad

000007fe`f96917c7 : 00000000`100aa560 00000000`000d6910 00000000`02633d2c 00000000`100aa560 : user32!DispatchMessageWorker+0x3b5

000007fe`f13cd880 : 00000000`000c0c01 000007fe`f10a6578 00000000`100aa560 00000000`0021e4d8 : clr!DoNDirectCall__PatchGetThreadCall+0x7b

000007fe`f13bb004 : 00000000`100aa560 00000000`0021e4d8 00000000`000cc6d0 00000000`0021e380 : System_Windows_Forms_ni+0x35d880

000007fe`f13ba813 : 00000000`1342c1c8 00000000`00000001 00000000`ffffffff 00000000`00000000 : System_Windows_Forms_ni+0x34b004

000007fe`f13ba1a1 : 00000000`100aa560 000007fe`ffffffff 00000000`10a5ac18 000007fe`f96ac841 : System_Windows_Forms_ni+0x34a813

000007ff`0018152b : 00000000`10397db0 00000000`10314158 00000000`6d1b9330 00000000`6d1b9330 : System_Windows_Forms_ni+0x34a1a1

000007fe`f96b44c4 : 00000000`0021e9f8 00000000`100354ca 000007ff`0000110a 00000000`00000000 : 0x7ff`0018152b

000007fe`f96b45d9 : 00000000`0021e950 000007fe`f9694db5 ffffffff`fffffffe 00000000`00000000 : clr!CallDescrWorker+0x84

000007fe`f96b4655 : 00000000`0021ea18 00000000`00000000 00000000`0021ea20 00000000`0021ec38 : clr!CallDescrWorkerWithHandler+0xa9

000007fe`f96b4b08 : 00000000`0021ec38 000007ff`0004c050 00000000`0021ed00 000007fe`f969cdcc : clr!MethodDesc::CallDescr+0x2a1

000007fe`f97b49d5 : 00000000`00000000 00000000`0021ef40 00000000`0021ec48 00000000`00000000 : clr!MethodDesc::CallTargetWorker+0x44

000007fe`f98ba018 : 00000000`000d6910 00000000`000d6910 00000000`00000000 00000000`00000000 : clr!ClassLoader::RunMain+0x276

000007fe`f98b9dce : 00000000`0021f440 00000000`00000200 00000000`000ee980 00000000`00000200 : clr!Assembly::ExecuteMainMethod+0xac

000007fe`f98bc18a : 00000000`00000000 00000000`10020000 00000000`00000000 00000000`00000000 : clr!SystemDomain::ExecuteMainMethod+0x452

000007fe`f98bc0a7 : 00000000`10020000 00000000`00000000 00000000`00000000 00000000`00000000 : clr!ExecuteEXE+0x43

000007fe`f9753c51 : 00000000`000d6910 ffffffff`ffffffff 00000000`00000000 00000000`00000000 : clr!CorExeMainInternal+0xc4

000007fe`fa003309 : 00000000`00000000 00000000`00000000 00000000`00000001 00000000`0021f758 : clr!CorExeMain+0x15

000007fe`fa0a5b21 : 000007fe`f9753c3c 000007fe`fa0032c0 00000000`00000000 00000000`00000000 : mscoreei!CorExeMain+0x41

00000000`76e8652d : 000007fe`fa000000 00000000`00000000 00000000`00000000 00000000`00000000 : mscoree!CorExeMain_Exported+0x57

00000000`7757c541 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0xd

00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

#嗯,看看啥exception

(参考HOW TO: Find the Problem Exception Stack When You Receive an UnhandledExceptionFilter Call in the Stack Trace http://support.microsoft.com/kb/313109)

#dump一下exception参数的内存

0:000> dd 0021c1f0

00000000`0021c1f0 0021cef0 00000000 0021ca00 00000000

00000000`0021c200 0021c2d0 00000000 f9812212 000007fe

00000000`0021c210 000d6910 00000000 00000000 00000000

00000000`0021c220 00000000 00000000 f96b44c4 000007fe

00000000`0021c230 170033a8 00000000 fffffffe ffffffff

00000000`0021c240 0021c590 00000000 f981241b 000007fe

00000000`0021c250 775a11f5 00000000 77579b6e 00000000

00000000`0021c260 fffffffe ffffffff 00000000 00000000

#看看第一个参数,是什么exception

0:000> .exr 0021cef0

ExceptionAddress: 000007feff095d58 (ole32!GetDataFromStorage+0x0000000000000118)

ExceptionCode: c0000005 (Access violation)

ExceptionFlags: 00000000

NumberParameters: 2

Parameter[0]: 0000000000000000

Parameter[1]: 0000000000000000

Attempt to read from address 0000000000000000

#看看第二个参数, 堆栈是啥

0:000> .cxr 0021ca00

rax=ffffffff80040064 rbx=0000000080040064 rcx=0000000000000000

rdx=000000000021cd18 rsi=0000000000000000 rdi=000000002c7cf190

rip=000007feff095d58 rsp=000000000021d130 rbp=000000000021d270

r8=000000000021cce0 r9=000007fef9d55a48 r10=000000000021a6f0

r11=0000000000000000 r12=00000000005a37a8 r13=000000000021d200

r14=0000000000000000 r15=00000000000608ac

iopl=0 nv up ei ng nz na pe nc

cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010282

ole32!GetDataFromStorage+0x118:

000007fe`ff095d58 488b01 mov rax,qword ptr [rcx] ds:00000000`00000000=????????????????

0:000> kv

*** Stack trace for last set context - .thread/.cxr resets it

Child-SP RetAddr : Args to Child : Call Site

00000000`0021d130 000007fe`ff09719b : 00000000`005a37a8 00000000`2c7cf190 00000000`0021d270 00000000`0000c004 : ole32!GetDataFromStorage+0x118 [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 915]

00000000`0021d1d0 000007fe`ff0a940f : 00000000`80004005 00000001`00000001 00000000`00000000 00000000`00000000 : ole32!GetNative+0x8b [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 1288]

00000000`0021d250 000007fe`ff0b5157 : 00000000`000608ac 00000000`00000000 00000000`00000000 00000000`00000001 : ole32!RenderFormat+0x4f [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 3707]

00000000`0021d2c0 00000000`77259bd1 : 00000000`00000000 00000000`000608ac 00000000`00000000 00000000`76ebe379 : ole32!ClipboardWndProc+0x97 [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 518]

00000000`0021d2f0 00000000`772572cb : 00000000`00000000 000007fe`ff0b50c0 00000000`00000000 00000000`00000000 : user32!UserCallWinProcCheckWow+0x1ad

00000000`0021d3b0 00000000`77256829 : 00000000`0021d458 00000000`000d6910 00000000`00000000 00000000`00000000 : user32!DispatchClientMessage+0xc3

00000000`0021d410 00000000`775a11f5 : 00000000`00000000 00000000`0021d4a0 00000000`005a37a8 000007fe`f969694b : user32!_fnDWORD+0x2d

00000000`0021d470 00000000`7725e86a : 00000000`7725e894 00000000`03c13498 00000000`000d6910 00000000`00000000 : ntdll!KiUserCallbackDispatcher+0x1f (TrapFrame @ 00000000`0021d338)

00000000`0021d4f8 00000000`7725e894 : 00000000`03c13498 00000000`000d6910 00000000`00000000 000007fe`f981723e : user32!ZwUserGetClipboardData+0xa

00000000`0021d500 000007fe`ff0b0f10 : 00000000`3d0cc610 00000000`00000000 00000000`00000000 00000000`00000000 : user32!GetClipboardData+0x20

00000000`0021d590 000007fe`f96919c2 : 00000000`0000000a 00000000`0021d610 00000000`00000000 00000000`16c03378 : ole32!OleFlushClipboard+0xe0 [d:\w7rtm\com\ole32\ole232\clipbrd\clipapi.cpp @ 2217]

00000000`0021d5d0 000007fe`f1a7227f : 00000000`0021d6a8 00000000`162d4808 00000000`0021df20 00000000`162fcae8 : clr!DoNDirectCallWorker+0x62

00000000`0021d660 000007ff`029023f9 : 00000000`16c03378 00000000`00000001 00000000`0000000a 00000000`00000064 : System_Windows_Forms_ni+0xa0227f

00000000`0021d7a0 000007ff`029020bf : 00000000`162fcae8 00000000`16c034d0 00000000`0021d4b0 00000000`00000000 : 0x7ff`029023f9

00000000`0021d810 000007ff`029013b0 : 00000000`162fcae8 00000000`162d4808 00000000`0021d580 00000000`00000008 : 0x7ff`029020bf

00000000`0021d960 000007ff`02717b5a : 00000000`162fcae8 00000000`173d6b90 00000000`162d4808 000007ff`0219b848 : 0x7ff`029013b0

00000000`0021dac0 000007ff`028fc1ea : 00000000`16304ff0 00000000`16317bb0 00000000`1005e6fc 00000000`00000000 : 0x7ff`02717b5a

00000000`0021db00 000007ff`01fbab9e : 00000000`162d98d0 00000000`162dbea8 00000000`1669b668 00000000`00000000 : 0x7ff`028fc1ea

00000000`0021db50 000007fe`f19c8700 : 00000000`162dbea8 00000000`1669b668 00000000`775d72ac 00000000`000c0c64 : 0x7ff`01fbab9e

00000000`0021dbb0 000007fe`f1f6cf5b : 00000000`162dbea8 000007ff`01e8afe1 00000000`12e35bb0 000007ff`01eafc08 : System_Windows_Forms_ni+0x958700

00000000`0021dcf0 000007fe`f13a0cec : 0000008a`003b4b91 00000000`000003e4 00000000`00000002 00000000`00000000 : System_Windows_Forms_ni+0xefcf5b

00000000`0021dea0 000007fe`f1c31b50 : 00000000`162dc250 00000000`00000000 00000000`00000202 00000000`00000000 : System_Windows_Forms_ni+0x330cec

00000000`0021df70 000007fe`f97ff517 : 00000000`00000000 000007fe`f96ad960 00000000`000d6910 00000000`00000000 : System_Windows_Forms_ni+0xbc1b50

00000000`0021e000 00000000`77259bd1 : 00000000`0021e178 00000000`00000000 00000000`00000000 00000000`00000038 : clr!UMThunkStubAMD64+0x77

00000000`0021e090 00000000`772598da : 00000000`0021e4d8 00000000`02633d2c 00000000`0021e4d8 00000000`010385f0 : user32!UserCallWinProcCheckWow+0x1ad

00000000`0021e150 000007fe`f96917c7 : 00000000`100aa560 00000000`000d6910 00000000`02633d2c 00000000`100aa560 : user32!DispatchMessageWorker+0x3b5

00000000`0021e1d0 000007fe`f13cd880 : 00000000`000c0c01 000007fe`f10a6578 00000000`100aa560 00000000`0021e4d8 : clr!DoNDirectCall__PatchGetThreadCall+0x7b

00000000`0021e270 000007fe`f13bb004 : 00000000`100aa560 00000000`0021e4d8 00000000`000cc6d0 00000000`0021e380 : System_Windows_Forms_ni+0x35d880

00000000`0021e340 000007fe`f13ba813 : 00000000`1342c1c8 00000000`00000001 00000000`ffffffff 00000000`00000000 : System_Windows_Forms_ni+0x34b004

00000000`0021e580 000007fe`f13ba1a1 : 00000000`100aa560 000007fe`ffffffff 00000000`10a5ac18 000007fe`f96ac841 : System_Windows_Forms_ni+0x34a813

00000000`0021e6e0 000007ff`0018152b : 00000000`10397db0 00000000`10314158 00000000`6d1b9330 00000000`6d1b9330 : System_Windows_Forms_ni+0x34a1a1

00000000`0021e770 000007fe`f96b44c4 : 00000000`0021e9f8 00000000`100354ca 000007ff`0000110a 00000000`00000000 : 0x7ff`0018152b

00000000`0021e8c0 000007fe`f96b45d9 : 00000000`0021e950 000007fe`f9694db5 ffffffff`fffffffe 00000000`00000000 : clr!CallDescrWorker+0x84

00000000`0021e900 000007fe`f96b4655 : 00000000`0021ea18 00000000`00000000 00000000`0021ea20 00000000`0021ec38 : clr!CallDescrWorkerWithHandler+0xa9

00000000`0021e980 000007fe`f96b4b08 : 00000000`0021ec38 000007ff`0004c050 00000000`0021ed00 000007fe`f969cdcc : clr!MethodDesc::CallDescr+0x2a1

00000000`0021ebb0 000007fe`f97b49d5 : 00000000`00000000 00000000`0021ef40 00000000`0021ec48 00000000`00000000 : clr!MethodDesc::CallTargetWorker+0x44

00000000`0021ebf0 000007fe`f98ba018 : 00000000`000d6910 00000000`000d6910 00000000`00000000 00000000`00000000 : clr!ClassLoader::RunMain+0x276

00000000`0021ee40 000007fe`f98b9dce : 00000000`0021f440 00000000`00000200 00000000`000ee980 00000000`00000200 : clr!Assembly::ExecuteMainMethod+0xac

00000000`0021f0f0 000007fe`f98bc18a : 00000000`00000000 00000000`10020000 00000000`00000000 00000000`00000000 : clr!SystemDomain::ExecuteMainMethod+0x452

00000000`0021f6a0 000007fe`f98bc0a7 : 00000000`10020000 00000000`00000000 00000000`00000000 00000000`00000000 : clr!ExecuteEXE+0x43

00000000`0021f700 000007fe`f9753c51 : 00000000`000d6910 ffffffff`ffffffff 00000000`00000000 00000000`00000000 : clr!CorExeMainInternal+0xc4

00000000`0021f770 000007fe`fa003309 : 00000000`00000000 00000000`00000000 00000000`00000001 00000000`0021f758 : clr!CorExeMain+0x15

00000000`0021f7b0 000007fe`fa0a5b21 : 000007fe`f9753c3c 000007fe`fa0032c0 00000000`00000000 00000000`00000000 : mscoreei!CorExeMain+0x41

00000000`0021f7e0 00000000`76e8652d : 000007fe`fa000000 00000000`00000000 00000000`00000000 00000000`00000000 : mscoree!CorExeMain_Exported+0x57

00000000`0021f810 00000000`7757c541 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0xd

00000000`0021f840 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

接下来只能去拷问google了…

功夫不负有心了,终于找到相关的文章,原来.net4.0里面加了Corrupted State Exceptions这个东东,具体描述及解决方案可以参考下面的链接。

“In .NET 4.0, the runtime handles certain exceptions raised as Windows Structured Error Handling (SEH) errors as indicators of Corrupted State. These Corrupted State Exceptions (CSE) are not allowed to be caught by your standard managed code. I won‘t get into the why‘s or how‘s here. Read this article about CSE‘s in the .NET 4.0 Framework:”

Handling Corrupted State Exceptions http://msdn.microsoft.com/en-us/magazine/dd419661.aspx#id0070035

另外,强烈推荐Windows Structured Error Handling必读的经典作(A Crash Course on the Depths of Win32? Structured Exception Handling  http://www.microsoft.com/msj/0197/exception/exception.aspx)

.Net 4.0里面try/catch没有抓住的exception,布布扣,bubuko.com

.Net 4.0里面try/catch没有抓住的exception

上一篇:概率论考点总结类型28 正态总体下均值与方差的分布


下一篇:uView的安装和使用