Skip to content

_mainRunspaceEngineIntrinsics null in OnPowerShellIdle #1621

Closed
@dkattan

Description

@dkattan

I'm not sure why this is happening or if it is expected behavior but _mainRunspaceEngineIntrinsics is null (sometimes) in OnPowerShellIdle.
image

This appears to happen when I start a second instance of PSES from my calling application.

Adding a null check here feels like a bandaid. If I inspect the call stack I find at the beginning when PsesInternalHost.Run() is called, _mainRunspaceEngineIntrinsics is in fact being set to a proper value, so at some point there must be another instance of PsesInternalHost getting created that doesn't have this property initialized.

image

Is anyone else seeing this?

Call Stack

Microsoft.PowerShell.EditorServices.dll!Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.OnPowerShellIdle(System.Threading.CancellationToken idleCancellationToken) Line 778 C#
Microsoft.PowerShell.PSReadLine2.dll!Microsoft.PowerShell.PSConsoleReadLine.ReadKey() Unknown
Microsoft.PowerShell.PSReadLine2.dll!Microsoft.PowerShell.PSConsoleReadLine.InputLoop() Unknown
Microsoft.PowerShell.PSReadLine2.dll!Microsoft.PowerShell.PSConsoleReadLine.ReadLine(System.Management.Automation.Runspaces.Runspace runspace, System.Management.Automation.EngineIntrinsics engineIntrinsics, System.Threading.CancellationToken cancellationToken, bool? lastRunStatus) Unknown
Microsoft.PowerShell.EditorServices.dll!Microsoft.PowerShell.EditorServices.Services.PowerShell.Console.PsrlReadLine.InvokePSReadLine(System.Threading.CancellationToken cancellationToken) Line 58 C#
Microsoft.PowerShell.EditorServices.dll!Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousDelegateTask.Run(System.Threading.CancellationToken cancellationToken) Line 68 C#
Microsoft.PowerShell.EditorServices.dll!Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousTask.ExecuteSynchronously(System.Threading.CancellationToken executorCancellationToken) Line 92 C#
Microsoft.PowerShell.EditorServices.dll!Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousTask.ExecuteAndGetResult(System.Threading.CancellationToken cancellationToken) Line 108 C#

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions