Urgent help with Blazor WASM Hosted. Environment is messed up for no reason, suddenly.

Lynn K 1 Reputation point
2021-07-25T00:32:08.95+00:00

So, since approx. a week, my Visual Studio Blazor dev environment is completely broken. This happened out of nowhere, before that, everything worked perfectly fine.

So well, what are the issues? What have I been doing?
I primarily worked on hosted Blazor WebAssembly apps with the PWA feature using .NET 5. I used Visual Studio 2019, the 2019 Preview for testing some stuff, and 2022 Preview for testing and experimenting with .NET 6 stuff.

Out of the nowhere, a lot of things changed, or broke. The first thing I noticed is, when I created a new Blazor WASM app project, the launch options changed.
Normally, when you debug or launch a hosted Blazor WASM project, no matter if you select the client or server project, it starts the server project. Suddenly, that was no longer the case. The client project starts itself, without building or starting the server project, leading to errors in the default template, since it communicates with the server. Now the really bad thing is, debugging no longer works, no matter what setting. Script debugging is on, but it just doesn't work anymore. Breaking on exception in IDE no longer works, breakpoints no longer work.

Occassionally, the server dies when refreshing the browser throwing "SocketException" and "ConnectionResetException" every nanosecond.
I get hundreds of debug connection exceptions in the console saying it couldn't find the target with the ID specified.

But, the "debugging" session continues. It doesn't crash, it just hangs up.

Now, it gets worse.

I used LiveSharp for live preview and hot reloading for .NET 5. I continued normally, but using the server as the startup project.
I built a SignalR hub on the server project, and created a HubConnection on the client project. When connecting on startup, no matter if through
the DI container or after render, I get the weirdest error message, which I have never ever seen before. "Uncaught Error: The delegate target that is being invoked is no longer available" from dotnet.js. It was a singleton service, and no I have not disposed anything, no "using" or anything. Restarting the projects a few times brings me a completely different error - "Cannot instantiate a new hub connection if the hub connection state is not Disconnected" - what the hell? I never instantiated a connection before, it was literally the first time starting a connection after startup. Neither as a service, I instantiated it myself. Impossible.

Uninstalled LiveSharp everywhere - same issue. Then suddenly after some time, I started up the project, and - the entire thing went insane. App hung itself up, looking into console are just two weird messages with "mono" and "<disabled>". Cannot refresh, cannot close - and then the entire browser died too. The whole thing including the browser just died, for no reason.

I know, you want code, you want some logs, but I spent a week trying to fix these issues, reinstalling Windows, reinstalling Visual Studio, checking Firewall, checking everything, reinstalling everything - but no luck. No luck at all. Like I am completely clueless, I tried everything.

I used Windows 11 Insider Preview before, then wiped and freshly reinstalled Windows 10, tried again - no luck. Upgraded to Windows 11 again, no luck. Reinstalled Visual Studio, tried 2019, 2019 Preview and 2022 Preview, everything with no single luck.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,204 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,402 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,636 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,301 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
944 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Todd Bellamy 1 Reputation point
    2022-02-18T16:22:20.723+00:00

    I'm having very similar issues. Were you able find a solution?

    0 comments No comments

  2. Mckelvy, Leroy 1 Reputation point
    2022-02-28T21:45:12.677+00:00

    There seems to be lot's of people experiencing this issue. Unfortunately the cause could be one of several things based on all that I have read. This issue has caused me much pain over the last week and just about no productivity.

    In my case, this issue started occurring out of no where. I thought maybe I had accidently modified or corrupted something in my project or development environment. But the issue still occurred even when I created new projects from scratch, and even after uninstalling and reinstalling Visual Studio. I was primarily using Visual Studio 2019, but I recently started using Visual Studio 2022 and was still experiencing the same issue.

    I eventually came across this link that describes how to setup a debug environment for Blazor Web Assembly applications -> https://learn.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-5.0&tabs=visual-studio#debug-in-the-browser. The article mentioned including a setting ("NO_PROXY": "localhost") in the environment variables section of your server project's launchsettings.json file, if your network environment had a proxy. I followed the instructions in the article and added the setting outlined in the screenshot. Finally everything was working again.

    I assume my company's network made some change, adding a proxy, that caused my ability to debug WASM apps to break and requiring this setting to be included.

    178495-image.png

    0 comments No comments