Reputation: 920
I have a Blazor .NET 8 application and I am trying to have it run in Staging in VS2022 in order to apply config transforms:
Setting launch profile as follows:
When I run my application I can see it is now hitting the breakpoint in Program.cs as expected:
Beyond this a browser window opens which is stuck on about:blank for a minute or so, then I eventually get this error back:
I have tested VS2022 with Blazor .NET 7 and MVC .NET 8 and launch profiles work as expected with no error, so this issue is specific to Blazor .NET 8. I tried creating a fresh Blazor .NET 8 app to see if it was the .sln I am working on is the issue, but it is also apparent with a new project.
Also worth mentioning I had one of my colleagues follow these steps and he was able to recreate the issue.
Has anybody come across this before and is it a bug that needs raising with Microsoft VS2022?
Thanks in advance
Rob
Upvotes: 3
Views: 457
Reputation: 142963
Not a Blazor expert but the culprit seems to be the debugging. Since you run app in staging environment the app.UseWebAssemblyDebugging()
is not called which seems to break VS when you are running in the debug. As workaround you can:
Run without debugging (Ctrl+F5 for example)
Add conditional call for non-development environments for debug build. For example:
if (app.Environment.IsDevelopment())
{
// ...
}
else
{
#if DEBUG
app.UseWebAssemblyDebugging();
#endif
// ...
}
Also check the ASP.NET Core upgrade guide, was not able to find something there but maybe you will.
Upvotes: 1