Skip to content

toString not work in Local Variables panel until all variables defined in scope #2254

Description

@pilaoda

Describe the bug

Image Image Image

To Reproduce
Debug this code:

class Password {
	constructor(value) {
		this.value = value;
	}
	toString() {
		return 'xxxxxxxx';
	}
}
const password1 = new Password('111');
console.log(password1);
const password2 = new Password('222');
console.log(password2);

-->
VS Code Version:
Version: 1.101.0 (system setup)
Commit: dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1
Date: 2025-06-11T15:00:50.123Z
Electron: 35.5.1
ElectronBuildId: 11727614
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Windows_NT x64 10.0.26100

Additional context
https://github.com/microsoft/vscode-js-debug/blob/113fa913357d5380e40911c8e964831a5dce29f0/src/adapter/templates/getStringyProps.ts#L43C2-L43C53
We should use Object.keys then try to access value instead of use Object.entries(this) directly.

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)bugIssue identified by VS Code Team member as probable bug

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions