1

I have a .NETCore 3 Blazor project that I am debugging remotely. There are exceptions being thrown that show up in both the remote debugger Output window and the chrome console. But VS refuses to break on any of these exceptions, no matter what config I change.

I followed the advice in this post:

  • Check "Enable Just My Code" under Tools > Options > Debugging
  • Disable the "Continue when unhandled in user code" flag

Since I have a global exception handler (see the note on the ASP.NET top level exception handler)

  • "To get back the behaviour where VS breaks on unhandled exceptions, I had to tick all of the exception types I wanted to break on and then secondly ensure that the "Additional Options" (you may need to make this column visible*) for "Continue when unhandled in user code" was NOT set" (x)

My config:

enter image description here

enter image description here

Exception printed in output window (an example, other exceptions thrown also do not break):

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)

Exception printed in the chrome console:

enter image description here

I also checked to make sure that System.InvalidOperationException was checked to break when thrown, with no conditions or additional actions:

enter image description here

Breakpoints seem to be working fine during my remote debugging session. I am remote debugging the same version of the code as is running on the remote server, and the server is running code built in the Debug configuration.

WHAT am I doing wrong here?? I am SO confused, I feel like I must be majorly misunderstanding the settings because I can't find a reason why the debugger isn't breaking.

lilibug1
  • 31
  • 5

1 Answers1

1

I had the same issue.

Have you tried to switch off the 'Just my code' option in the debug settings, so you can see if the exception is raised somewhere in the framework?

greg-e
  • 374
  • 4
  • 18