繁体   English   中英

Visual Studio 2019 远程调试器不会因异常而中断

[英]Visual Studio 2019 Remote Debugger not Breaking on Exceptions

我有一个远程调试的 .NETCore 3 Blazor 项目。 远程调试器 Output window 和 chrome 控制台中都会出现异常。 但是无论我更改什么配置,VS 都拒绝中断任何这些异常。

我遵循了这篇文章中的建议:

  • 选中“工具”>“选项”>“调试”下的“仅启用我的代码”
  • 禁用“在用户代码中未处理时继续”标志

由于我有一个全局异常处理程序(请参阅 ASP.NET 顶级异常处理程序上的注释

  • “要恢复 VS 在未处理的异常上中断的行为,我必须勾选我想要中断的所有异常类型,然后确保“附加选项”(您可能需要使此列可见*)为“在用户代码中未处理时继续“未设置”( x

我的配置:

在此处输入图像描述

在此处输入图像描述

在 output window 中打印的异常(示例,抛出的其他异常也不会中断):

System.InvalidOperationException: This instance has already started one or more requests. Properties can only be modified before sending the first request.
   at System.Net.Http.HttpClient.CheckDisposedOrStarted()
   at System.Net.Http.HttpClient.set_Timeout(TimeSpan value)
   at [...].Web.Client.Pages.DiagnosticsBase.CreateMIO() in C:\[...]\Diagnostics.razor.cs:line 94
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)

在 chrome 控制台中打印的异常:

在此处输入图像描述

我还检查以确保System.InvalidOperationException在抛出时被检查为中断,没有条件或其他操作:

在此处输入图像描述

在我的远程调试 session 期间,断点似乎工作正常。 我正在远程调试与远程服务器上运行的相同版本的代码,并且服务器正在运行在调试配置中构建的代码。

我在这里做错了什么? 我很困惑,我觉得我一定是误解了设置,因为我找不到调试器没有中断的原因。

我遇到过同样的问题。

您是否尝试过在调试设置中关闭“仅我的代码”选项,以便查看是否在框架中的某处引发了异常?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM