Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Run" button in vscode not working when using latest dart (dev) sdk. #52222

Closed
mmcdon20 opened this issue Apr 29, 2023 · 8 comments
Closed

"Run" button in vscode not working when using latest dart (dev) sdk. #52222

mmcdon20 opened this issue Apr 29, 2023 · 8 comments
Assignees
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. dds-dap DDS issues related to the Debug Adapter Protocol (DAP) implementation pkg-dds For issues related to the Dart Development Service type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@mmcdon20
Copy link

Dart SDK version: 3.1.0-56.0.dev (dev) (Fri Apr 28 13:05:51 2023 -0700) on "windows_x64"

I'm not sure if this is the right place to report an issue relating to vscode, but when you click on "Run" (where it says "Run | Debug" above main), vscode just stalls and the program never actually runs.

run

The button works correctly with a dart 2.19.x sdk, and also the "Debug" button works even in the latest dev SDK, and typing dart bin/hello.dart from the console works as well.

@mraleph
Copy link
Member

mraleph commented May 1, 2023

@DanTup coud you take a look?

@mraleph
Copy link
Member

mraleph commented May 1, 2023

This might need to be moved to VSCode repo unless this is actually an SDK problem.

@DanTup
Copy link
Collaborator

DanTup commented May 1, 2023

@mmcdon20 I don't seem to be able to reproduce this (using Windows and the same dev SDK) with either release or pre-release versions of the Dart extension.

Could you confirm:

  • whether your project has a pubspec.yaml (if so, please post a copy)
  • whether there are any errors in the Console tab if you click Help -> Toggle Developer Tools in VS Code

Could you you also capture a log:

  • Run the Dart: Capture Debugging Logs command
  • Click the Run button to trigger the issue
  • Wait for at least 10 seconds
  • Click Cancel on the logging notification to stop logging and open the log
  • Remove anything sensitive from the log
  • Attach the log here (or in a gist)

I'm not sure whether it's a Dart-Code issue or not. It's possible it could be a Debug Adapter issue (we're migrating to new debug adapters that live here in pkg:dds). With a log file it might be clearer where this issue belongs.

Thanks!

@mmcdon20
Copy link
Author

mmcdon20 commented May 1, 2023

pubspec.yaml

name: experiment
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo

environment:
  sdk: ^3.1.0-56.0.dev

# Add regular dependencies here.
dependencies:
  # path: ^1.8.0

dev_dependencies:
  lints: ^2.0.0
  test: ^1.21.0

Console tab

console

Dart: Capture Debugging Logs

!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.62.0
Flutter extension: 3.62.0 (not activated)

App: Visual Studio Code
Version: 1.77.3
Platform: win

Workspace type: Dart
Analyzer type: LSP
Multi-root?: false

Dart SDK:
    Loc: C:\src\flutter\bin\cache\dart-sdk
    Ver: 3.1.0-56.0.dev
Flutter SDK:
    Loc: C:\src\flutter
    Ver: 3.10.0-17.0.pre.29

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    General, AnalyzerTiming, CommandProcesses, DartTest, DAP, VmService, DevTools, FlutterDaemon, FlutterRun, FlutterTest, WebDaemon

Mon May 01 2023 [10:48:43 GMT-0500 (Central Daylight Time)] Log file started
[10:48:47 AM] [General] [Info] Starting debug session...
[10:48:47 AM] [General] [Info]     workspace: C:\Users\mmcdo\Desktop\experiment
[10:48:47 AM] [General] [Info]     program  : C:\Users\mmcdo\Desktop\experiment\bin\hello.dart
[10:48:47 AM] [General] [Info] Setting cwd based on likely entry point: C:\Users\mmcdo\Desktop\experiment
[10:48:47 AM] [General] [Info] Using workspace as cwd: C:\Users\mmcdo\Desktop\experiment
[10:48:47 AM] [General] [Info] Detected launch project as Dart
[10:48:47 AM] [General] [Info] Using Dart debug adapter for this session
[10:48:47 AM] [General] [Info] Checking for errors before launching
[10:48:47 AM] [General] [Info] Debug session starting...
    {
        "name": "Dart ",
        "noDebug": true,
        "request": "launch",
        "type": "dart",
        "program": "C:\\Users\\mmcdo\\Desktop\\experiment\\bin\\hello.dart",
        "dartCodeDebugSessionID": "session-cd6c5",
        "cwd": "C:\\Users\\mmcdo\\Desktop\\experiment",
        "toolEnv": {
            "FLUTTER_HOST": "VSCode",
            "PUB_ENVIRONMENT": "vscode.dart-code"
        },
        "sendLogsToClient": true,
        "sendCustomProgressEvents": true,
        "additionalProjectPaths": [
            "C:\\Users\\mmcdo\\Desktop\\experiment"
        ],
        "args": [],
        "vmAdditionalArgs": [],
        "toolArgs": [
            "--enable-asserts"
        ],
        "vmServicePort": 0,
        "dartSdkPath": "C:\\src\\flutter\\bin\\cache\\dart-sdk",
        "maxLogLineLength": 2000,
        "debugSdkLibraries": false,
        "debugExternalPackageLibraries": false,
        "showDartDeveloperLogs": true,
        "evaluateGettersInDebugViews": true,
        "evaluateToStringInDebugViews": true,
        "console": "debugConsole",
        "debuggerType": 0
    }
[10:48:47 AM] [General] [Info] Using dart debugger for Dart
[10:48:47 AM] [General] [Info] SDK DAP setting is true, set by canDefaultToSdkDap and using pre-release SDK
[10:48:47 AM] [General] [Info] Running SDK DAP Dart VM in undefined: C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe debug_adapter and options {"env":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[10:48:47 AM] [DAP] [Info] Starting debug session 7f99a26c-3872-4da9-aec0-2a3cde4b1cc8
[10:48:47 AM] [DAP] [Info] ==> {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"dart","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}
[10:48:47 AM] [DAP] [Info] <== {"seq":2,"type":"event","body":{},"event":"initialized"}
[10:48:47 AM] [DAP] [Info] <== {"seq":1,"type":"response","body":{"exceptionBreakpointFilters":[{"default":false,"filter":"All","label":"All Exceptions"},{"default":true,"filter":"Unhandled","label":"Uncaught Exceptions"}],"supportsClipboardContext":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDelayedStackTraceLoading":true,"supportsEvaluateForHovers":true,"supportsLogPoints":true,"supportsRestartRequest":false,"supportsTerminateRequest":true,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":1,"success":true}
[10:48:47 AM] [DAP] [Info] ==> {"command":"threads","type":"request","seq":2}
[10:48:47 AM] [DAP] [Info] ==> {"command":"launch","arguments":{"name":"Dart ","noDebug":true,"request":"launch","type":"dart","program":"C:\\Users\\mmcdo\\Desktop\\experiment\\bin\\hello.dart","dartCodeDebugSessionID":"session-cd6c5","cwd":"C:\\Users\\mmcdo\\Desktop\\experiment","toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"},"sendLogsToClient":true,"sendCustomProgressEvents":true,"additionalProjectPaths":["C:\\Users\\mmcdo\\Desktop\\experiment"],"args":[],"vmAdditionalArgs":[],"toolArgs":["--enable-asserts"],"vmServicePort":0,"dartSdkPath":"C:\\src\\flutter\\bin\\cache\\dart-sdk","maxLogLineLength":2000,"debugSdkLibraries":false,"debugExternalPackageLibraries":false,"showDartDeveloperLogs":true,"evaluateGettersInDebugViews":true,"evaluateToStringInDebugViews":true,"console":"debugConsole","debuggerType":0,"__sessionId":"7f99a26c-3872-4da9-aec0-2a3cde4b1cc8"},"type":"request","seq":3}
[10:48:47 AM] [DAP] [Info] <== {"seq":3,"type":"response","body":{"threads":[]},"command":"threads","request_seq":2,"success":true}
[10:49:21 AM] [DAP] [Info] ==> {"command":"terminate","arguments":{"restart":false},"type":"request","seq":4}
[10:49:21 AM] [DAP] [Info] <== {"seq":4,"type":"response","command":"terminate","request_seq":4,"success":true}
[10:49:21 AM] [DAP] [Info] <== {"seq":5,"type":"event","body":{"output":"\nExited."},"event":"output"}
[10:49:21 AM] [DAP] [Info] <== {"seq":6,"type":"event","body":{},"event":"terminated"}
[10:49:21 AM] [DAP] [Info] ==> {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":5}
[10:49:21 AM] [DAP] [Info] <== {"seq":7,"type":"response","command":"disconnect","request_seq":5,"success":true}
[10:49:21 AM] [DAP] [Info] Debug session 7f99a26c-3872-4da9-aec0-2a3cde4b1cc8 errored: {}
[10:49:21 AM] [DAP] [Info] Stopping debug session 7f99a26c-3872-4da9-aec0-2a3cde4b1cc8
[10:49:21 AM] [DAP] [Info] Debug session 7f99a26c-3872-4da9-aec0-2a3cde4b1cc8 exit: code: 1, signal: undefined
Mon May 01 2023 [10:49:22 GMT-0500 (Central Daylight Time)] Log file ended

@DanTup
Copy link
Collaborator

DanTup commented May 1, 2023

@mmcdon20 thanks - unfortunately not much helpful there. It seems like nothing happens after VS Code sends the request to launch.

Can you confirm that when you're running dart bin\hello.dart you're using the same version of Dart being picked up here (from C:\\src\\flutter\\bin\\cache\\dart-sdk\\bin\\dart.exe)? Eg. does everything work if you do:

cd C:\Users\mmcdo\Desktop\experiment
C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe --enable-asserts bin\hello.dart

Also - I don't suppose you can easily switch back to the 2.19 SDK where this worked and capture the same log as above? It'd be interesting to know if the version where it worked was using the new SDK DAPs or whether you were on the legacy DAPs (this might help understand if it's a regression in the new DAPs, or there's something that has always failed in your environment here).

@mmcdon20
Copy link
Author

mmcdon20 commented May 1, 2023

It works fine from the command line.

command-line


I don't suppose you can easily switch back to the 2.19 SDK where this worked and capture the same log as above? ...

Not a problem, just have to switch to flutter stable channel, and make the following change in pubspec.yaml.

...
environment:
  sdk: ^2.19.6
...

Dart SDK version: 2.19.6 (stable) (Tue Mar 28 13:41:04 2023 +0000) on "windows_x64"

Dart: Capture Debugging Logs

!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.62.0
Flutter extension: 3.62.0 (not activated)

App: Visual Studio Code
Version: 1.77.3
Platform: win

Workspace type: Dart
Analyzer type: LSP
Multi-root?: false

Dart SDK:
    Loc: C:\src\flutter\bin\cache\dart-sdk
    Ver: 3.1.0-56.0.dev
Flutter SDK:
    Loc: C:\src\flutter
    Ver: 3.10.0-17.0.pre.29

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    General, AnalyzerTiming, CommandProcesses, DartTest, DAP, VmService, DevTools, FlutterDaemon, FlutterRun, FlutterTest, WebDaemon

Mon May 01 2023 [11:42:30 GMT-0500 (Central Daylight Time)] Log file started
[11:42:33 AM] [General] [Info] Starting debug session...
[11:42:33 AM] [General] [Info]     workspace: C:\Users\mmcdo\Desktop\experiment
[11:42:33 AM] [General] [Info]     program  : C:\Users\mmcdo\Desktop\experiment\bin\hello.dart
[11:42:33 AM] [General] [Info] Setting cwd based on likely entry point: C:\Users\mmcdo\Desktop\experiment
[11:42:33 AM] [General] [Info] Using workspace as cwd: C:\Users\mmcdo\Desktop\experiment
[11:42:33 AM] [General] [Info] Detected launch project as Dart
[11:42:33 AM] [General] [Info] Using Dart debug adapter for this session
[11:42:33 AM] [General] [Info] Checking for errors before launching
[11:42:33 AM] [General] [Info] Debug session starting...
    {
        "name": "Dart ",
        "noDebug": true,
        "request": "launch",
        "type": "dart",
        "program": "C:\\Users\\mmcdo\\Desktop\\experiment\\bin\\hello.dart",
        "dartCodeDebugSessionID": "session-97566",
        "cwd": "C:\\Users\\mmcdo\\Desktop\\experiment",
        "toolEnv": {
            "FLUTTER_HOST": "VSCode",
            "PUB_ENVIRONMENT": "vscode.dart-code"
        },
        "sendLogsToClient": true,
        "sendCustomProgressEvents": true,
        "additionalProjectPaths": [
            "C:\\Users\\mmcdo\\Desktop\\experiment"
        ],
        "args": [],
        "vmAdditionalArgs": [],
        "toolArgs": [
            "--enable-asserts"
        ],
        "vmServicePort": 0,
        "dartSdkPath": "C:\\src\\flutter\\bin\\cache\\dart-sdk",
        "maxLogLineLength": 2000,
        "debugSdkLibraries": false,
        "debugExternalPackageLibraries": false,
        "showDartDeveloperLogs": true,
        "evaluateGettersInDebugViews": true,
        "evaluateToStringInDebugViews": true,
        "console": "debugConsole",
        "debuggerType": 0
    }
[11:42:33 AM] [General] [Info] Using dart debugger for Dart
[11:42:33 AM] [General] [Info] SDK DAP setting is true, set by canDefaultToSdkDap and using pre-release SDK
[11:42:33 AM] [General] [Info] Running SDK DAP Dart VM in undefined: C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe debug_adapter and options {"env":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[11:42:33 AM] [DAP] [Info] Starting debug session 1a6ef9d7-3a33-4e99-9d6e-8b2cd8c73f93
[11:42:33 AM] [DAP] [Info] ==> {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"dart","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}
[11:42:33 AM] [DAP] [Info] <== {"seq":1,"type":"response","body":{"exceptionBreakpointFilters":[{"default":false,"filter":"All","label":"All Exceptions"},{"default":true,"filter":"Unhandled","label":"Uncaught Exceptions"}],"supportsClipboardContext":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDelayedStackTraceLoading":true,"supportsEvaluateForHovers":true,"supportsLogPoints":true,"supportsRestartRequest":false,"supportsTerminateRequest":true},"command":"initialize","request_seq":1,"success":true}
[11:42:33 AM] [DAP] [Info] <== {"seq":2,"type":"event","body":{},"event":"initialized"}
[11:42:33 AM] [DAP] [Info] ==> {"command":"launch","arguments":{"name":"Dart ","noDebug":true,"request":"launch","type":"dart","program":"C:\\Users\\mmcdo\\Desktop\\experiment\\bin\\hello.dart","dartCodeDebugSessionID":"session-97566","cwd":"C:\\Users\\mmcdo\\Desktop\\experiment","toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"},"sendLogsToClient":true,"sendCustomProgressEvents":true,"additionalProjectPaths":["C:\\Users\\mmcdo\\Desktop\\experiment"],"args":[],"vmAdditionalArgs":[],"toolArgs":["--enable-asserts"],"vmServicePort":0,"dartSdkPath":"C:\\src\\flutter\\bin\\cache\\dart-sdk","maxLogLineLength":2000,"debugSdkLibraries":false,"debugExternalPackageLibraries":false,"showDartDeveloperLogs":true,"evaluateGettersInDebugViews":true,"evaluateToStringInDebugViews":true,"console":"debugConsole","debuggerType":0,"__sessionId":"1a6ef9d7-3a33-4e99-9d6e-8b2cd8c73f93"},"type":"request","seq":2}
[11:42:33 AM] [DAP] [Info] ==> {"command":"configurationDone","type":"request","seq":3}
[11:42:34 AM] [DAP] [Info] <== {"seq":3,"type":"response","command":"configurationDone","request_seq":3,"success":true}
[11:42:34 AM] [DAP] [Info] ==> {"command":"threads","type":"request","seq":4}
[11:42:34 AM] [DAP] [Info] <== {"seq":4,"type":"response","command":"launch","request_seq":2,"success":true}
[11:42:34 AM] [DAP] [Info] <== {"seq":5,"type":"response","body":{"threads":[]},"command":"threads","request_seq":4,"success":true}
[11:42:34 AM] [DAP] [Info] <== {"seq":6,"type":"event","body":{"category":"stdout","output":"Hello world!\r\n"},"event":"output"}
[11:42:34 AM] [DAP] [Info] <== {"seq":7,"type":"event","body":{"output":"\nExited."},"event":"output"}
[11:42:34 AM] [DAP] [Info] <== {"seq":8,"type":"event","body":{},"event":"terminated"}
[11:42:34 AM] [DAP] [Info] ==> {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":5}
[11:42:34 AM] [DAP] [Info] <== {"seq":9,"type":"response","command":"disconnect","request_seq":5,"success":true}
[11:42:34 AM] [DAP] [Info] Stopping debug session 1a6ef9d7-3a33-4e99-9d6e-8b2cd8c73f93
[11:42:34 AM] [DAP] [Info] Debug session 1a6ef9d7-3a33-4e99-9d6e-8b2cd8c73f93 errored: {}
[11:42:34 AM] [DAP] [Info] Debug session 1a6ef9d7-3a33-4e99-9d6e-8b2cd8c73f93 exit: code: 1, signal: undefined
Mon May 01 2023 [11:42:36 GMT-0500 (Central Daylight Time)] Log file ended

@DanTup
Copy link
Collaborator

DanTup commented May 1, 2023

@mmcdon20 thanks! That log confirms you were running the new debug adapters when it worked, so this seems like a recent regression. It turns out I can reproduce this - I had mistakenly just grabbed the latest Dart SDK dev version from the dart website thinking that's what you'd used from the version, but you were on a newer SDK build rolled into Flutter's master channel.

I'll see what I can find. In the meantime, I think the beta channel is unaffected if it's convenient for you to use that until this is fixed.

@DanTup DanTup added area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) pkg-dds For issues related to the Dart Development Service dds-dap DDS issues related to the Debug Adapter Protocol (DAP) implementation labels May 1, 2023
@DanTup DanTup self-assigned this May 1, 2023
@DanTup
Copy link
Collaborator

DanTup commented May 2, 2023

I have a fix open at https://dart-review.googlesource.com/c/sdk/+/300601. It was a recent regression (a subtle change that affected the order of debug adapter events/responses), and doesn't affect the beta branches of either Dart or Flutter.

Once the bot closes this issue it'll be fixed in the bleeding-edge Dart builds, but it may take a little longer to get to Flutter (it needs to roll into flutter/engine and then flutter/flutter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. dds-dap DDS issues related to the Debug Adapter Protocol (DAP) implementation pkg-dds For issues related to the Dart Development Service type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants