PowerShell / PowerShellEditorServices

A common platform for PowerShell development support in any editor or application!
MIT License
612 stars 207 forks source link

Added null check to `GetCompletionsAsync` #2115

Closed dkattan closed 4 months ago

dkattan commented 6 months ago

PR Summary

Occasionally TabExpansion2 may return null. This could be due to a custom implementation of TabExpansion2 or an underlying issue with the FileSystemProvider or LocationGlobber.

When this happens the value of commandCompletion is not assigned and remains null. This causes a NullReferenceException to be thrown when commandCompletion.ReplacementLength is accessed in the subsequent call to LogTrace.

PR Context

andyleejordan commented 4 months ago

ERROR: Your current culture is (Invariant Language (Invariant Country)), which is not associated with any language, consider changing your system culture or install the English-US help content using: Update-Help -UICulture en-US.

LMAO.