microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
221 stars 10 forks source link

non-MAUI .NET Debug launch hangs with when the pre-release .NET MAUI extension is installed #1012

Closed Dovernh closed 5 months ago

Dovernh commented 6 months ago

Repro steps:

  1. Install C# Dev Kit + .NET MAUI extension (must be pre-release; reproes with 0.10.30) + C# extensions
  2. Create a new .NET 8 console app
  3. Try to launch

Result:

Debug console prints:

------------------------------------------------------------------------------
You may only use the Microsoft Visual Studio .NET/C/C++ Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you
develop and test your applications.
------------------------------------------------------------------------------

But the project is never actually launched, and VS Code stays in debug mode forever without making progress.

gaelj commented 6 months ago

I just started having the same issue in Arch Linux, using the official snap package (and also with the one in the Arch Linux User Repo or AUR, which I usually use).

image

I have 2 machines running Linux, both are impacted. It seems that it appeared after updating the MS C++ addon, which seems strange.

I'm using the previews of the C# dev kit and C# addon. I tried to revert to the normal versions. It briefly allowed me to debug, and then reverted back to refusing.

WardenGnaw commented 6 months ago

@Dovernh That is just the standard banner that will show per debug session. Is it hanging or look like it is waiting on something? I was unable to reproduce this issue with 1.88.0-insiders with a C# Console Application of macOS.

For macOS, did you enable developer mode? See https://code.visualstudio.com/docs/csharp/cs-dev-kit-faq#_when-i-f5-it-prompts-me-to-input-a-password-macos-only

Dovernh commented 6 months ago

@WardenGnaw it looks like it is hanging, i can see the debug controls, as if i were able to debug. debug console just has the banner and nothing else.

I am not being prompted for a password. I ran the commands anyway, nothing different. I can also debug in regular VSCode and in Rider. I was debugging just fine yesterday

image image

WardenGnaw commented 6 months ago

Can you go to Code - Insiders -> Settings -> Settings and search for csharp.debug.logging.diagnosticsLog.protocolMessages and enable that option. There should be more logs in the Debug Console to share where it is stuck at.

Dovernh commented 6 months ago

not sure which one u want exactly, so turning all none's and unchecked image

VSCode_Debug.txt

gaelj commented 6 months ago

Enabling this option in my Linux case, I now have this in the debug log:

-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true},"type":"request","seq":1}
-> (C) {"command":"launch","arguments":{"name":"C#: ProductionDashboards.Server","type":"coreclr","request":"launch","projectPath":"/home/gaj/gitlab.aweurope.be/post-prod/production-dashboards/ProductionDashboards.Server/ProductionDashboards.Server.csproj","launchConfigurationId":"TargetFramework=;ProductionDashboards.Server","preRestartTask":"dotnet: build /home/gaj/gitlab.aweurope.be/post-prod/production-dashboards/ProductionDashboards.Server/ProductionDashboards.Server.csproj","program":"/home/gaj/gitlab.aweurope.be/post-prod/production-dashboards/ProductionDashboards.Server/bin/Debug/net8.0/ProductionDashboards.Server","args":"","cwd":"/home/gaj/gitlab.aweurope.be/post-prod/production-dashboards/ProductionDashboards.Server","env":{"ASPNETCORE_URLS":"http://localhost:4000","ASPNETCORE_ENVIRONMENT":"Development"},"console":"internalConsole","checkForDevCert":false,"launchSettingsProfile":null,"debuggerStartDebugTelemetry":{"buildCompletedTimestamp":"0x18e62cc7da1","totalBuildTime":4409,"projectType":"Web"},"serverReadyAction":{"action":"openExternally","pattern":"\\bNow listening on:\\s+https?://\\S+","uriFormat":"http://localhost:4000"},"hotReloadOnSave":true,"hotReloadVerbosity":"minimal","stopAtEntry":false,"justMyCode":true,"requireExactSource":true,"enableStepFiltering":true,"logging":{"exceptions":true,"moduleLoad":true,"programOutput":true,"browserStdOut":true,"elapsedTiming":false,"threadExit":false,"processExit":true,"engineLogging":false,"diagnosticsLog":{"protocolMessages":false,"dispatcherMessages":"none","debugEngineAPITracing":"none","debugRuntimeEventTracing":false,"expressionEvaluationTracing":false,"startDebuggingTracing":false},"consoleUsageMessage":true},"suppressJITOptimizations":false,"symbolOptions":{"searchPaths":[],"searchMicrosoftSymbolServer":false,"searchNuGetOrgSymbolServer":false,"cachePath":"","moduleFilter":{"mode":"loadAllButExcluded","excludedModules":[],"includedModules":[],"includeSymbolsNextToModules":true,"includeSymbolsOnDemand":true}},"allowFastEvaluate":true,"internalConsoleOptions":"openOnSessionStart","__sessionId":"fc62241f-235d-4d8c-beeb-56eafeffbfa0"},"type":"request","seq":2}
------------------------------------------------------------------------------
You may only use the Microsoft Visual Studio .NET/C/C++ Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you
develop and test your applications.
------------------------------------------------------------------------------
<- (R) {"seq":5,"type":"response","request_seq":2,"success":true,"command":"launch"}
<- (E) {"seq":6,"type":"event","event":"initialized","body":{}}
ServiceBroker Start: 0 : Requesting proxy to "Microsoft.VisualStudio.Debugger.ManagedEditAndContinueRemoteDebuggerService (0.1)"
ServiceBroker Transfer: 0 : Transfer, relatedActivityId=21c598db-0a0e-4147-84c7-faea9a8f4eb9
ServiceBroker Start: 0 : Requesting pipe to "Microsoft.VisualStudio.Server.IBrokeredServiceBridgeManifest (0.1)"
ServiceBroker Stop: 0 : Requesting pipe to "Microsoft.VisualStudio.Server.IBrokeredServiceBridgeManifest (0.1)"
ServiceBroker Transfer: 0 : Transfer, relatedActivityId=22dc080e-342b-4a66-bb3f-9c896968a6f7
ServiceBroker Stop: 0 : Requesting proxy to "Microsoft.VisualStudio.Debugger.ManagedEditAndContinueRemoteDebuggerService (0.1)"

To clarify, my symptom is that when I start a debug session, the debug toolbar appears, the dotnet build is done, the debug console gets refreshed, but nothing seems to actually run. The app doesn't launch and if I set a breakpoint in Program.cs and it never gets hit.

Dovernh commented 6 months ago

Just tried on my windows 11 pc. same issue as on my mac.

WardenGnaw commented 6 months ago
  1. on macOS or linux, can you share a dump of the vsdbg-ui process?

You can do this by running ~/.vscode/extensions/ms-dotnettools.csharp-<VERSION>-<PLATFORM>/.debugger$ ./createdump --full <PID> and share the dump created in '/tmp/coredump.

  1. Could you also share the version of the C# Extension?
  2. Could you try to start debugging without C# Dev Kit installed and see if this issue still occurs?
gregg-miskelly commented 6 months ago

@gaelj what version of VS Code are you using? Your protocol trace looks like a VS Code problem, though I wouldn't yet say this for certain. @Dovernh do you know if you can repro this issue in the VS Code release channel?

Dovernh commented 6 months ago

@gregg-miskelly the issue can be repro'd in insiders, regular version, it does not repro. i was debugging yesterday fine, this morning after the update, the issue began. i assume release == non insiders.

@WardenGnaw i can debug angular (javascript), cannot debug c#

gaelj commented 6 months ago

I'm fairly sure that the problem appeared after updating the extensions, not vs code itself. Both the official Snap release and the AUR release are the same version:

❯ snap run code --version
1.87.2
863d2581ecda6849923a2118d93a088b0745d9d6
x64

❯ code --version
1.87.2
863d2581ecda6849923a2118d93a088b0745d9d6
x64

I was able to create the core dump of vsdbg-ui but it's 321MB and anyway github doesn't allow sending this type of fle. I'm not sure how I can send it over to you @WardenGnaw .

With the C# dev kit disabled, yes, it works fine.

C# extension is v2.23.2 (pre-release)

gaelj commented 6 months ago

I think I may have found the culprit, at least for my issue. It's the MS .NET MAUI extension (v0.10.30 (pre-release)). As long as it's disabled, debugging starts fine.

Dovernh commented 6 months ago

I had the same extension of .Net Maui, same version, i disabled it, and i can debug c#

gregg-miskelly commented 6 months ago

Thanks for figuring out the source of the issue. I can repro the problem!

mauroa commented 5 months ago

This issue has been fixed and the fix will be available in the next MAUI extension pre-release, coming soon.

mauroa commented 5 months ago

Closing since the issue has been fixed and the fix has been release on latest pre-release