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

Wrong command being executed for keybinding #54378

Closed
DanTup opened this issue Jul 16, 2018 · 47 comments
Closed

Wrong command being executed for keybinding #54378

DanTup opened this issue Jul 16, 2018 · 47 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Jul 16, 2018

Two users of Dart Code have reported this issue but I'm stuck on how to troubleshoot.

We keybind Ctrl+F5 in Dart Code to the "Flutter: Hot Reload" with a condition of inDebugMode && flutterProejctLoaded. The default Ctrl+F5 provided by VS Code has a condition of !inDebugMode so there should be no conflict.

Here's a screenshot of the keybinds for Ctrl+F5:

screen shot 2018-07-16 at 8 46 05 am

However, when these users press Ctrl+F5 during a debug session, they see this error:

screen shot 2018-07-16 at 8 46 43 am

This error comes from Code, and I presume it's because it's invoking "Start Without Debugging" (the keybind when not debugging). However, the orange status bar (and that they're trying to hot reload) suggests they are indeed in a debug session. Invoking our command from the palette works fine, so I don't think there's an issue with our command.

I don't know if this is a VS Code issue, but if not, I'm hoping for some ideas on how to track down what's happening.

@isidorn
Copy link
Contributor

isidorn commented Jul 16, 2018

@DanTup thanks for finding this. I have pushed a potential fix, you can try it out in tomorrow insiders and let us know if the issue is fixed for you.
If not, please put a breakpoint here and check if it gets hit when you ctrl + F5

@isidorn isidorn added the bug Issue identified by VS Code Team member as probable bug label Jul 16, 2018
@isidorn isidorn added this to the July 2018 milestone Jul 16, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Jul 16, 2018

Great, thanks! I was never able to repro it, do you know what might have triggered it so that I might be able to test it myself (this may be easier if the users don't have/wan't to grab Insiders).

@isidorn
Copy link
Contributor

isidorn commented Jul 16, 2018

@DanTup something like this:

  • start debugging
  • have an empty debug console
  • stop debugging
  • ctrl + F5

@DanTup
Copy link
Contributor Author

DanTup commented Jul 17, 2018

@isidorn Following those instructions I ended up in a debug session, but the status bar is still blue (not orange). Ctrl+F5 actually works correctly (calls our command).

In the issue reported, the users have an orange status bar but Ctrl+F5 is trying to start a debug session. I think this might be a different issue?

@isidorn
Copy link
Contributor

isidorn commented Jul 17, 2018

@DanTup can you check with the user if he can repro with the latest insiders - if he can then we will for sure know this is not fixed.
I was only speculating about steps.

@DanTup
Copy link
Contributor Author

DanTup commented Jul 17, 2018

@isidorn Got a response here. Seems to do something different, but not what was expected - seems to have restarted without debugging.

@DanTup
Copy link
Contributor Author

DanTup commented Jul 18, 2018

The other user reports no change here.

isidorn added a commit that referenced this issue Jul 20, 2018
@isidorn
Copy link
Contributor

isidorn commented Jul 20, 2018

@DanTup ok. I have simplified how we are computing debug contexts. Please try it out in tomorrows insiders. If it still does not work then please verify

  1. Does your hot restart command get triggered?
  2. Does the Start Without Debugging get triggered (put a breakpoint here)
  3. If a wrong command is triggered we need to figure out why the contexts are not correct. For that put breakpoints here and check what is the last value that context is set to

@DanTup
Copy link
Contributor Author

DanTup commented Jul 21, 2018

Thanks; will get them to try again and see what we can find.

@SteveAlexander
Copy link

@DanTup pointed me here

  1. Does your hot restart command get triggered?
    I presume the answer here is no (you don't see a message in the Debug Console saying we hot reloaded, even though the error appeared?)

Correct, no message in the Debug Console.

Does the Start Without Debugging get triggered (put a breakpoint here)
I'm sure the answer to this is yes, since that message is appearing, but it's worth putting a breakpoint there to verify (see below).

Yes, that breakpoint gets triggered.

If a wrong command is triggered we need to figure out why the contexts are not correct. For that put breakpoints here and check what is the last value that context is set to

I'm not sure what variable or value to report back here. Can you be specific about what variable or field I should be looking at?

Thanks

@isidorn
Copy link
Contributor

isidorn commented Jul 24, 2018

@SteveAlexander do a stateLabel check and let me know what is the last value there before you try executing the hot reload. Thanks for help.

@SteveAlexander
Copy link

Okay, this is on Insiders
dae69db
2018-07-27T05:05:45.350Z

Sequence of events:
I set up the second breakpoint, line 560 of debugService.ts
I hit F5 "Start Debugging"
Breakpoint hit. stateLabel = "Initializing"
Breakpoint hit. stateLabel = "Running"
I wait until the Flutter application is running in the iPhone simulator.
I hit ctrl+F5
See error message "There is already a debug configuration of "Flutter" running"
hit red square "stop debugging" control with mouse
Breakpoint hit. stateLabel = "Initializing"
Breakpoint hit. stateLabel = "Inactive"
errror message "Cannot read property "end" of undefined"

Interestingly, the "Flutter: Hot Restart ^F5" entry was not present in the command palette on Insiders. I tried uninstalling and reinstalling the Flutter extension, and it still wasn't there.

On my VSC release version, the command is there.

@isidorn
Copy link
Contributor

isidorn commented Jul 30, 2018

@SteveAlexander I pushed a fix for this, can you please try tomorrow's vscode insiders and let us know if it still repros. Thanks a lot

@SteveAlexander
Copy link

@isidorn just tried with 0707dd4 (2018-07-31T05:05:43.344Z), and still seeing the problem. Perhaps I need to wait for a later build?

@marc1161
Copy link

marc1161 commented Aug 1, 2018

I have the same problem... Trying to debug and the first time it's working but when I restart the debug it says i already have a debug configuration running...

@DanTup
Copy link
Contributor Author

DanTup commented Aug 1, 2018

@marc1161 Out of curiosity, is this with Dart/Flutter or something else?

@marc1161
Copy link

marc1161 commented Aug 1, 2018

@DanTup is with Golang

@andre-paris
Copy link

It's happening to me too, but with Golang.

@isidorn isidorn reopened this Aug 1, 2018
@isidorn isidorn modified the milestones: July 2018, August 2018 Aug 2, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Aug 22, 2018

I could never repro this, so can't test. @momoadeli can you confirm it's good in the latest Insiders?

@SteveAlexander
Copy link

I just tested with the latest insiders.

I'm still seeing the problem. Perhaps we should re-open this?

Version 1.27.0-insider (1.27.0-insider)
e0a6826
2018-08-22T05:06:02.002Z

@momoadeli
Copy link

@DanTup I am still seeing error on my updated VSCode (Version 1.26.1 ...can't mess with 'insiders' right now-- @SteveAlexander does see issue in insiders. ).
Again, all i need to do is add previously mentioned attributes to 'configurations' in launch.json. Problem immediately occurs. @isidorn

Mo

@isidorn isidorn reopened this Aug 23, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Aug 23, 2018

@momoadeli I did try many things to repro with your steps without success. If you can open a clean VS Code instance and run Dart: Capture Logs and then repro and send me the logs, it might help me identify what's different.

@isidorn
Copy link
Contributor

isidorn commented Aug 27, 2018

There is a good chance it is a duplicate of #57255
Can you try in Tuesday insiders.

I appologize for asking you to try it out many times since I do not have nice repro steps on my machine I can not verify it mystelf.

@momoadeli
Copy link

@DanTup @isidorn Sorry for delay. I have the Dart log capture attached. I also have a short screen recording (QuickTime) I believe is helpful which I'm unable to attach here. I can share any way you suggest.

Also, this is VS Version 1.26.1 (not insiders):
Dart-Code-Log-2018-07-01 16-04.txt

@DanTup
Copy link
Contributor Author

DanTup commented Aug 28, 2018

@momoadeli This log files seems to stop during the application launch:

[16:04:47 GMT-0400 (EDT)] [FlutterRun] [Info] <== [{"event":"app.debugPort","params":{"appId":"b78d1a0d-91f9-4522-b3f1-e0a9ce108537","port":52728,"wsUri":"ws://127.0.0.1:52728/ws","baseUri":"file:///Users/megabyzus_mbp/Library/Developer/CoreSimulator/Devices/93BABE77-7991-4670-B4C5-A0391EC6DF37/data/Containers/Data/Application/E9FB9F81-25DC-4654-9E1E-3BF3A2F990F5/tmp/academind_udmy_flutter_aug_2018_courseaJ9EVV/academind_udmy_flutter_aug_2018_course/"}}]
Mon Aug 27 2018 [16:04:47 GMT-0400 (EDT)] Log file ended

It's worth first checking if it's fixed in Insiders, since if so, we don't need to dig into it. Otherwise, it'd be useful to see a more complete log. I presume that this message is only seen the second time you try to launch a session, so the following steps should be a useful log:

  • Open VS Code
  • Start logging (you can untick Analyzer to reduce the size of the log, it's a bit spammy here)
  • Run a debug session (the one I presume works)
  • Try to run a second debug session (which shows the error)
  • Stop the log (give it at least 5-10 secs before clicking Stop just to reduce chances of cutting off anything in-progress)

I'm particularly interested in the log for the shutting down of the first debug session. We do log a reasonable amount of things in the disconnect request, so if something isn't working correctly there, hopefully it'll show up. I'm curious what's different for you than me.

@momoadeli
Copy link

@DanTup upgraded to Version 1.27.0 (1.27.0). Problem still there. I assume this is NOT the 'insiders' version you're referring to?

@DanTup
Copy link
Contributor Author

DanTup commented Sep 6, 2018

@momoadeli I'm not sure, I don't work on Code. Maybe @weinand can confirm if the fix from #57255 is expected in 1.27 (I would've thought so).

Also, a full log would still be useful - the one you previously attached seemed to be incomplete.

@weinand weinand modified the milestones: On Deck, September 2018 Sep 6, 2018
@weinand
Copy link
Contributor

weinand commented Sep 6, 2018

The fix for #57255 definitely fixed the issue I was seeing (which was unrelated to this issue).

above @isidorn said:

There is a good chance it is a duplicate of #57255

So let's assume that this issue is not a duplicate of #57255 then.

@DanTup
Copy link
Contributor Author

DanTup commented Sep 6, 2018

@momoadeli I did make some changes to some termination code recently - could you try with v2.18.1 Beta 1 to see if you still see the issue:

https://github.com/Dart-Code/Dart-Code/releases/tag/v2.18.1-beta.1

Download the .vsix file and then run the Extensions: Install from VSIX command in VS Code, select to the vsix and then click the Reload button when the prompt appears.

If it still repros, a log file (using Dart: Capture Logs and included Observatory + Flutter Run) would definitely still be useful.

@momoadeli
Copy link

momoadeli commented Sep 6, 2018

@DanTup, issue persists. I installed v2.18.1-beta.1 and followed your instructions. I see the first/Android launch mentioned in the log but I don't see the second/iPhoneX session mentioned, although I clicked on it. As mentioned before, this works without configuration attributes added in launch.json.

I also want to note I am working without it currently and it hasn't stopped my progress, so hopefully this hasn't created pressures for you. Attached is the capture log:
Dart-Code-Log-2018-08-04 15-28.txt
Many Thanks.

@DanTup
Copy link
Contributor Author

DanTup commented Sep 7, 2018

Thanks for testing. I'm not surprised the second debug session doesn't appear in the logs (since based on the message, I don't think Code is trying to start it), though it looks like you may have not included the Observatory log category - which is the bit I was mostly interested (specifically to see the shutdown code). Is it possible you can re-do and ensure both Flutter Run and Observatory are ticked for the log?

@DanTup
Copy link
Contributor Author

DanTup commented Sep 19, 2018

I don't know if it's the same issue as this, but I was just trying to set a command up to use Ctrl+Shift+F5 when not debugging. However, whenever I press that keybinding it starts a debug session. I believe it's running the Restart Debugging keybind:

screen shot 2018-09-19 at 8 51 38 am

However that one has inDebugMode on it and I am not in debug mode :/

@DanTup
Copy link
Contributor Author

DanTup commented Sep 19, 2018

Scratch that last comment - I had a typo which meant my keybinding wasn't valid. Seems to work as expected with that fixed. I think maybe Cmd+Shift+F5 is triggering Start Debugging when Restart is not valid.

@isidorn
Copy link
Contributor

isidorn commented Sep 26, 2018

Ok people this sounds a lot like an issue I fixed yesterday #59331
One last time I would kindly ask if you can still repro with latest insiders if yes then I would need a volunteer for a skype debugging session so we fix this.
Thanks a lot!

@isidorn isidorn added the info-needed Issue requires more information from poster label Sep 26, 2018
@bpasero bpasero modified the milestones: September 2018, October 2018 Sep 27, 2018
@vscodebot vscodebot bot closed this as completed Oct 4, 2018
@vscodebot
Copy link

vscodebot bot commented Oct 4, 2018

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@isidorn
Copy link
Contributor

isidorn commented Oct 9, 2018

Dup of #60191
Fixed in tomorrows insiders

@chrmarti chrmarti added the *duplicate Issue identified as a duplicate of another issue(s) label Nov 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 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 *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests