問題描述
以下代碼捕獲 EOS 異常
The following bit of code catches the EOS Exception
using (var reader = new BinaryReader(httpRequestBodyStream)) {
try {
while (true) {
bodyByteList.Add(reader.ReadByte());
}
} catch (EndOfStreamException) { }
}
那么為什么我仍然會在我的控制臺中收到第一次機會異常?
So why do I still receive first-chance exceptions in my console?
在 mscorlib.dll 中發生了System.IO.EndOfStreamException"類型的第一次機會異常
A first chance exception of type 'System.IO.EndOfStreamException' occurred in mscorlib.dll
有沒有辦法隱藏這些首次機會異常消息?
Is there a way to hide these first chance exception messages?
推薦答案
第一次機會"異常的關鍵在于您正在看到它們的預處理程序,以便您可以在調試期間在拋出點停止它們.第二次機會"異常是沒有適當處理程序的異常.有時您想捕獲第一次機會"異常,因為重要的是要查看拋出異常時發生的情況,即使有人正在捕獲它.
The point of "first-chance" exceptions is that you're seeing them pre-handler so that you can stop on them during debugging at the point of throwing. A "second-chance" exception is one that has no appropriate handler. Sometimes you want to catch "first-chance" exceptions because it's important to see what's happening when it's being thrown, even if someone is catching it.
沒什么好擔心的.這是正常行為.
There's nothing to be concerned with. This is normal behavior.
這篇關于在安全處理異常時避免首次機會異常消息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!