qsharp-compiler
qsharp-compiler copied to clipboard
Deprecation warning during command line installation of VS Code Q# extension
When the Visual Studio Code extension is installed using the command line, the following warning is shown:
PS > code --install-extension .\quantum-devkit-vscode-0.18.2108160999.vsix
Installing extensions...
(node:33076) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'quantum-devkit-vscode-0.18.2108160999.vsix' was successfully installed.
(node:33076) UnhandledPromiseRejectionWarning: Canceled: Canceled
at D (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:5:1157)
at O.cancel (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:9:62880)
at O.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:9:63012)
at N.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:9:63274)
at d (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:3655)
at N.clear (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:4133)
at N.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:4112)
at dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:4672)
at dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:11:7330)
at d (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:3655)
at AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:3843
at AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:3942
at Object.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:762)
at d (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:3788)
at AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:14:41520
at Map.forEach (<anonymous>)
at Ne.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:14:41496)
at d (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:3655)
at N.clear (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:4133)
at N.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:4112)
at S.dispose (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:6:4672)
at Object.M [as main] (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:17:38649)
at async N (AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:12:13842)
(node:33076) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:33076) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This warning does not prevent the installation to succeed, and the extension can be used normally after that. It is also possible to install the extension using the UI in VS Code without seeing any warnings.
This is still present in version 0.18.2108.160999 of the QDK.
The “DeprecationWarning: Buffer() is deprecated…” warning is also mentioned in these VS Code Issues: https://github.com/microsoft/vscode/issues/123180 https://github.com/microsoft/vscode/issues/127182 https://github.com/microsoft/vscode/issues/74438 https://github.com/microsoft/vscode/issues/65088 https://github.com/Microsoft/vscode/issues/67534 https://github.com/Microsoft/vscode/issues/68044 https://github.com/microsoft/vscode/issues/68159
I created a minimal “Hello World” VS Code extension, per Your First Extension, then made these changes to eliminate warnings and errors reported by vsce:
- Added a publisher name in package.json as Line 6: "publisher": "v-wjones",
- Added a repository name in package.json as Line 7: "repository": "C:/Users/v-wjones/OneDrive - Microsoft/Documents/experimentalextension",
- Deleted all but the first line of README.md
I then packaged the extension to a vsix file using vsce:
PS C:\Users\v-wjones\OneDrive - Microsoft\Documents\experimentalextension> vsce package
Executing prepublish script 'npm run vscode:prepublish'...
> [email protected] vscode:prepublish
> npm run compile
> [email protected] compile
> tsc -p ./
DONE Packaged: C:\Users\v-wjones\OneDrive - Microsoft\Documents\experimentalextension\experimentalextension-
0.0.1.vsix (6 files, 2.94KB)
Finally, I installed the extension using a VS Code Terminal window, and got the same warning:
PS C:\Users\v-wjones\OneDrive - Microsoft\Documents\experimentalextension> code --install-extension
.\experimentalextension-0.0.1.vsix
Installing extensions...
(node:8732) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use
the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'experimentalextension-0.0.1.vsix' was successfully installed.
Based on this evidence, I believe this issue is not a bug in the quantum-devkit-vscode extension. Should we pass this back to the vscode team?
Agreed. Contacting the VS Code team for feedback.
Tagging Isidor - PM on the VS Code team to take it forward. @isidorn
I have commented on the vscode issue, let's continue the discussion there microsoft/vscode#133062 Thanks!