'Blazor Debugging not hitting breakpoints
I am taking over maintenance of an ASP.Net Hosted WebAssembly project. Cannot debug it. I have added "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
to the launchsettings, I have done the Shift+Alt+D and then command window to restart Edge in debug mode. Nothing works, I do not see source code in the debug window, I cannot hit breakpoints server-side.
My feelings at this time are in a language ALL programmers know (unprintable as it is).
I could use some guidance from cooler and more experienced heads. I tried an alternate approach (code server side and switch to client-side) using this as a model https://github.com/ShaunCurtis/AllinOne but I still cannot debug.
I realize this may be iterative.
EDIT: I've embedded both launchsetting files, the API is the startup project and I am using IIS Express to start the process.
Edge Version: Version 92.0.902.62 (64 bit) VS2019 Professional Version: 16.10.4
WASM:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:41506/wasm",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/wasm/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
"Blazor": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/wasm/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
}
}
API:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:1686",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Blazor.API": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true"
}
}
}
EDIT 2 - Verbose Debug log
{"timestamp":1628178096458,"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":1628178096359,"metadata":{"connectionId":0,"message":{"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"pwa-msedge","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":1628178096360,"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":1628178096362,"metadata":{"connectionId":0,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1628178096445,"metadata":{"connectionId":0,"message":{"type":"request","command":"launch","arguments":{"WebRoot":"C:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\wwwroot","rootPath":"C:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\wwwroot","__workspaceFolder":"C:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\wwwroot","runtimeExecutable":"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe","runtimeArgs":[],"sourceMaps":true,"url":"http://localhost:1686/","trace":{"logFile":"C:\\Users\\kah6235_aero\\AppData\\Local\\Temp\\visualstudio-js-debugger.txt"},"port":54163,"launchUnelevated":false,"projectGuid":"4b5339f8-89f7-4c12-8c79-16d15d96f21d","userDataDir":"C:\\Users\\kah6235_aero\\AppData\\Local\\Microsoft\\VisualStudio\\16.0_5ac7f469\\WebTools\\F17440DA_75625535","breakOnLoad":true,"smartStep":true,"skipFiles":[],"showAsyncStacks":true,"timeout":60000,"inspectUri":"{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}","cleanUp":"onlyTab","name":"Visual Studio launch configuration override","type":"pwa-msedge","request":"launch","continueOnDisconnect":true},"seq":2}},"level":0}
{"tag":"dap.send","timestamp":1628178096448,"metadata":{"connectionId":0,"message":{"seq":3,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-msedge","request":"launch","os":"win32 x64","nodeVersion":"v12.20.1","adapterVersion":"1.54.2","parameters":"{\"type\":\"pwa-msedge\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":{\"logFile\":\"<string>\"},\"outputCapture\":\"console\",\"timeout\":60000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":true,\"resolveSourceMapLocations\":null,\"rootPath\":\"<string>\",\"outFiles\":[\"<string>\",\"<string>\"],\"sourceMapPathOverrides\":{\"webpack:///./~/*\":\"<string>\",\"webpack:////*\":\"<string>\",\"webpack://?:*/*\":\"<string>\",\"webpack:///([a-z]):/(.+)\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"__workspaceFolder\":\"<string>\",\"__autoExpandGetters\":false,\"__breakOnConditionalError\":false,\"address\":\"localhost\",\"port\":54163,\"disableNetworkCache\":true,\"pathMapping\":{},\"url\":\"<string>\",\"restart\":false,\"urlFilter\":\"*\",\"webRoot\":\"<string>\",\"server\":null,\"browserAttachLocation\":\"workspace\",\"targetSelection\":\"automatic\",\"vueComponentPaths\":[\"<string>\",\"<string>\"],\"perScriptSourcemaps\":\"auto\",\"cwd\":null,\"file\":null,\"env\":{},\"includeDefaultArgs\":true,\"runtimeArgs\":[],\"runtimeExecutable\":\"<string>\",\"userDataDir\":\"<string>\",\"browserLaunchLocation\":\"workspace\",\"profileStartup\":false,\"cleanUp\":\"<string>\",\"useWebView\":false,\"WebRoot\":\"<string>\",\"launchUnelevated\":false,\"projectGuid\":\"<string>\",\"breakOnLoad\":true,\"inspectUri\":\"<string>\",\"continueOnDisconnect\":true}"}}}},"level":0}
{"tag":"dap.send","timestamp":1628178096450,"metadata":{"connectionId":0,"message":{"seq":4,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\nC:\\Users\\kah6235_aero\\AppData\\Local\\Temp\\visualstudio-js-debugger.txt\n"}}},"level":0}
{"tag":"dap.receive","timestamp":1628178096542,"metadata":{"connectionId":0,"message":{"type":"request","command":"setBreakpoints","arguments":{"source":{"path":"c:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\Controllers\\WeatherForecastController.cs","sources":[],"checksums":[]},"breakpoints":[{"line":23,"column":13}],"lines":[23]},"seq":3}},"level":0}
{"tag":"dap.send","timestamp":1628178096543,"metadata":{"connectionId":0,"message":{"seq":5,"type":"response","request_seq":3,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1,"verified":false,"message":"Unbound breakpoint"}]}}},"level":0}
{"tag":"dap.receive","timestamp":1628178097048,"metadata":{"connectionId":0,"message":{"type":"request","command":"setExceptionBreakpoints","arguments":{"filters":[]},"seq":4}},"level":0}
{"tag":"dap.send","timestamp":1628178097048,"metadata":{"connectionId":0,"message":{"seq":6,"type":"response","request_seq":4,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1628178097051,"metadata":{"connectionId":0,"message":{"type":"request","command":"configurationDone","arguments":{},"seq":5}},"level":0}
{"tag":"dap.send","timestamp":1628178097051,"metadata":{"connectionId":0,"message":{"seq":7,"type":"response","request_seq":5,"command":"configurationDone","success":true,"body":{}}},"level":0}
{"tag":"runtime.launch","timestamp":1628178098079,"message":"Discovered target URL from /json/version","metadata":{"url":"ws://localhost/devtools/browser/f342153a-43f1-47e4-aa02-be5d1eaebf92","fixed":"ws://localhost:54163/devtools/browser/f342153a-43f1-47e4-aa02-be5d1eaebf92"},"level":0}
{"tag":"dap.send","timestamp":1628178101362,"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":[],"setBreakpoints":{"operation":"setBreakpoints","totalTime":0.6,"max":0.6,"avg":0.6,"stddev":null,"count":1,"failed":0},"!setBreakpoints.errors":[],"setBreakpoints.errors":[],"setExceptionBreakpoints":{"operation":"setExceptionBreakpoints","totalTime":0.5,"max":0.5,"avg":0.5,"stddev":null,"count":1,"failed":0},"!setExceptionBreakpoints.errors":[],"setExceptionBreakpoints.errors":[],"configurationDone":{"operation":"configurationDone","totalTime":0.4,"max":0.4,"avg":0.4,"stddev":null,"count":1,"failed":0},"!configurationDone.errors":[],"configurationDone.errors":[]}}}},"level":0}
{"tag":"runtime.launch","timestamp":1628178156552,"message":"Launch returned error","metadata":{"error":{"message":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","stack":"Error: Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"\n at x.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":"x"},"level":2}
{"tag":"dap.send","timestamp":1628178156553,"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 ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","showUser":false}}}},"level":0}
{"tag":"dap.send","timestamp":1628178156555,"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":1628178156555,"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":1628178158563,"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":1628178158564,"message":"Message not sent. Connection was closed.","level":2}
{"tag":"runtime.exception","timestamp":1628178158564,"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":1628178161554,"metadata":{"connectionId":0,"message":{"seq":12,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"launch":{"operation":"launch","totalTime":60108.4,"max":60108.4,"avg":60108.4,"stddev":null,"count":1,"failed":1},"!launch.errors":[{"error":{"message":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","name":"Error","stack":"Error: Unable to launch browser: \"Could not open wlocalhost:1686ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"\n at x.prepareLaunch (c:browserLauncher.js:115:19)"}}],"launch.errors":[{"error":{"message":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","name":"Error","stack":"Error: Unable to launch browser: \"Could not open wlocalhost:1686ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"\n at x.prepareLaunch (c:browserLauncher.js:115:19)"}}]}}}},"level":0}
{"tag":"dap.send","timestamp":1628178161554,"message":"Message not sent. Connection was closed.","level":2}
Solution 1:[1]
Your config probably needs some attention. In the sections you've labelled Blazor
and API
they are serving on the same ports: 5000/5001.
You wrote that you are using Edge - for a working config see my answer here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | lonix |