azure-tools-vscode
azure-tools-vscode copied to clipboard
Extension is overriding console... cannot debug other extensions with this one installed
It looks like this extension overloads console. what this means is that if I have this extension installed and I try to debug another extension that uses console.log statements, those statements are not sent to the debug console in vscode.
to repro:
- install this extension
- open vs code, open another extension project
- in that project, put a
console.logstatement in. F5to run app, hit code path that executes theconsole.logstatement
Result: no output in VS Code's Debug Console.
- uninstall this extension, restart VS Code
- load the extension project again
F5to run, execute code path withconsole.log
Result: Console log output is in the Debug Console.
actually, it looks like diagnostic-channel-publisher node module that is doing this.

@chrisdias do you have a proposed fix for this or is this no longer something this extension's to blame for? let me know if there's something i can fix here and we'll get it done.
no proposals other than removal of the offending lib?
@chrisdias i don't think i can remove it - it is a dependency of the app insights SDK package, which i'm using. Since i'm using that, i get this, and can't remove it. i think this is a question for the app insights team, unless it's something specific in the way i'm using their SDK. have any advice on a contact i could reach out to there?
Looks like the AppInsights SDK for Node.js (which the AzureRM Tools Extension uses) leverages the Zone.js module to instrument a lot of code in the extension host process. This is causing the PowerShell extension to fail when loading because Zone.js is hijacking fs.appendFile and their wrapper implementation is throwing an error that I don't see when the Azure extensions haven't been installed:

I was under the impression that extensions were sandboxed in different processes, but it appears that's not the case after all? At any rate, this module is causing trouble for other extensions so I think we need to find a way around this problem. I'll continue hacking around to see if I can find a solution on my side.
Managed to fix the issue on my side, apparently I was missing an argument in fs.appendFile and the in-box Node.js implementation was happily ignoring it for the last 2 years :)
so @daviwil is this a closed issue then since you found it in your own extension code? I experienced some other similar issues with the App Insights Node.js SDK, but they were helpful in learning how to work around the design decisions in the SDK.