DotJoshJohnson.[email protected]
ms-azuretools.[email protected]
ms-vscode.[email protected]
ms-vscode.[email protected]
ms-vscode.[email protected]
Name Value
---- -----
PSVersion 5.1.17763.134
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.134
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PowerShell integrated terminal crashing. The log contains the same error each time:
[ERROR] tid:75 in 'OnListenTaskCompleted' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: line 391
ProtocolEndpoint message loop terminated due to unhandled exception:
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.PowerShell.EditorServices.Workspace.RecursivelyFindReferences(ScriptFile scriptFile, Dictionary`2 referencedScriptFiles)
at Microsoft.PowerShell.EditorServices.Workspace.ExpandScriptReferences(ScriptFile scriptFile)
at Microsoft.PowerShell.EditorServices.LanguageService.<GetDefinitionOfSymbol>d__19.MoveNext()
Hoping the terminal to be more stable, pain to have to keep restarting it.
I don't have a solid repro but it happens a lot, seems to happen more when I am trying to select text in the editor to execute with F8. When I try to highlight from the top-down (for example line 10 to line 20) nothing happens, so I try to highlight from the bottom-up (for example line 20 to line 10). This might be coincidence but the terminal crash seems to happen shortly after that.
I wonder if this line:
https://github.com/PowerShell/PowerShellEditorServices/blob/4b39d013c4dde376b8811a80300465bc97c9866d/src/PowerShellEditorServices/Workspace/Workspace.cs#L436
Should be using TryGetFile() instead. GetFile() can return null and if it does, it is passed recursively to RecursivelyFindReferences() which dereferences it. I "think" that is where the NRE is coming from.
Most helpful comment
I wonder if this line:
https://github.com/PowerShell/PowerShellEditorServices/blob/4b39d013c4dde376b8811a80300465bc97c9866d/src/PowerShellEditorServices/Workspace/Workspace.cs#L436
Should be using TryGetFile() instead. GetFile() can return null and if it does, it is passed recursively to RecursivelyFindReferences() which dereferences it. I "think" that is where the NRE is coming from.