vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Regression in vscode.workspaceConfiguration.Update: version 1.106.3 throws CodeExpectedError

Open thloke opened this issue 2 weeks ago • 0 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.106.3
  • OS Version: Microsoft Windows 11 Enterprise 10.0.26200 Build 26200

Steps to Reproduce:

  1. Create a new VSCode extension with a command that executes the following snippet:
		let workspacePath = '<valid VSCode workspace path>'; // for testing, I used a value similar to: c:\\Users\\username\\Documents\\AL\\TestCodeunits
		let config = vscode.workspace.getConfiguration(undefined, vscode.Uri.file(workspacePath));

		// Example debug configuration for a Business Central server
		let rawDebugConfig = '{"version":"0.2.0","configurations":[{"name":"Your own server","request":"launch","type":"al","environmentType":"OnPrem","server":"http://bcserver","serverInstance":"BC","authentication":"UserPassword","startupObjectId":22,"startupObjectType":"Page","breakOnError":"All","launchBrowser":true,"enableLongRunningSqlStatements":true,"enableSqlInformationDebugger":true,"tenant":"default","usePublicURLFromServer":true}]}';
		let debugConfig: vscode.DebugConfiguration = JSON.parse(rawDebugConfig);
		config.update('launch', debugConfig, vscode.ConfigurationTarget.WorkspaceFolder).then(() => {
			vscode.window.showInformationMessage('Config updated');
		});
  1. Launch the extension, and execute the command.
  2. See that it will fail with:
rejected promise not handled within 1 second: CodeExpectedError: Unable to write undefined because it is configured in system policy.
stack trace: CodeExpectedError: Unable to write undefined because it is configured in system policy.
    at Bkt.z (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3828:6793)
    at Bkt.F (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3828:9068)
    at Bkt.o (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3828:3874)
    at Object.factory (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3828:3774)
    at Qv.j (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:30:75974)
    at vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:30:75886
    at new Promise (<anonymous>)
    at Qv.queue (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:30:75828)
    at Bkt.writeConfiguration (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3828:3743)
    at cbn.Hb (vscode-file://vscode-app/c:/Users/<username>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3828:42702)

This does not fail in version 1.105.1. In that version, the launch.json is successfully created in the workspace.

This regression breaks core functionality of our AL Extension for VSCode offering because we rely on workspaceConfiguration.update to populate the launch.json file for a project if one does not exist.

thloke avatar Dec 10 '25 07:12 thloke