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

Opening data viewer from 2+ scopes in a debug session fails with NameError: name '_VSCODE_VariableImport' is not defined #5627

Closed
joyceerhl opened this issue Apr 25, 2021 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@joyceerhl
Copy link
Contributor

joyceerhl commented Apr 25, 2021

This impacts all three debugging scenarios we currently support:

  1. In Run By Line with v2021.6.780948196:

rbl

  1. In interactive window debugging, you currently can't open the local variables from the variable explorer in the data viewer due to Variable explorer in interactive window debug session does not show locals #5626. It looks like we used to disable the variable explorer when debugging in the interactive window, though we don't anymore and I don't remember why: https://github.com/microsoft/vscode-python/blob/c08ef0be557ed697ef96bfe12b3820d7e4ac2e8e/package.nls.json#L456. But the same problem likely applies for opening variables from the variable explorer, and does apply when using the View Value in Data Viewer context menu option in the variables window:

iw_debugging

  1. In Python file debugging:

twobreakpoints

I don't think this is a regression, it looks like we have always evaluated the imports once per debug session in the topmost frame.

private async evaluate(code: string, frameId?: number): Promise<any> {
if (this.debugService.activeDebugSession) {
const results = await this.debugService.activeDebugSession.customRequest('evaluate', {
expression: code,
frameId: this.topMostFrameId || frameId,
context: 'repl'
});
if (results && results.result !== 'None') {
return results;
} else {
traceError(`Cannot evaluate ${code}`);
return undefined;
}
}
throw Error('Debugger is not active, cannot evaluate.');
}
private async importDataFrameScripts(notebook: INotebook): Promise<void> {
try {
const key = notebook.identity.toString();
if (!this.importedIntoKernel.has(key)) {
await this.evaluate(DataFrameLoading.DataFrameSysImport);
await this.evaluate(DataFrameLoading.DataFrameInfoImport);
await this.evaluate(DataFrameLoading.DataFrameRowImport);
await this.evaluate(DataFrameLoading.VariableInfoImport);
this.importedIntoKernel.add(key);
}
} catch (exc) {
traceError('Error attempting to import in debugger', exc);
}
}

@joyceerhl joyceerhl added the bug Issue identified by VS Code Team member as probable bug label Apr 25, 2021
@rchiodo rchiodo added this to the May 2021 Release milestone Apr 26, 2021
@rchiodo rchiodo removed this from the May 2021 Release milestone May 27, 2021
@IanMatthewHuff IanMatthewHuff self-assigned this Jun 10, 2021
@IanMatthewHuff
Copy link
Member

Validated. I used #3 python file as the validation. From what I see of the fix that should suffice. But if you want I can test the other two as well.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2021
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
Projects
None yet
Development

No branches or pull requests

3 participants