question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging Blazor Apps with WebAssemblyServer 5.0.x Kills IIS Express

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
captainsafiacommented, Feb 24, 2021

@nolanblew I think we tracked down the root issue in this case. There’s some JS-code that enables the debugger that was changed between 3.2 and 5.0. The problem you ran into was likely a result of the incompatibility between the two.

1reaction
nolanblewcommented, Feb 23, 2021

I noticed in your 5.0 gif, the dotnet webassembly loaded is still version 3.2.

Can you try deleting the bin and obj folders for all projects manually, or just creating a 5.0 app in the first place to see if the issue still repros?

@BrennanConroy Alright, I’ve closed VS, deleted the .vs, deleted all the bin and obj folders, deleted all my nuget caches, restarted my computer, and tried again with no avail. The issue still persists.

(Loading the dll on startup in the output now reveals:

'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Users\nolan\source\repos\TestBlazorApp\TestBlazorApp\Server\bin\Debug\net5.0\Microsoft.AspNetCore.Components.WebAssembly.Server.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

Is that where you were looking when you determined it was still loading the old dll?

Also I am unable to create a new .net5 project as I don’t have that template in the non-preview build of VS2019. That won’t do anyways since the end goal is to upgrade an existing project

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug ASP.NET Core Blazor WebAssembly
Blazor WebAssembly apps can be debugged using the browser developer tools in Chromium-based browsers (Edge/Chrome). You can also debug your ...
Read more >
Unable to connect to web server 'IIS Express'
This is the easy fix. For me, toggling the "Enable SSL" setting in the project Debug tab inside Visual Studio (just change it...
Read more >
(VS 2019 + Blazor ServerSide + IIS Express) Issues
This behavior is expected. Blazor Server apps handle all browser UI events over a real-time SignaR connection. The UI rendering is then done...
Read more >
Run/debug with visual studio
i have created a project that runs from the radzen app or from the radzen blazor studio ctp but when i load the...
Read more >
[Solved]-Unable to connect to web server 'IIS Express'-blazor
Go to your project/main solution folder in visual studio; Right click on it and choose properties; Go to the debug tab; Scroll down...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found