Aspnetcore: Blazor - Configuration Must Be Provided to Debug

Created on 31 Jul 2019  路  9Comments  路  Source: dotnet/aspnetcore

Describe the bug

dotnet run documentation states that it will default the configuration to Debug but requires configuration flag to be passed to debug Blazor, e.g., dotnet run -c Debug. I have not tested other dotnet projects, so it could be applicable to all of dotnet core.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core '3.0.100-preview7-012821'
  2. Run these commands

    • dotnet new blazor

    • dotnet run

  3. Open Chrome
  4. Load app at http://localhost:5000
  5. Press SHIFT+ALT+D with focus on the application
  6. Inspect > Console tab.
  7. See error Cannot start debugging, because the application was not compiled with debugging enabled

Expected behavior

  • The debugging tab should open, or in the case remote-debugging is not enabled, a tab should open with instructions on running Chrome with remote-debugging enabled (shows the "%programfiles(x86)%\Google\Chrome\Application\chrome.exe" 鈥搑emote-debugging-port=9222 http://localhost:5000/ command).

Screenshots

Error:

Error Message

Tabs:
Tab

Additional context

Reported here based on suggestion from https://github.com/aspnet/AspNetCore.Docs/issues/13548

Track with https://github.com/aspnet/AspNetCore.Docs/pull/13594 for documentation updates based on decision from engineering

Done area-blazor blazor-wasm bug

All 9 comments

Commenting here so that I get an explicit ping from GH to revert the doc update when this is resolved.

Thanks for contacting us, @djbreen7.
We are unable to reproduce this behavior with the given set of steps. Please provide any additional information which may help reproduce this.

I was just able to repro it here again. For an unmodified template-based client-side Blazor app (dotnet new blazor) and running it in Chrome ...

dotnet run – Debugging doesn't fire up with Shift+Alt+D. The error is produced and the Chrome 'how to enable debugging' tab doesn't open.
dotnet run --configuration Debug (or -c Debug) – Works. No error message. The 'how to debug' tab opens in Chrome.

Chrome latest: Version 76.0.3809.87 (Official Build) (64-bit)
... and Pre7 SDK

Sure thing, @mkArtakMSFT !

  1. Add chrome.exe to path:
    image

  2. Download and install the dotnet-sdk-3.0.100-preview7-windows-x64-installer link

  3. Verify version:
    dotnet --version
    image
  4. Install Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview7.19365.7:
    dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview7.19365.7
  5. Create a new Blazor (client-side) application:
    dotnet new blazor --name=MyBlazorApp
  6. cd into MyBlazorApp
    cd MyBlazorApp
  7. Run the application with no flags:
    dotnet run
  8. Open Chrome with remote debugging enabled
    chrome.exe --remote-debugging-port=9222 http://localhost:5000/
    image

  9. Open Dev Tools and select Console

  10. Refocus on the application by clicking somewhere in the web content (the negative space below the "How is Blazor working for you?" text is perfect)
  11. Press SHIFT+ALT+D to start debugging

At this point, the error should be visible in the console:
image

  • Note that dotnet run implicitly builds in Debug mode. This can be confirmed by the presence of a /bin/Debug folder after running dotnet run
    image

  • Note that it works fine if the -c Debug | --configuration Debug is explicitly
    image

Thanks @djbreen7.
We'll tackle this after we're done with the upcoming 3.0 release.

Need instructions for Edge. Using:
"%programfiles(x86)%\Microsoft\Edge Beta\Application\msedge.exe" --remote-debugging-port=9222 http://localhost:2847/

instead of
"%programfiles(x86)%\Google\Chrome\Applicationchrome.exe" --remote-debugging-port=9222 http://localhost:2847/

doesn't. Edge still shows
"Could not get a list of browser tabs from http://localhost:9222/json. Ensure Chrome is running with debugging enabled."
Edge Version 78.0.276.11 (Official build) beta (64-bit)

I have also reproduced this, it seems like the Debug configuration is not being applied as the environment is still Production.

Is there any updates here?

FYI @eByte23 in case you don't get a quick answer. Many/most are OOF for the holidays 鉀勶笍. It might take a few weeks to get a response.

This should be fixed in the 3.2-preview1 release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

githubgitgit picture githubgitgit  路  3Comments

ipinak picture ipinak  路  3Comments

guardrex picture guardrex  路  3Comments

UweKeim picture UweKeim  路  3Comments

ermithun picture ermithun  路  3Comments