Skip to content

Debugging Blazor Apps with WebAssemblyServer 5.0.x Kills IIS Express #30353

@nolanblew

Description

@nolanblew

Describe the bug

On a Blazor WASM project, upgrading the Server to .NET 5 AND upgrading the Microsoft.AspNetCore.Components.WebAssemblyServer package to 5.0.x (I just tried the latest, 5.0.3) breaks any client-side debugging. After setting a breakpoint on a client page, the breakpoint does get recognized and turns fully red. However, the moment that breakpoint is hit, the .NET debugger detaches without warning or messages and IISExpress expectantly closes.

Also, attempting to debug using the remote debugger fails as well.

BREAKPOINT WITH Microsoft.AspNetCore.Components.WebAssemblyServer = 3.2.1 (Click GIF for full-screen resolution)

working

BREAKPOINT WITH Microsoft.AspNetCore.Components.WebAssemblyServer = 5.0.3 (Click GIF for full-screen resolution)

not_working

To Reproduce

You can easily repro with a clean, new project:

  1. Create a new Blazor App project
  2. Select Blazor WebAssembly App
    a. Ensure Configure for HTTPS is selected (because I haven't tested it off)
    b. Ensure ASP.NET Core hosted is selected (because I haven't tested it off)
    c. Progressive Web Application has been tested both on and off with no change
  3. Once the project is created, navigate to the Client project in Solution Explorer, and go to Pages/[anypage]. Set a breakpoint in the code on any page that has code (I personally used the Counter page as it's very simple)
  4. You may run the project now and ensure the breakpoint hits, or just skip to the next step
  5. Right click on TestBlazorApp.Server and click Properties (or you can do the next 2 steps using the .csproj)
  6. Under Target Framework, select .NET 5.0
  7. Right click again on TestBlazorApp.Serverand clickManage NuGet Packages...`
  8. There should only be 1 package, the Microsoft.AspNetCore.Components.WebAssemblyServer which is on v3.2.1. Choose to upgrade this to 5.0.3 (the current latest)
  9. Now clean and rebuild the project for good measure, though I found this not necessary to produce the bug
  10. Finally, run the app and hit the breakpoint again. Observe how IIS Express suddenly closes, and Visual Studio is no longer debugging the app.

If you can't seem to repro or for other reasons would like me to create a sample github repo I can!

Exceptions (if any)

I couldn't find any exceptions. IIS Exited with code -1, there is nothing in the EventViewer.

Further technical details

I am using the latest stable version of Visual Studio (16.8.5) along with the latest stable version of .NET that comes with Visual Studio. I believe that IIS is on 10.0. I am using a Windows 10 Pro Edition x64 with 64GB RAM and over 500GB of SSD space remaining. I have also tested on a separate device, a Surface Pro 7 with the VS Preview installed with the same result.

Using Chromium Edge: Dev (build 90.0.796.0) as well as the latest version of Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-blazorIncludes: Blazor, Razor Componentsfeature-blazor-debuggingThis issue is related to debugging of Blazor WebAssembly appsfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions