Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run profile paths together #1171

Merged

Conversation

TylerLeonhardt
Copy link
Member

There was a race condition where the fact that we'd execute each profile individually would be too fast for the PowerShell runspace and would throw this hideous error:

2020-01-27 15:18:50.254 -08:00 [FTL] Failed to handle request workspace/didChangeConfiguration
System.InvalidOperationException: A PowerShell object cannot be created that uses the current runspace because there is no current runspace available.  The current runspace might be starting, such as when it is created with an Initial Session State.
   at System.Management.Automation.PowerShell.Create(RunspaceMode runspace)
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.<>c.<GetSessionDetailsInNestedPipeline>b__153_0(PSCommand command) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 2228
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.GetSessionDetails(Func`2 invokeAction) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 2154
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.GetSessionDetailsInNestedPipeline() in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 2225
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.ExecuteCommandAsync[TResult](PSCommand psCommand, StringBuilder errorMessages, ExecutionOptions executionOptions) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 883
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.ExecuteCommandAsync[TResult](PSCommand psCommand, Boolean sendOutputToHost, Boolean sendErrorToHost) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 526
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.LoadHostProfilesAsync() in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 1163
   at Microsoft.PowerShell.EditorServices.Handlers.ConfigurationHandler.Handle(DidChangeConfigurationParams request, CancellationToken cancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\Workspace\Handlers\ConfigurationHandler.cs:line 74
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteNotification(TDescriptor descriptor, Notification notification, CancellationToken token)

With this change we run all of the profiles (separated as statements of course) in one invocation.

@TylerLeonhardt
Copy link
Member Author

Codacy Here is an overview of what got changed by this pull request:

Issues
======
+ Solved 1
           

See the complete overview on Codacy

@TylerLeonhardt TylerLeonhardt merged commit 07c8ee1 into PowerShell:master Jan 28, 2020
@TylerLeonhardt TylerLeonhardt deleted the run-profiles-in-one-command branch January 28, 2020 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants