question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong code file is executed when switching tab shortly after "Start Debugging"

See original GitHub issue

Environment data

  • VS Code version: 1.42.0-insider (7c0095)
  • Extension version (available under the Extensions sidebar): 2019.11.50794
  • OS and version: Windows 10 1909
  • Python version (& distribution if applicable, e.g. Anaconda): python.org, 3.8.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: none, I believe
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): irrelevant, I believe

Expected behaviour

I intend to Start Debugging on a.py

Actual behaviour

b.py is debugged.

Steps to reproduce:

I mainly notice this when using VS Code Remote SSH. Happens with Windows (via Insiders) or Linux servers. Client system is on Windows. I should say that my client system is rather slow, so terminal output takes several seconds to scroll while I am starting debugging.

  1. Create and open a.py [print(1)] and b.py [print(2)].
  2. Activate a.py tab
  3. Press F5 and immediately after that press Shift-Tab to activate b.py
  4. If you’re fast enough, b.py is started and 2 is printed, while 1 should be printed.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> python c:\Users\bersbersbers\.vscode-server-insiders\extensions\ms-python.python-2019.11.50794\pythonFiles\interpreterInfo.py
> python c:\Users\bersbersbers\.vscode-server-insiders\extensions\ms-python.python-2019.11.50794\pythonFiles\interpreterInfo.py
> python -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

console.ts:137 [Extension Host] Error Python Extension: 2020-01-04 19:50:31: Failed to create File hash for interpreter python [Error: ENOENT: no such file or directory, lstat 'C:\Users\bersbersbers\.vscode-server-insiders\bin\7c0095ee2d064033fc13184127a9adc603454729\python'] {  errno: -4058,  code: 'ENOENT',  syscall: 'lstat',  path: 'C:\\Users\\bersbersbers\\.vscode-server-insiders\\bin\\7c0095ee2d064033fc13184127a9adc603454729\\python'}
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
(anonymous) @ rpcProtocol.ts:101
fire @ event.ts:581
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:581
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:200
addChunk @ _stream_readable.js:294
readableAddChunk @ _stream_readable.js:275
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Info Python Extension: 2020-01-04 19:50:31: Cached data exists getEnvironmentVariables, <No Resource>
2console.ts:137 [Extension Host] Info Python Extension: 2020-01-04 19:50:31: > python c:\Users\bersbersbers\.vscode-server-insiders\extensions\ms-python.python-2019.11.50794\pythonFiles\interpreterInfo.py
log.ts:196   ERR TreeError [MarkersView] Tree element not found: [object Object]: Error: TreeError [MarkersView] Tree element not found: [object Object]
    at t.ObjectTreeModel.getElementLocation (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:134:704)
    at t.ObjectTreeModel.isCollapsed (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:133:842)
    at K.isCollapsed (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1058:208)
    at U.autoReveal (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:6127:205)
    at U.onActiveEditorChanged (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:6124:330)
    at file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:6123:162
    at file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:113:124
    at c.fire (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:116:740)
    at e.doHandleActiveEditorChangeEvent (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:5584:91)
    at e.handleActiveEditorChange (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:5583:836)
    at file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:5584:201
    at c.fire (file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:116:740)
    at file:///C:/Users/bersbersbers/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:5756:883
console.ts:137 [Extension Host] Info Python Extension: 2020-01-04 19:50:32: Cached data exists getEnvironmentVariables, c:\Src\cia
2console.ts:137 [Extension Host] Info Python Extension: 2020-01-04 19:50:32: > python -c "import sys;print(sys.executable)"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
bersbersberscommented, Jan 7, 2020

Alright, thanks for the explanation. I was suspecting that there must have been more to your argument than “I am too fast for my machine” 😃 I will accept this as a hard-to-solve architecture artifact and will use your proposed workaround. Thanks!

1reaction
karrtikrcommented, Jan 6, 2020

Unfortunately we can’t do much about it, as you’re faster than the machine. You could use "program": "${workspaceFolder}/b.py" if you want to run any specific files, closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix program errors and improve code - Visual Studio (Windows)
Press Alt+F11 (or select Analyze > Run Code Analysis on Solution from the top menu) to start static code analysis. Screenshot of the...
Read more >
Visual Studio Code debugger with Chrome refused to connect ...
It just starts the debugger. The solution for me (using yarn) was running "yarn serve" before starting the debugger. Maybe this is obvious!...
Read more >
Troubleshooting common PHP debugging issues | PhpStorm ...
Close all the dialogs and switch to the tab where the php.ini file is opened. In the php.ini, enable Xdebug logging by adding...
Read more >
Debugging in Visual Studio Code
To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and...
Read more >
Debugging in the browser - The Modern JavaScript Tutorial
Breakpoints · Quickly jump to the breakpoint in the code (by clicking on it in the right panel). · Temporarily disable the breakpoint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found