国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

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

2019-11-17 03:19:04
字體:
供稿:網(wǎng)友
.Net 4.0里面try/catch沒有抓住的exception

像try{…}catch(Exception){…}這樣的代碼,我們知道是抓不住Non CLS Compliant的Exception的。但是就一定能抓住CLS Compliant的Exception嗎?事實發(fā)現(xiàn)從.net 4.0開始未必。

QA報告了一個問題,說點了一個按鈕之后系統(tǒng)彈了一個框說Fatal application Error,提示重啟。QA抓了一下log和dump就重啟繼續(xù)測了。這個問題之前從來沒發(fā)生過,之后也重現(xiàn)不出來,但就發(fā)生了那么一次,而且是很normal的workflow。這種對話框是我們系統(tǒng)處理AppDomain.CurrentDomain.UnhandledException的標準錯誤框,這種問題我們的日志里面會有詳細的Exception的call stack,一般來說應該在某個地方加條件判斷或者try/catch一下,輕松搞定Smile

看了一下日志,全是底層的函數(shù),沒見我們的代碼。

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沒抓住! 為什么?為什么?! Sad smile

只能看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

    <

    發(fā)表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發(fā)表
    主站蜘蛛池模板: 古浪县| 绥德县| 鸡西市| 肥东县| 庆城县| 福建省| 大理市| 邢台市| 台中市| 巨野县| 仁怀市| 嘉黎县| 无极县| 中宁县| 阜新| 徐水县| 闽清县| 呼伦贝尔市| 沧源| 山西省| 白玉县| 阳泉市| 安徽省| 望谟县| 永康市| 抚宁县| 惠州市| 丹巴县| 杂多县| 正蓝旗| 郓城县| 双辽市| 南陵县| 丰原市| 宁明县| 东乌珠穆沁旗| 德化县| 南召县| 临泽县| 鄯善县| 定西市|