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

Debugger fails to launch when launch.json does not exist in Insiders build for Dart Code #43113

Closed
DanTup opened this issue Feb 7, 2018 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Feb 7, 2018

This might be a bug of mine, but this works in stable, but fails in Insiders.

You'll need a copy of the Dart SDK for the extension to activate correctly. If you don't want to install/add to PATH you can get a Windows zip from here (or others from this page) and then set the dart.sdkPath setting to point at the unzipped folder.

  1. Install the Dart Code extension or clone the repo and open and hit F5 to launch in extension dev host
  2. Create a new folder with a file at bin\main.dart with the following contents:
main() {
  print("Hello, world!");
}
  1. Press F5 and select Dart
  2. Nothing happens

In Stable, after selecting Dart it will create the launch.json (and the pressing F5 again will launch the debugger).

I believe an error is happening after calling my resolveDebugConfiguration, the source code for which is at https://github.com/Dart-Code/Dart-Code/blob/5d0c38b1b03d815a2516acfc008f3c7f8a9417b8/src/providers/debug_config_provider.ts#L48

@weinand

@DanTup
Copy link
Contributor Author

DanTup commented Feb 7, 2018

I tried with "All Exceptions" ticked, but it didn't seem to break on anything (even though if I breakpoint resolveDebugConfiguration then step out, I do seem to end up in exception handling code).

@DanTup
Copy link
Contributor Author

DanTup commented Feb 7, 2018

If I keep stepping, I end up here (which seems unexpected):

No handler

If I comment out the implementation of resolveDebugConfiguration it still fails in the same way.

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Feb 7, 2018
@weinand weinand added bug Issue identified by VS Code Team member as probable bug insiders labels Feb 7, 2018
@weinand
Copy link
Contributor

weinand commented Feb 7, 2018

In your package.json I do not see any debug related activationEvents.
Please add a "onDebug" and see whether this makes a difference.

@DanTup
Copy link
Contributor Author

DanTup commented Feb 7, 2018

@weinand No difference (though not all that surprised, the extension was definitely activated already, as I can step through resolveDebugConfiguration prior to it stopping).

@vscodebot vscodebot bot removed the insiders label Feb 7, 2018
@isidorn
Copy link
Contributor

isidorn commented Feb 7, 2018

Here's our chat on gitter which explains the issue. I have pushed a fix so the error propagets to the user, so this error is not so mysterious

Isidor Nikolic @isidorn 21:14
@DanTup the issue is that your configuration returned does not have a type field which is mandatory
@DanTup the issue on the vscode side is that we do not propogate this error properly

Danny Tuppeny @DanTup 21:14
@isidorn Hmmm, how does this work in stable?
just having a quick look

Isidor Nikolic @isidorn 21:15
@DanTup I probably refactored some code which was more error tolerant

Danny Tuppeny @DanTup 21:16
I do return a type from provideDebugConfigurations - isn't that what gets passed back in to resolveDebugConfiguration?
hmmm, I'm not even hitting breakpoints in my provideDebugConfigurations method now... seems wonky... just debugging

Isidor Nikolic @isidorn 21:18
@DanTup ok. I got it to work. In the setupDebugConfig if you add these lines, all will work nicely
debugConfig.type = "dart-cli";
debugConfig.request = "launch";
ok. So let's clarify something. ProvideDebugConfigurations is being called when the launch.json is getting genereated. And that works out of the box without any changes

Danny Tuppeny @DanTup 21:20
should provideDebugConfigurations be called before resolveDebugConfig? In stable right now, it doesn't seem to be for me (though I thought it should?)

Isidor Nikolic @isidorn 21:20
ResolveDebugConfigurations is being called when the configuarionts need resolving before we actually start debuging, and that is called when a user presses F5. That one is not working witouht my changes to your extension. The ResolveDebugConfiguations always needs to return a properly working launch configuration (which your extension was not doing)
ProvideDebugConfigurations is only called when the launch.json needs to be genereded. And just hitting F5 does not have to generate the launch.json, it can create the launch configuration on the fly

Danny Tuppeny @DanTup 21:22
Right, gotcha. So something changed that means resolveDebugConfig needs to explicitly set the type and request whereas it didn't before?

Isidor Nikolic @isidorn 21:23
That might have changed. I am not sure since this milestone is 2 months and we did a bunch of work. You can do some bisecting on our sources if you want to find the exact change.
The best thing to do IMHO would be to update your extension with the fixed ResolveDebugConfigurations call
Appologies if we broke your extension also. It was not on purpose.

@isidorn isidorn closed this as completed in 173af8f Feb 7, 2018
@isidorn isidorn added this to the February 2018 milestone Feb 7, 2018
@sbatten sbatten added the verified Verification succeeded label Mar 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants