azure-tools-vscode icon indicating copy to clipboard operation
azure-tools-vscode copied to clipboard

Extension is overriding console... cannot debug other extensions with this one installed

Open chrisdias opened this issue 8 years ago • 7 comments

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.log statement in.
  • F5 to run app, hit code path that executes the console.log statement

Result: no output in VS Code's Debug Console.

  • uninstall this extension, restart VS Code
  • load the extension project again
  • F5 to run, execute code path with console.log

Result: Console log output is in the Debug Console.

chrisdias avatar Jun 24 '17 04:06 chrisdias

actually, it looks like diagnostic-channel-publisher node module that is doing this.

image

chrisdias avatar Jun 24 '17 04:06 chrisdias

@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.

bradygaster-zz avatar Jul 19 '17 06:07 bradygaster-zz

no proposals other than removal of the offending lib?

chrisdias avatar Jul 20 '17 02:07 chrisdias

@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?

bradygaster-zz avatar Jul 20 '17 17:07 bradygaster-zz

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:

image

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.

daviwil avatar Sep 12 '17 22:09 daviwil

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 :)

daviwil avatar Sep 13 '17 13:09 daviwil

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.

bradygaster-zz avatar Sep 13 '17 17:09 bradygaster-zz