dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 666 forks source link

Simplify name of attach to process command #7167

Open richlander opened 3 months ago

richlander commented 3 months ago

There should be no place where we say ".NET 5+ or .NET Core" in the Devkit UI. It's both because all the .NET Core versions are EOL but also because this phrasing is just unnecessary and confusing. It's also makes us look a bit silly.

image

WardenGnaw commented 3 months ago

The reasoning behind this naming is for the following:

Let me know if we still should change the naming to just say Debug: Attach to a .NET process.

cc: @gregg-miskelly @hharshada @poppastring

richlander commented 3 months ago

I think we should change it.

This comes down to a tradeoff:

I'm in camp 2. We can rely on docs to explain support.

gregg-miskelly commented 3 months ago

I forget what failure looks like if you try and attach to a .NET Framework process. As long as we have some sort of reasonable failure message, I think it is okay to change it.

WardenGnaw commented 3 months ago

@gregg-miskelly This is the current error message: Failed to attach to process: The .NET Debugger can only attach to x64 processes.

image

gregg-miskelly commented 3 months ago

Can you try with an x64 .NET Framework process instead?

WardenGnaw commented 3 months ago

C:\Users>corflags.exe C:\Users\source\repos\FrameworkConsoleApp\FrameworkConsoleApp\bin\Debug\FrameworkConsoleApp.exe Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.8.3928.0 Copyright (c) Microsoft Corporation. All rights reserved.

Version : v4.0.30319 CLR Header: 2.5 PE : PE32+ CorFlags : 0x1 ILONLY : 1 32BITREQ : 0 32BITPREF : 0 Signed : 0

It just hangs without any error message, it seems to be stuck:

-> (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":"attach","arguments":{"name":".NET Core Attach","type":"coreclr","request":"attach","hotReloadOnSave":true,"hotReloadVerbosity":"minimal","stopAtEntry":false,"justMyCode":false,"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}},"expressionEvaluationOptions":{"allowImplicitFuncEval":true,"allowToString":true,"allowFastEvaluate":true,"showRawValues":false},"processId":"2844","__sessionId":"1e2fe790-9f67-4994-9a9a-708f977b3c30"},"type":"request","seq":2}
ServiceBroker Start: 0 : Requesting proxy to "Microsoft.VisualStudio.Debugger.ManagedEditAndContinueRemoteDebuggerService (0.1)"
------------------------------------------------------------------------------
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":"attach"}
<- (E) {"seq":6,"type":"event","event":"initialized","body":{}}
ServiceBroker Transfer: 0 : Transfer, relatedActivityId=d6809421-a302-4b27-ad78-673cc1afa589
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=f9a4a365-671f-4ea3-bb2a-99a7d4e2294d
ServiceBroker Stop: 0 : Requesting proxy to "Microsoft.VisualStudio.Debugger.ManagedEditAndContinueRemoteDebuggerService (0.1)"
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"Program.cs","path":"c:\\Users\\\\source\\repos\\FrameworkConsoleApp\\FrameworkConsoleApp\\Program.cs","checksums":[{"algorithm":"SHA1","checksum":"de7e6b5d2408edb31fa0fd4e9c4b973964e325df"},{"algorithm":"SHA256","checksum":"5aa018b9b9afffb85dbead58716943d198a51a80624b7e501cce84496767bc1e"},{"algorithm":"SHA1","checksum":"31927ba8fb4d394c599e43c9dc549181d4026c7b"},{"algorithm":"SHA256","checksum":"a40a151d4a978306ff0826d8932f7d1dad42d77baf069b09d055f2d2daa9647c"}]},"lines":[15],"breakpoints":[{"line":15}],"sourceModified":false},"type":"request","seq":3}
-> (C) {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[{"filterId":"user-unhandled"}]},"type":"request","seq":5}
<- (E) {"seq":7,"type":"event","event":"output","body":{"category":"telemetry","output":"vs/diagnostics/debugger/vsdbg/BreakpointAdded","data":{"VS.Diagnostics.Debugger.vsdbg.OSFamily":"Windows","VS.Diagnostics.Debugger.vsdbg.Version":"17.11.10506.2 commit:bf05b28f55d97d1bcb78f61365a1efbfdf0eb128","VS.Diagnostics.Debugger.vsdbg.BreakpointAdded.HasHitCount":false,"VS.Diagnostics.Debugger.vsdbg.WindowsVersion":"10.0.22631","VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.BreakpointAdded.BreakpointType":"Source","VS.Diagnostics.Debugger.vsdbg.BreakpointAdded.HasLogMessage":false,"VS.Diagnostics.Debugger.vsdbg.BreakpointAdded.HasCondition":false}}}
<- (R) {"seq":8,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":15}]}}
<- (R) {"seq":9,"type":"response","request_seq":4,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
<- (R) {"seq":10,"type":"response","request_seq":5,"success":true,"command":"setExceptionBreakpoints","body":{"breakpoints":[{"verified":true}]}}
-> (C) {"command":"configurationDone","type":"request","seq":6}
<- (E) {"seq":11,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/ProcessCreate","data":{"VS.Diagnostics.Debugger.vsdbg.OSFamily":"Windows","VS.Diagnostics.Debugger.vsdbg.Version":"17.11.10506.2 commit:bf05b28f55d97d1bcb78f61365a1efbfdf0eb128","VS.Diagnostics.Debugger.vsdbg.WindowsVersion":"10.0.22631","VS.Diagnostics.Debugger.vsdbg.TargetArchitecture":"AMD64"}}}
<- (E) {"seq":12,"type":"event","event":"process","body":{"name":"C:\\Users\\\\source\\repos\\FrameworkConsoleApp\\FrameworkConsoleApp\\bin\\Debug\\FrameworkConsoleApp.exe","systemProcessId":2844,"isLocalProcess":true,"startMethod":"attach"}}
ServiceBroker Start: 0 : Requesting proxy to "Microsoft.VisualStudio.Debugger.ManagedEditAndContinueCsDevKitEngineService (0.1)"
<- (R) {"seq":13,"type":"response","request_seq":6,"success":true,"command":"configurationDone"}
<- (E) {"seq":14,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":1,"verified":false,"message":"No symbols have been loaded for this document.","line":15}}}
ServiceBroker Stop: 0 : Requesting proxy to "Microsoft.VisualStudio.Debugger.ManagedEditAndContinueCsDevKitEngineService (0.1)"
-> (C) {"command":"threads","type":"request","seq":7}
<- (R) {"seq":15,"type":"response","request_seq":7,"success":true,"command":"threads","body":{"threads":[]}}
gregg-miskelly commented 3 months ago

Thanks. That is what I was afraid of. I personally think because of this we shouldn't name it "Debug: Attach to a .NET process" as there is almost no feedback what is wrong if you attach to a .NET Framework process.

@richlander What do you think of "Debug: Attach to a .NET (6+) process"?

davidfowl commented 3 months ago

Is there no way to detect and fail so we can call it .NET?

gregg-miskelly commented 3 months ago

I don't think we would want to error out in that case, since it is possible to host both .NET Framework and coreclr in the same process (not that this is a good idea). But we could warn I suppose.