Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to debug Blazor hosted webassembly 5.0.2 from Visual Studio 2019 16.8.4 #29714

Closed
pmeems opened this issue Jan 28, 2021 · 18 comments
Closed
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly investigate
Milestone

Comments

@pmeems
Copy link

pmeems commented Jan 28, 2021

Describe the bug

I'm running into the same issues as reported in #22911
I'm running v5.0.200-preview.20614.14, using VS Studio 2019 Community v16.8.4
I have the same issues when running VS Studio 2019 Community Preview v16.9.0 Preview 3.0
When hitting F5 in VS the blank about page is opened and nothing is loaded.
When manually type in https://localhost:44356/ the app starts.
This happens when opened in Chrome and in Edge.
When opening in IE I get these Javascript errors:

  • JavaScript critical error at line 1, column 1399 in https://localhost:44356/_content/Microsoft.Authentication.WebAssembly.Msal/AuthenticationService.js\n\nSCRIPT1002: Syntaxis Error
  • JavaScript critical error at line 1, column 1723 in https://localhost:44356/_framework/blazor.webassembly.js\n\nSCRIPT1002: Syntaxis Error

To Reproduce

I just started a fresh Blazor WASM app running the tutorial at https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory-b2c?view=aspnetcore-5.0
Basically the command I used is:
dotnet new blazorwasm -au IndividualB2C --aad-b2c-instance "{AAD B2C INSTANCE}" --api-client-id "{SERVER API APP CLIENT ID}" --app-id-uri "{SERVER API APP ID URI}" --client-id "{CLIENT APP CLIENT ID}" --default-scope "{DEFAULT SCOPE}" --domain "{TENANT DOMAIN}" -ho -o {APP NAME} -ssp "{SIGN UP OR SIGN IN POLICY}"

Further technical details

  • ASP.NET Core version: v5.0.200-preview.20614.14
  • Include the output of dotnet --info

.NET SDK (reflecting any global.json):
Version: 5.0.200-preview.20614.14
Commit: 863605c8c3

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.200-preview.20614.14\

Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96

.NET SDKs installed:
2.1.520 [C:\Program Files\dotnet\sdk]
2.1.812 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
3.1.100-preview3-014645 [C:\Program Files\dotnet\sdk]
3.1.200-preview-015002 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015048 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015095 [C:\Program Files\dotnet\sdk]
5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
5.0.102 [C:\Program Files\dotnet\sdk]
5.0.200-preview.20614.14 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
    Tried with VS Studio 2019 Community v16.8.4 and VS Studio 2019 Community Preview v16.9.0 Preview 3.0
@pmeems pmeems changed the title Unable to debug Blazor hosted webassembly 3.2.0 from Visual Studio 2019 16.8.4 Unable to debug Blazor hosted webassembly 5.0.2 from Visual Studio 2019 16.8.4 Jan 28, 2021
@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps labels Jan 28, 2021
@javiercn
Copy link
Member

@pmeems thanks for contacting us.

Something weird is going on with the VS Debugger I think. @captainsafia do you know who the right folks to talk about this are?

I would suggest you close VS and try to remove the .vs folder to see if that helps

@javiercn javiercn added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. External This is an issue in a component not contained in this repository. It is open for tracking purposes. labels Jan 28, 2021
@pmeems
Copy link
Author

pmeems commented Jan 28, 2021

Thanks @javiercn I just closed VS, deleting the .vs folder and tried again.
The same result. Only the About page is shown and after a while VS reports an error.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Jan 28, 2021
@captainsafia
Copy link
Member

Thanks for the info, @pmeems. It looks like you've identified two different issues in the PR.

The first is the webpage not automatically loading after pressing F5 and the second is the error you receive when opening in IE.

  • Are you able to debug after manually navigating to the webpage?
  • What version of IE were you trying to use in the second half?

@captainsafia captainsafia added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Jan 28, 2021
@javiercn
Copy link
Member

I didn't realize the IE part.

Current versions of Blazor don't support Internet Explorer. Only Microsoft Edge.

@captainsafia
Copy link
Member

@javiercn Ah, right you are. I always get groggy on our supportability matrix. But luckily there's a website for that: https://docs.microsoft.com/en-us/aspnet/core/blazor/supported-platforms?view=aspnetcore-5.0.

Another thing I'd recommend is to see if you can reproduce the issue with debugging when starting the app on a Kestrel server.

@pmeems
Copy link
Author

pmeems commented Jan 29, 2021

I know IE isn't supported I just tried it and noticed the javascript errors. Perhaps they shed some light on the problem.

  • When I manually navigate to the webpage I can't debug.
  • When running the app on a Kestrel server it will start and I can debug. So at least I can continue with my development.
  • I just created a new fresh Blazor WASM Hosted app using VS v16.9.0 Preview 3.0, but now without Authentication and that one can't be started using IIS Express as well.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Jan 29, 2021
@mkArtakMSFT
Copy link
Member

@pmeems if you can repro these issues with a supported browser, we can look into this further.

@mkArtakMSFT mkArtakMSFT added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Jan 29, 2021
@pmeems
Copy link
Author

pmeems commented Feb 1, 2021

No need for a separate repo. I just created a new project using the Blazor WASM template of VS2019, enabled Hosting, and ran it.
I've not added nor changed any code.

@mkArtakMSFT Could you confirm using the template will reproduce the problem? If not it might be something else on my pc.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Feb 1, 2021
@javiercn
Copy link
Member

javiercn commented Feb 1, 2021

@pmeems seems like you are either using a preview version of the SDK or a preview version of Visual studio. Can you try to setting up the SDK to a well-known version and using a released version of Visual Studio? (dotnet new globaljson --sdk-version 5.0.102 on the root of the solution)

Do you see any errors in the console when you open it with a supported browser? (Latest Edge for example).

@captainsafia can you route this to the right folks?

@javiercn javiercn added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Feb 1, 2021
@pmeems
Copy link
Author

pmeems commented Feb 1, 2021

Thanks @javiercn, adding that global.json helps.
When hitting F5 in now loads the app. So it looks like it is something in the SDK preview I'm using?

Debugging however is still not working. I've added a breakpoint at the OnClick-event of the Counter page but it never gets triggered. I do get the warning in VS 'Berakpoint set but not bound'

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Feb 1, 2021
@captainsafia
Copy link
Member

@pmeems Can you file an issue for this using the "Report a problem" UX in VS?

Also, just to confirm: it appears that debugging is working for both non-Auth and Auth apps with kestrel?

@captainsafia captainsafia added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Feb 1, 2021
@pmeems
Copy link
Author

pmeems commented Feb 2, 2021

Let me summarize:

I've got a Blazor Server application, which I've been working on for months. This app runs in IIS Express and is debuggable.

I also have a Blazor WASM Core Hosted app with Azure B2C authentication, just started last week, my first Blazor WASM app. When running the Server project with IIS Express I can't get past the About:blank page.
When using Kestrel I can start my app AND debug it.

I also created a new Blazor WASM Core Hosted app without auth, using the VS template.
As suggested by @javiercn I added a global.json:

{
  "sdk": {
    "version": "5.0.102"
  }
}

Now I can run the Server project with IIS Express but I still can't debug.
Using Kestrel I can run the application AND debug it.

All packages used by my projects are up-to-date.

As requested I also reported this as a problem at https://developercommunity2.visualstudio.com/t/Unable-to-debug-Blazor-hosted-webassembl/1327806

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Feb 2, 2021
@mkArtakMSFT mkArtakMSFT added investigate and removed External This is an issue in a component not contained in this repository. It is open for tracking purposes. area-blazor Includes: Blazor, Razor Components Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Feb 2, 2021
@BrennanConroy BrennanConroy added this to the Next sprint planning milestone Feb 3, 2021
@ghost
Copy link

ghost commented Feb 3, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@BrennanConroy BrennanConroy self-assigned this Feb 3, 2021
@BrennanConroy
Copy link
Member

Few things I found when investigating this:

  1. When launching IIS Express, the browser about page opens immediately and waits for symbols to load before actually hitting the web page, if symbol loading takes too long then the process closes and VS has an error dialog . When looking at the js-debugger logs you can see Unable to launch browser: "Could not open wss://localhost:44381/_framework/debug/ws-proxy?.... However, when launching with Kestrel the symbol loading happens first, then the browser launches and the app starts successfully. I also tried launching IIS Express multiple times until enough symbols were cached and then the app starts successfully every time.
  2. When trying to debug a WASM app with the debugging port set for the browser (using the provided command) I get "Debugging connection was closed. Reason WebSocket disconnected". When inspecting the network traffic, the error the websocket has is "No such target id: ". Going back a little further in the network traces shows the /json endpoint being hit and returning a websocket endpoint with the same id that then fails. Not sure how to debug this further as there are too many processes going on and I don't know which ones are involved.
  3. If you already have a browser instance open from a previous debugging session/attempt and you launch the app again on a different url (port or scheme change), the new browser instance doesn't show the command to run for debugging WASM when you ctrl-alt-d, instead it shows "No inspectable pages found", so it must be trying to talk to the previous sessions debug proxy.
  4. I don't have a repro for this, but occasionally when trying to debug a WASM app I've seen 10's or 100's of ConnectionResetExceptions spamming the output window.

@captainsafia
Copy link
Member

@BrennanConroy and I synced on this yesterday.

For #1, we'll sync with the VS team to understand why the launch behavior differs between IIS Express and Kestrel. Getting IIS Express to load the symbols before launching the app server would improve startup perf for the app.

For #2, it appears that the proxy might be trying to communicate with a browser that connection that is no longer valid. The cache .vs directory is a culprit here.

#3 is expected behavior.

For #4, we need more logging from the DebugProxy.

@devlife
Copy link

devlife commented Feb 12, 2021

I too have a Hosted Blazor WASM solution and am unable to debug code behind files. I've tried this in Visual Studio Pro 2019 Version 16.8.5 and Visual Studio Pro 2019 Preview Version 16.9.0 Preview 4.0. I tried repairing the installs as well as deleting the .vs folder. I've run in Kestrel and IIS Express. No luck no matter what I do.

@captainsafia
Copy link
Member

@devlife I would recommend opening a new issue with the relevant details so we can work through your particular problem. Thanks!

@BrennanConroy BrennanConroy removed their assignment Jul 30, 2021
@captainsafia
Copy link
Member

Closing this since there's nothing actionable on our end here.

The runtime team has added more logging to the DebugProxy for .NET 6.

Reached out to VS about improving launch semantics for IIS Express.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2021
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly investigate
Projects
None yet
Development

No branches or pull requests

8 participants