-
Notifications
You must be signed in to change notification settings - Fork 517
Closed
Labels
Description
System Details
- Operating system name and version: Windows 10 - 1803
- VS Code version: 1.24.0
- PowerShell extension version: Commit ddc75b8
- Output from
$PSVersionTable
: N/A
Issue Description
While working on a new feature for the extension, I noticed that I was unable to call writeError etc. on the logger object during Feature initialisation. I found this was due to a race-ish condition.
- We create the logging object here
Line 107 in ddc75b8
logger = new Logger(); |
- We then create the features here
Lines 114 to 134 in ddc75b8
// Create features | |
extensionFeatures = [ | |
new ConsoleFeature(), | |
new ExamplesFeature(), | |
new OpenInISEFeature(), | |
new GenerateBugReportFeature(sessionManager), | |
new ExpandAliasFeature(), | |
new ShowHelpFeature(), | |
new FindModuleFeature(), | |
new PesterTestsFeature(sessionManager), | |
new ExtensionCommandsFeature(logger), | |
new SelectPSSARulesFeature(), | |
new CodeActionsFeature(), | |
new NewFileOrProjectFeature(), | |
new DocumentFormatterFeature(logger, documentSelector), | |
new RemoteFilesFeature(), | |
new DebugSessionFeature(context, sessionManager), | |
new PickPSHostProcessFeature(), | |
new SpecifyScriptArgsFeature(context), | |
new HelpCompletionFeature(logger), | |
new CustomViewsFeature(), |
- However, the debug log level is is only set at;
vscode-powershell/src/session.ts
Line 111 in ddc75b8
this.log.startNewLog(this.sessionSettings.developer.editorServicesLogLevel); |
- Which is called from;
Line 141 in ddc75b8
sessionManager.start();
which is AFTER the features are created.
The race condition comes from how node schedules things on threads. Sometimes it was set in time for the feature creation, sometimes not.
TylerLeonhardt