Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor WebAssembly custom debugger configuration #96239

Closed
1 task done
Bradtus opened this issue Dec 21, 2023 · 4 comments · Fixed by #97213
Closed
1 task done

Blazor WebAssembly custom debugger configuration #96239

Bradtus opened this issue Dec 21, 2023 · 4 comments · Fixed by #97213
Assignees
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Milestone

Comments

@Bradtus
Copy link

Bradtus commented Dec 21, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Since upgrading Visual Studio to 17.8 custom debug configurations for Blazor WASM can't debug anymore by default. The default Debug profile works fine though. It also works as expected for ASP.Net Core Web App Razor.
Only for Blazor WASM in the output i get the message "DEBUGGING IS NOT ENABLED" and breakpoints are unbound.
When adding <DebuggerSupport Condition="'$(Configuration)' == 'DebugCustom'">true</DebuggerSupport> it works again.

Expected Behavior

Debugging should be enabled by default on debugging profiles.

Steps To Reproduce

  • Fresh install Visual Studio
  • Create a new Blazor WASM project
  • Create a new DebugCustom profile based on the default Debug profile
  • Debug in Chromium using the DebugCustom profile

Exceptions (if any)

When pressing shift+alt+d => Cannot start debugging, because the application was not compiled with debugging enabled.

.NET Version

.net7.0 and .net8.0

Anything else?

cc: @guardrex dotnet/AspNetCore.Docs#31281

@guardrex
Copy link

guardrex commented Dec 21, 2023

Thanks @Bradtus.

@javiercn ... I thought DebuggerSupport was enabled by default for non-Release builds (or perhaps specificually for Debug builds). We only ever had one remark on it that you could enable it manually for a Release build if testing locally to enable debugging for a production build. We just lost that remark when we dropped coverage for hosted WASM. It occurs to me now that we probably should've had that for all Blazor apps (Server, WASM, hosted WASM) of <8.0. Anyway, we currently have no coverage on it for >=8.0. Therefore as part of addressing this issue, I'm 👂 to find out what you'd like to cover.

UPDATE: It was even more specific than I recalled ... the coverage was only for VSC debugging of hosted WASM (IIRC with Safia's help) ...

https://learn.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-7.0&tabs=visual-studio-code#debug-a-hosted-blazor-webassembly-app-in-an-ide

In any case, I'm 👂 for whatever you want to cover and will try to address it soon, but note that I'm still ⛰️⛏️😩 on many 8.0 doc issues. I'll get to it as soon as I can.

@javiercn javiercn transferred this issue from dotnet/aspnetcore Dec 21, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 21, 2023
@ghost
Copy link

ghost commented Dec 21, 2023

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Since upgrading Visual Studio to 17.8 custom debug configurations for Blazor WASM can't debug anymore by default. The default Debug profile works fine though. It also works as expected for ASP.Net Core Web App Razor.
Only for Blazor WASM in the output i get the message "DEBUGGING IS NOT ENABLED" and breakpoints are unbound.
When adding <DebuggerSupport Condition="'$(Configuration)' == 'DebugCustom'">true</DebuggerSupport> it works again.

Expected Behavior

Debugging should be enabled by default on debugging profiles.

Steps To Reproduce

  • Fresh install Visual Studio
  • Create a new Blazor WASM project
  • Create a new DebugCustom profile based on the default Debug profile
  • Debug in Chromium using the DebugCustom profile

Exceptions (if any)

When pressing shift+alt+d => Cannot start debugging, because the application was not compiled with debugging enabled.

.NET Version

.net7.0 and .net8.0

Anything else?

cc: @guardrex dotnet/AspNetCore.Docs#31281

Author: Bradtus
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@radical radical added the arch-wasm WebAssembly architecture label Jan 2, 2024
@ghost
Copy link

ghost commented Jan 2, 2024

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Since upgrading Visual Studio to 17.8 custom debug configurations for Blazor WASM can't debug anymore by default. The default Debug profile works fine though. It also works as expected for ASP.Net Core Web App Razor.
Only for Blazor WASM in the output i get the message "DEBUGGING IS NOT ENABLED" and breakpoints are unbound.
When adding <DebuggerSupport Condition="'$(Configuration)' == 'DebugCustom'">true</DebuggerSupport> it works again.

Expected Behavior

Debugging should be enabled by default on debugging profiles.

Steps To Reproduce

  • Fresh install Visual Studio
  • Create a new Blazor WASM project
  • Create a new DebugCustom profile based on the default Debug profile
  • Debug in Chromium using the DebugCustom profile

Exceptions (if any)

When pressing shift+alt+d => Cannot start debugging, because the application was not compiled with debugging enabled.

.NET Version

.net7.0 and .net8.0

Anything else?

cc: @guardrex dotnet/AspNetCore.Docs#31281

Author: Bradtus
Assignees: -
Labels:

arch-wasm, untriaged, area-Debugger-mono

Milestone: -

@maraf maraf added this to the 8.0.x milestone Jan 12, 2024
@maraf maraf added area-Build-mono os-browser Browser variant of arch-wasm and removed untriaged New issue has not been triaged by the area owner area-Debugger-mono labels Jan 12, 2024
@maraf
Copy link
Member

maraf commented Jan 12, 2024

Before .NET 8, Blazor for setting DebuggerSupport=false for all non-Debug configurations, but was starting the runtime in the browser with debugging enabled for all builds (regardless of configuration). In .NET 8 we have unified the behavior: if DebuggerSupport=false the runtime starts without debugging; if DebuggerSupport=true runtime starts with debugging.

I'm not sure yet if the DebuggerSupport=false & debugging enabled makes debugger work properly in all situations


More notes

.NET 7

  • debugBuild = 1 for build; 0 for publish
  • hasDebuggingEnabled: hasReferencedPdbs || debugBuild
  • debugLevel: hasDebuggingEnabled() ? 1 : 0
  • DebuggerSupport: false for config!=Debug
  • Summary
    • DebuggerSupport didn't affected wasm debugging, just instrumented linker
    • Debugging always fully (1, not -1) enabled for all builds, no way to turn it off
    • Debugging disabled for publish, but could be enabled with CopyOutputSymbolsToPublishDirectory=true (and DebuggerSupport=true just to instrument linker)

.NET 8+

  • debugLevel = -1 for Configuration==Debug or DebuggerSupport==true; 0 otherwise
  • hasDebuggingEnabled: hasReferencedPdbs || debugLevel != 0
  • debugLevel: hasDebuggingEnabled() ? debugLevel : 0

Solution

  • Enable debugging when DebuggerSupport==true
  • Enable debugging for all builds until WasmDebugLevel==0 set by user
  • Disable debugging for publish until CopyOutputSymbolsToPublishDirectory=true or WasmDebugLevel!=0 set by user
  • On runtime debugLevel = (debugLevel != 0 || hasPdbs) && supportedBrowser ? 1 : 0 ??

TODO

  • Check publish with DebuggerSupport=true in .NET 7 SDK => No pdbs and debugBuild=0

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jan 19, 2024
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
@maraf maraf changed the title Blazor WASM Custom debug configs need <DebuggerSupport Condition="''$(Configuration)' == 'DebugCustom'">true</DebuggerSupport> Blazor WebAssembly custom debugger configuration Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants