久久久久久久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 本身!

有什么想法嗎?

推薦答案

對于到此結束的任何人,我都找到了一個可行的實例(如果只能在調試器中檢測到的話).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);
}

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

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

相關文檔推薦

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 的方法調用)
主站蜘蛛池模板: 亚洲人a| 久久精品成人 | 亚洲国产成人精品女人久久久 | 色就干| 日韩欧美不卡 | 成人免费福利视频 | 久久久久久久91 | 精品亚洲一区二区三区四区五区 | 成人在线免费观看视频 | 台湾佬久久 | 激情欧美一区二区三区 | 99久久精品国产麻豆演员表 | 99中文字幕| 黄色网址在线播放 | 久久国产综合 | 亚洲精品一区二区三区四区高清 | 一二三四在线视频观看社区 | 天天综合国产 | 国产精品久久久久永久免费观看 | 中文字幕日韩欧美一区二区三区 | 中文字幕 国产 | 91免费入口 | 四虎影院在线免费观看 | 国产一区二区三区四区 | a级毛片免费高清视频 | 在线观看中文字幕 | 黄色av网站在线观看 | 欧美一区二区在线播放 | 日韩欧美国产一区二区三区 | 91中文在线观看 | 中文字幕在线一区 | 99免费精品视频 | 亚洲欧美aⅴ | 成人在线国产 | 成人国产在线观看 | 综合网视频| 中文字幕乱码亚洲精品一区 | 欧美日韩在线观看视频网站 | 欧美乱人伦视频 | 欧美一级淫片007 | 国产成人麻豆免费观看 |