dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.51k stars 10.04k forks source link

Failed to launch debug adapter using .NET 5 Blazor WASM and IIS Express #36372

Closed Vizual-Dev closed 3 years ago

Vizual-Dev commented 3 years ago

Describe the bug

When attempting to run a new Blazor WebAssembly application created in Visual Studio 2019 (16.10.3) the browser hangs at about:blank, after around a minute the following message appears:

DebuggerMessage

Runnung the same project with Kestrel works as expected.

I have been using Blazor without this issue for a number of months now, what seems to have triggered it was a repair of IIS Express. I was having problems with my IIS Express development certificate and followed the advice at the bottom of this article to run a repair.

I have also tried running:

dotnet dev-certs https --clean dotnet dev-certs https --trust

To Reproduce

Create a new Blazor WebAssembly project in Visual Stuio 2019 using the default settings are press F5 to run.

NewProject

Further technical details

.NET Info

.NET SDK (reflecting any global.json): Version: 5.0.303 Commit: 6409b42649

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.303\

Host (useful for support): Version: 5.0.9 Commit: 208e377a53

.NET SDKs installed: 3.1.412 [C:\Program Files\dotnet\sdk] 5.0.103 [C:\Program Files\dotnet\sdk] 5.0.104 [C:\Program Files\dotnet\sdk] 5.0.201 [C:\Program Files\dotnet\sdk] 5.0.206 [C:\Program Files\dotnet\sdk] 5.0.301 [C:\Program Files\dotnet\sdk] 5.0.303 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Kestrel Output

info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:5001 info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: C:\Users\MyUser\source\repos\WebApplication22\WebApplication22 Hosting environment: Production Content root path: C:\Users\MyUser\source\repos\WebApplication22\WebApplication22 Now listening on: http://127.0.0.1:64905 Application started. Press Ctrl+C to shut down.

Output from debug window when using IIS Express

Starting IIS Express ... Successfully registered URL "http://localhost:44051/" for site "WebApplication22" application "/" Successfully registered URL "https://localhost:44366/" for site "WebApplication22" application "/" Registration completed for site "WebApplication22" IIS Express is running.

Verbose Logs

{"timestamp":1631278788940,"tag":"runtime.welcome","level":1,"message":"js-debug v1.54.2 started","metadata":{"os":"win32 x64","nodeVersion":"v12.20.1","adapterVersion":"1.54.2"}} {"tag":"dap.receive","timestamp":1631278788895,"metadata":{"connectionId":0,"message":{"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"pwa-chrome","locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true,"supportsMapURLToFilePathRequest":true,"supportsLaunchUnelevatedProcessRequest":true,"supportsAccessingSourcesThorughClient":true},"seq":1}},"level":0} {"tag":"dap.send","timestamp":1631278788896,"metadata":{"connectionId":0,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"Caught Exceptions","default":false,"supportsCondition":true,"description":"Breaks on all throw errors, even if they're caught later.","conditionDescription":"error.name == \"MyError\""},{"filter":"uncaught","label":"Uncaught Exceptions","default":false,"supportsCondition":true,"description":"Breaks only on errors or promise rejections that are not handled.","conditionDescription":"error.name == \"MyError\""}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":false,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true,"supportsExceptionFilterOptions":true}}},"level":0} {"tag":"dap.send","timestamp":1631278788897,"metadata":{"connectionId":0,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0} {"tag":"dap.receive","timestamp":1631278788927,"metadata":{"connectionId":0,"message":{"type":"request","command":"launch","arguments":{"WebRoot":"C:\Users\MyUser\source\repos\WebApplication22\WebApplication22\wwwroot","rootPath":"C:\Users\MyUser\source\repos\WebApplication22\WebApplication22\wwwroot","__workspaceFolder":"C:\Users\MyUser\source\repos\WebApplication22\WebApplication22\wwwroot","runtimeExecutable":"C:\Program Files\Google\Chrome\Application\chrome.exe","runtimeArgs":[],"sourceMaps":true,"url":"https://localhost:44366/","trace":{"logFile":"C:\\Users\\MyUser\\AppData\\Local\\Temp\\visualstudio-js-debugger.txt"},"port":50291,"launchUnelevated":true,"projectGuid":"b92137cc-6fc3-4581-b042-1f2f23c23216","userDataDir":"C:\\Users\\MyUser\\AppData\\Local\\Microsoft\\VisualStudio\\16.0_4a9eb70e\\WebTools\\10B84E65_39FB247D","breakOnLoad":true,"smartStep":true,"skipFiles":[],"showAsyncStacks":true,"timeout":60000,"inspectUri":"{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}","__webAssemblyDebugServerPath":"C:\\Users\\MyUser\\.nuget\\packages\\microsoft.aspnetcore.components.webassembly.devserver\\5.0.9\\Tools\\BlazorDebugProxy\\BrowserDebugHost.dll","cleanUp":"onlyTab","name":"Visual Studio launch configuration override","type":"pwa-chrome","request":"launch","continueOnDisconnect":true},"seq":2}},"level":0} {"tag":"dap.send","timestamp":1631278788930,"metadata":{"connectionId":0,"message":{"seq":3,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-chrome","request":"launch","os":"win32 x64","nodeVersion":"v12.20.1","adapterVersion":"1.54.2","parameters":"{\"type\":\"pwa-chrome\",\"name\":\"\",\"request\":\"launch\",\"trace\":{\"logFile\":\"\"},\"outputCapture\":\"console\",\"timeout\":60000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":true,\"resolveSourceMapLocations\":null,\"rootPath\":\"\",\"outFiles\":[\"\",\"\"],\"sourceMapPathOverrides\":{\"webpack:///./~/\":\"\",\"webpack:////\":\"\",\"webpack://?:/\":\"\",\"webpack:///([a-z]):/(.+)\":\"\",\"meteor://💻app/\":\"\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"workspaceFolder\":\"\",\"autoExpandGetters\":false,\"__breakOnConditionalError\":false,\"address\":\"localhost\",\"port\":50291,\"disableNetworkCache\":true,\"pathMapping\":{},\"url\":\"\",\"restart\":false,\"urlFilter\":\"\",\"webRoot\":\"\",\"server\":null,\"browserAttachLocation\":\"workspace\",\"targetSelection\":\"automatic\",\"vueComponentPaths\":[\"\",\"\"],\"perScriptSourcemaps\":\"auto\",\"cwd\":null,\"file\":null,\"env\":{},\"includeDefaultArgs\":true,\"runtimeArgs\":[],\"runtimeExecutable\":\"\",\"userDataDir\":\"\",\"browserLaunchLocation\":\"workspace\",\"profileStartup\":false,\"cleanUp\":\"\",\"WebRoot\":\"\",\"launchUnelevated\":true,\"projectGuid\":\"\",\"breakOnLoad\":true,\"inspectUri\":\"\",\"__webAssemblyDebugServerPath\":\"\",\"continueOnDisconnect\":true}"}}}},"level":0} {"tag":"dap.send","timestamp":1631278788932,"metadata":{"connectionId":0,"message":{"seq":4,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\nC:\Users\MyUser\AppData\Local\Temp\visualstudio-js-debugger.txt\n"}}},"level":0} {"tag":"dap.receive","timestamp":1631278788940,"metadata":{"connectionId":0,"message":{"type":"request","command":"setExceptionBreakpoints","arguments":{"filters":[]},"seq":3}},"level":0} {"tag":"dap.send","timestamp":1631278788940,"metadata":{"connectionId":0,"message":{"seq":5,"type":"response","request_seq":3,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0} {"tag":"dap.send","timestamp":1631278788943,"metadata":{"connectionId":0,"message":{"seq":6,"type":"request","command":"launchUnelevated","arguments":{"process":"C:\Program Files\Google\Chrome\Application\chrome.exe","args":["--disable-background-networking","--disable-background-timer-throttling","--disable-backgrounding-occluded-windows","--disable-breakpad","--disable-client-side-phishing-detection","--disable-default-apps","--disable-dev-shm-usage","--disable-renderer-backgrounding","--disable-sync","--metrics-recording-only","--no-first-run","--no-default-browser-check","--user-data-dir=C:\Users\MyUser\AppData\Local\Microsoft\VisualStudio\16.0_4a9eb70e\WebTools\10B84E65_39FB247D","--remote-debugging-port=50291","about:blank"]}}},"level":0} {"tag":"dap.receive","timestamp":1631278788944,"metadata":{"connectionId":0,"message":{"type":"request","command":"configurationDone","arguments":{},"seq":4}},"level":0} {"tag":"dap.send","timestamp":1631278788944,"metadata":{"connectionId":0,"message":{"seq":7,"type":"response","request_seq":4,"command":"configurationDone","success":true,"body":{}}},"level":0} {"tag":"dap.receive","timestamp":1631278788968,"metadata":{"connectionId":0,"message":{"type":"response","request_seq":6,"success":true,"command":"launchUnelevated","body":{},"seq":5}},"level":0} {"tag":"runtime.launch","timestamp":1631278788988,"message":"Discovered target URL from /json/version","metadata":{"url":"ws://localhost/devtools/browser/c5807356-4ea6-47f0-93eb-16620e7aff9e","fixed":"ws://localhost:50291/devtools/browser/c5807356-4ea6-47f0-93eb-16620e7aff9e"},"level":0} {"tag":"dap.send","timestamp":1631278793907,"metadata":{"connectionId":0,"message":{"seq":8,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"initialize":{"operation":"initialize","totalTime":2,"max":2,"avg":2,"stddev":null,"count":1,"failed":0},"!initialize.errors":[],"initialize.errors":[],"setExceptionBreakpoints":{"operation":"setExceptionBreakpoints","totalTime":0.3,"max":0.3,"avg":0.3,"stddev":null,"count":1,"failed":0},"!setExceptionBreakpoints.errors":[],"setExceptionBreakpoints.errors":[],"configurationDone":{"operation":"configurationDone","totalTime":0.3,"max":0.3,"avg":0.3,"stddev":null,"count":1,"failed":0},"!configurationDone.errors":[],"configurationDone.errors":[]}}}},"level":0} {"tag":"runtime.launch","timestamp":1631278849088,"message":"Launch returned error","metadata":{"error":{"message":"Unable to launch browser: \"Could not open wss://localhost:44366/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"","stack":"Error: Unable to launch browser: \"Could not open wss://localhost:44366/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"\n at f.prepareLaunch (c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\targets\browser\browserLauncher.js:115:19)"},"wasCancelled":true,"name":"f"},"level":2} {"tag":"dap.send","timestamp":1631278849423,"metadata":{"connectionId":0,"message":{"seq":9,"type":"response","request_seq":2,"command":"launch","success":false,"body":{"error":{"id":9240,"format":"Unable to launch browser: \"Could not open wss://localhost:44366/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"","showUser":false}}}},"level":0} {"tag":"dap.send","timestamp":1631278849425,"metadata":{"connectionId":0,"message":{"seq":10,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/error","data":{"!error":{"error":{"message":"WebSocket was closed before the connection was established","name":"Error","stack":"Error: WebSocket was closed before the connection was established\n at E.close (websocket.js:220:14)\n at webSocketTransport.js:50:16"}},"error":{"error":{"message":"WebSocket was closed before the connection was established","name":"Error","stack":"Error: WebSocket was closed before the connection was established\n at E.close (websocket.js:220:14)\n at webSocketTransport.js:50:16"}},"exceptionType":"unhandledRejection"}}}},"level":0} {"tag":"runtime.exception","timestamp":1631278849425,"message":"Unhandled error in debug adapter","metadata":{"message":"WebSocket was closed before the connection was established","stack":"Error: WebSocket was closed before the connection was established\n at E.close (c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\node_modules\ws\lib\websocket.js:220:14)\n at c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\cdp\webSocketTransport.js:50:16"},"level":3} {"tag":"dap.send","timestamp":1631278851441,"metadata":{"connectionId":0,"message":{"seq":11,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/error","data":{"!error":{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"}},"error":{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"}},"exceptionType":"uncaughtException"}}}},"level":0} {"tag":"dap.send","timestamp":1631278851441,"message":"Message not sent. Connection was closed.","level":2} {"tag":"runtime.exception","timestamp":1631278851441,"message":"Unhandled error in debug adapter","metadata":{"message":"read ECONNRESET","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"},"level":3} {"tag":"dap.send","timestamp":1631278854433,"metadata":{"connectionId":0,"message":{"seq":12,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"launch":{"operation":"launch","totalTime":60496.7,"max":60496.7,"avg":60496.7,"stddev":null,"count":1,"failed":1},"!launch.errors":[{"error":{"message":"Unable to launch browser: \"Could not open wss://localhost:44366/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"","name":"Error","stack":"Error: Unable to launch browser: \"Could not open wslocalhost:44366ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"\n at f.prepareLaunch (c:browserLauncher.js:115:19)"}}],"launch.errors":[{"error":{"message":"Unable to launch browser: \"Could not open wss://localhost:44366/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"","name":"Error","stack":"Error: Unable to launch browser: \"Could not open wslocalhost:44366ws-proxy?browser=ws%3A%2F%2Flocalhost%3A50291%2Fdevtools%2Fbrowser%2Fc5807356-4ea6-47f0-93eb-16620e7aff9e\"\n at f.prepareLaunch (c:browserLauncher.js:115:19)"}}]}}}},"level":0} {"tag":"dap.send","timestamp":1631278854433,"message":"Message not sent. Connection was closed.","level":2}

javiercn commented 3 years ago

@Vizual-Dev thanks for contacting us.

@BillHiebert do you have any thoughts? This seems to point out to an issue in the IIS Express certificate

BillHiebert commented 3 years ago

@javiercn The simplest way to test the certificate is to create an empty Asp.Net core app, make sure it is running IIS Express and Ctrl+F5 to run the app. If that works the certificate is fine.

@ericcornelson Can you offer any suggestions?

Vizual-Dev commented 3 years ago

CTRL F5 works fine on the same project Chrome says the certificate is trusted

hoangdovan commented 3 years ago

@Vizual-Dev I met this problem many times! To be honest, I don't know the reason. My work around: create new project, ensure debug OK, then copy your files from current project to new created one. Blazor Webassembly debug process is so buggy, unstable, slow & so painful! It's the most thing I hate about Blazor Webassembly! About this point, it still cannot compare to other Javascript Framework!

Vizual-Dev commented 3 years ago

@hoangdovan The message appears for projects that previosly worked (before the IIS Express repair) and for newly created projects.

The WebSocket was closed before the connection was established log entry makes me wonder if there could be something going on between my new IIS Express Development Certificate and websockets.

mkArtakMSFT commented 3 years ago

Ping @EricCornelson

ghost commented 3 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

danroth27 commented 3 years ago

@mkArtakMSFT I think we need to move this to be a Visual Studio issue. It doesn't sound like there's anything that can be done here on the framework side.

mkArtakMSFT commented 3 years ago

After consulting with the debugger team we've now confirmed that this is Debugger issue. Please use the VS Feedback to report this issue, so the team who owns the area can track the ask.