为什么有时会忽略 try catch?

-5 c# exception visual-studio visual-studio-debugging

一个例子是这个代码:

try
{
    string domain = o.SelectToken("response[" + i + "].domain").ToString();
    ...
}
catch(Exception)
{
    continue;
}
Run Code Online (Sandbox Code Playgroud)

vs 停止并指向string domain = o.SelectToken("response[" + i + "].domain").ToString();for an ,而不是在循环中继续(“继续”)System.IndexOutOfRangeException

这是为什么?

Pad*_*ddy 6

您可能在 Debug>Windows>Exception 设置中选择了“中断所有异常”:

https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019

取消选择这将让 VS 继续。