microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
818 stars 218 forks source link

Unable to launch debugger in Visual Studio 2022: "launch: program '' does not exist." #1389

Open robertturner opened 1 year ago

robertturner commented 1 year ago

Environment

Host: Windows 11, Visual Studio 2022 17.5.1 Target: Debian Buster armv7l Target dotnet: v6.0 installed at ~/dotnet. vsdbg installed at ~/vsdbg

Bug Summary

When launching vsdbg via plink with DebugAdapterHost I get "launch: program '' does not exist." Previously the dotnet app runs fine on the target, and I can also Attach to Process using ssh and debug the application. I run launch.json by calling "DebugAdapterHost.Launch /LaunchJson:"launch.json" /EngineGuid:541B8A8A-6081-4506-9F0A-1CE771DEBC04". I have turned DebugAdapterHost logging on, and dump output is below. From the log output the plink connection appears to connect, and vsdbg starts, but then fails with the "launch: program '' does not exist." message.

launch.json

{
  "version": "0.2.0",
  "adapter": "C:\\Program Files\\PuTTY\\plink.exe",
  "adapterArgs": "-i ssh-key.ppk debian@10.1.1.206 -batch -T ~/vsdbg/vsdbg --interpreter=vscode",
  "configurations": [
    {
      "name": "Remote @ 10.1.1.206",
      "type": "coreclr",
      "cwd": "/home/debian/SCIProg",
      "args": [],
      "program": "/home/debian/SCIProg/SCIProg.dll",
      "request": "launch"      
    }
  ]
}

Dump output

 1> DebugAdapterHost version: 17.4.60824.2 commit:8f4cb8b63aaa8b4b64f8bc0920832bedc7dd4832
 1> State: Unset => Initializing
 1> Sending VS event: IDebugEngineCreateEvent2 (fe5b734c-759d-4e59-ab04-f103343bdd06)
 1> Sending VS event: IDebugProgramCreateEvent2 (96cd11ee-ecd4-4e89-957e-b5d496fc4139)
 1> Starting 'C:\Program Files\PuTTY\plink.exe' with arguments '-i ssh-key.ppk debian@10.1.1.206 -batch -T ~/vsdbg/vsdbg --interpreter=vscode'
 1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"coreclr","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},"seq":1}
 1> WARNING: Request 'initialize-1' has not received a response within 1000 ms!
 1> [DebugAdapter] <--   R (initialize-1) [1738 ms]: {"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"All Exceptions","description":"Break when an exception is thrown. ","default":false,"supportsCondition":true},{"filter":"user-unhandled","label":"User-Unhandled Exceptions","description":"Break when an exception is caught in non-user code (system code) after having passed through user code. ","default":true,"supportsCondition":true}],"supportsSetVariable":true,"supportsGotoTargetsRequest":true,"supportsModulesRequest":true,"additionalModuleColumns":[{"attributeName":"vsLoadAddress","label":"Load Address","type":"string"},{"attributeName":"vsPreferredLoadAddress","label":"Preferred Load Address","type":"string"},{"attributeName":"vsModuleSize","label":"Module Size","type":"number"},{"attributeName":"vsLoadOrder","label":"Order","type":"number"},{"attributeName":"vsTimestampUTC","label":"Timestamp","type":"unixTimestampUTC"},{"attributeName":"vsIs64Bit","label":"64-bit","type":"boolean"},{"attributeName":"vsAppDomain","label":"AppDomain","type":"string"},{"attributeName":"vsAppDomainId","label":"AppDomainId","type":"number"}],"supportedChecksumAlgorithms":["MD5","SHA1","SHA256"],"supportsExceptionOptions":true,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsSetExpression":true,"supportsReadMemoryRequest":true,"supportsCancelRequest":true,"supportsExceptionFilterOptions":true,"supportsExceptionConditions":true,"supportsLoadSymbolsRequest":true,"supportsModuleSymbolSearchLog":true,"supportsDebuggerProperties":true,"supportsSetSymbolOptions":true,"supportsHitBreakpointIds":true,"supportsVsIndividualBreakpointOperations":true,"supportsVsBreakpointLanguage":true,"supportsSetHitCount":true,"supportsVsCustomMessages":true,"supportsEvaluationOptions":true,"supportsExceptionStackTrace":true,"memoryReferencesAreAddresses":true,"supportsObjectFavorites":true,"supportsObjectId":true,"supportsVariableEnumerators":true},"seq":1}
 1> Sending VS event: IDebugEngineMetricsUpdatedEvent166 (45b79d58-0620-410f-8f39-c7c8c155e36c)
 1> [DebugAdapter] --> C (launch-2): {"type":"request","command":"launch","arguments":{"name":".NET Core Launch 10.1.1.206","type":"coreclr","cwd":"~/SCIProg","args":[],"program":"SCIProg.dll","request":"launch"},"seq":2}
 1> [DebugAdapter] <--   C (handshake-2): {"type":"request","command":"handshake","arguments":{"value":"zJoylcOcMStAhoPaiG+G7oOEIMsHiX30zhcffPeG8/4="},"seq":2}
 1> [DebugAdapter] --> R (handshake-2): {"type":"response","request_seq":2,"success":true,"command":"handshake","body":{"signature":"243mvbEPjpHYJ7KsGwevbmZ6gPEI9tGp81gdOi51oKHkpI="},"seq":3}
 1> [DebugAdapter] <--   E (output): {"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n","severity":"ok"},"seq":3}
 1> Sending VS event: IDebugMessageEvent2 (3bdb28cf-dbd2-4d24-af03-01072b67eb9e)
 1> [DebugAdapter] <--   E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/LaunchFailed","data":{"VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"10","VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"debian","VS.Diagnostics.Debugger.vsdbg.ErrorCode":1002,"VS.Diagnostics.Debugger.vsdbg.Version":"17.6.10208.1 commit:e3225483cd173944b74f30a50c6625a0ce60dfa5","VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux"}},"seq":4}
 1> [DebugAdapter] <--   R (launch-2) [39 ms]: {"type":"response","request_seq":2,"success":false,"command":"launch","message":"launch: program '' does not exist.","seq":5}
 1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

Aggregate exception: 
    DebugAdapterLaunchException: Failed to launch debug adapter.  Additional information may be available in the output window.

    Failure Location: LaunchRequest
    Inner Exception: 
        ProtocolException: launch: program '' does not exist.
Inner Exception: 
    DebugAdapterLaunchException: Failed to launch debug adapter.  Additional information may be available in the output window.

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.DebuggedProcess.<StartDebugAdapter>b__115_3(Exception ex)
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>c__DisplayClass11_0`1.<Catch>b__0(TException ex)
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>c__DisplayClass10_0`1.<Catch>b__0(AggregateException ex)

    Failure Location: LaunchRequest
    Inner Exception: 
        ProtocolException: launch: program '' does not exist.

 1> ERROR: One or more errors occurred.

Failed to launch debug adapter.  Additional information may be available in the output window.

launch: program '' does not exist.
 1> Sending VS event: IDebugErrorEvent2 (fdb7a36c-8c53-41da-a337-8bd86b14d5cb)
 1> State: Initializing => Exiting
 1> State: Exiting => Exited
 1> Sending VS event: IDebugProgramDestroyEvent2 (e147e9e3-6440-4073-a7b7-a65592c714b5)
 1> [DebugAdapter] <--   E (initialized): {"type":"event","event":"initialized","body":{},"seq":6}
 1> WARNING: Ignoring event of type 'initialized' received after moving to 'Exited' state!
 1> Debug adapter process exited.
gregg-miskelly commented 1 year ago

I believe your problem is you want $adapter and $adapterArgs.

robertturner commented 1 year ago

I believe your problem is you want $adapter and $adapterArgs.

Sorry I'm confused, where do I want those? Under configurations? What needs editing for it to work?

gregg-miskelly commented 1 year ago

In your launch.json above, you are using adapter and adapterArgs without a $. I am almost certain you need a $.

amehra-ni commented 8 months ago

@robertturner Were you able to resolve it? If yes, how? I'm also getting a similar error.