久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

捕獲的異常本身為空!

Caught exception is null itself !(捕獲的異常本身為空!)
本文介紹了捕獲的異常本身為空!的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 ASP.NET 應用程序.一切都很好,但最近我得到了一些本身為空的異常:

I have an ASP.NET applications. Everything was fine, but recently I get exceptions that are null themselves:

try
{
    // do something
}
catch (Exception ex)
{
    Logger.Log("Error while tried to do something. Error: " + ex.Message);
}

有時 exnull 本身!

有什么想法嗎?

推薦答案

對于到此結(jié)束的任何人,我都找到了一個可行的實例(如果只能在調(diào)試器中檢測到的話).VS2013 更新 4.

For anyone ending up here, I've found an instance where this is possible (If only detectable in the debugger). VS2013 Update 4.

try
{
    // do something
}
catch (WebException ex) // <- both variables are named 'ex'
{
    Logger.Log("Error while tried to do something. Error: " + ex.Message);
}
catch (Exception ex) // <- this 'ex' is null
{
    Logger.Log("Error while tried to do something. Error: " + ex.Message);
}

解決方案是以不同的方式命名您的異常變量.

The solution is to name your exception variables differently.

try
{
    // do something
}
catch (WebException webEx) // <- all good in the hood
{
    Logger.Log("Error while tried to do something. Error: " + webEx.Message); // <-
}
catch (Exception ex) // <- this 'ex' correctly contains the exception
{
    Logger.Log("Error while tried to do something. Error: " + ex.Message);
}

這篇關(guān)于捕獲的異常本身為空!的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Why shouldn#39;t I always use nullable types in C#(為什么我不應該總是在 C# 中使用可空類型)
C# HasValue vs !=null(C# HasValue vs !=null)
C# ADO.NET: nulls and DbNull -- is there more efficient syntax?(C# ADO.NET:空值和 DbNull —— 有沒有更高效的語法?)
How to set null value to int in c#?(如何在c#中將空值設置為int?)
How to handle nulls in LINQ when using Min or Max?(使用 Min 或 Max 時如何處理 LINQ 中的空值?)
Method call if not null in C#(在 C# 中如果不為 null 的方法調(diào)用)
主站蜘蛛池模板: 成人午夜 | 久久99精品久久久久久 | 午夜久久久 | 亚洲欧美综合网 | 成年人免费看片 | 欧美在线免费观看 | 亚洲欧美精品在线 | a毛片视频 | 黄色小视频在线免费观看 | 成人小网站 | 国产最新视频 | 日韩国产精品视频 | 日日夜夜天天干 | 一区二区三区视频在线播放 | 中文字幕视频在线 | av免费观看网站 | 成人激情视频网 | 中文字幕精品在线观看 | 中文字幕在线观看第一页 | 免费网站观看www在线观 | 国产h视频在线观看 | 亚洲黄色精品 | 97在线免费视频 | 免费视频久久久 | 国产欧美日韩综合精品 | 国产精品视频免费在线观看 | 在线免费观看日韩av | 天天看片天天爽 | 黄色精品视频 | 中文在线观看免费高清 | 国产精品乱 | 四虎久久| 国产理论视频 | 色网站在线观看 | 日韩午夜在线 | 黄色1级视频 | 日日爱影视| 亚洲欧美天堂 | 欧美专区在线观看 | 激情视频小说 | 久久久久久久久久久久久久 |