runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[Blazor WASM VS 2022 Preview] Breakpoints not being hit in Visual Studio

Open aventus13 opened this issue 5 years ago • 4 comments

Describe the bug

When attempting to debug a basic counter page in Visual Studio 2022 RC3, the breakpoint is not getting hit as no symbols have been loaded message shows.

To Reproduce

  • Using Visual Studio create a new Blazor WebAssembly project without HTTPS and with ASP.Net Core hosted, choosing .Net 6 SDK
  • The solution should be created with three projects: x.Client, x.Server, and x.Shared
  • Open Counter.razor file in the Client project and set a breakpoint on currentCount++ line
  • Start the Server application by hitting F5 and observe the breakpoint
  • The breakpoint will be disabled with message The breakpoint will not currently be hit. No symbols have been loaded for this document.
  • Use the application in the browser- navigate to Counter page and click Click me button
  • The UI will update correctly however the breakpoint will not get hit in Visual Studio

Further technical details

  • .Net 6
  • Visual Studio 2022 Community version 17.0.0 Preview 7.0
  • Tried with and without hot reload enabled
  • Tried with and without HTTPS enabled
  • Server breakpoints are being loaded and hit, for example in the WeatherForecastController
  • In the Modules window, there are modules loaded for x.Shared.dll and x.Server.dll, but there are no modules loaded for x.Client.dll

aventus13 avatar Nov 07 '21 13:11 aventus13

@aventus13 thanks for contacting us.

I'm not able to reproduce this issue. I would recommend checking that you have JS Debugging enabled on your VS settings.

javiercn avatar Nov 08 '21 13:11 javiercn

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost avatar Nov 08 '21 13:11 ghost

Thanks @javiercn. Indeed, I had this setting disabled, however after enabling it, rebuilding the application and running it again the problem still exists. For what it's worth, here is my launch settings content for the project profile:

    "Net6Blaza": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "http://localhost:5135",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }

aventus13 avatar Nov 08 '21 13:11 aventus13

Turned out that I accidentally switched browser to Firefox when launching the app hence why I couldn't hit breakpoints after enabling JS debugging. It was indeed disabled JS debugging that was the root cause of the problem.

aventus13 avatar Nov 08 '21 14:11 aventus13