Skip to content

dotnet type lookup breaks after importing SharePointServer PowerShell module #4680

@JMyklebust

Description

@JMyklebust

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

N/A

Screenshot

N/A

Environment data

PS Version: 5.1.20348.2849
PS HostName: ConsoleHost
PSReadLine Version: 2.4.1-beta1
PSReadLine EditMode: Windows
OS: 10.0.20348.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 9001

Steps to reproduce

Try to autocomplete a dotnet type after importing the SharePointServer PowerShell module.
Applies both to tab completion and selection using Ctrl + Space.

  1. Start a new PowerShell session
  2. Test type autocomplete by for example typing [date and then pressing Ctrl + Space
  3. Auto complete suggestions come up.
  4. Import module with Import-Module SharePointServer
  5. Test autocomplete with [date and then pressing Ctrl + Space

Expected behavior

Autocomplete should work both before and after importing the SharePointServer module.

Actual behavior

After the module import, autocomplete is broken for dotnet objects.
More specifically the function to complete types names is broken.
Autocomplete for Cmdlets and methods of types is working, but type name is not.

  • Typing Get-Mo and pressing Ctrl + Space gives options to complete.
  • Typing [datetime] and pressing Ctrl + Space gives method suggestions.
  • Typing [date and pressing Ctrl + Space (or pressing just Tab) gives no results.

Additonal info:
While PSReadline itself does not seem to generate a visible exception, there is some exceptions generated in VSCode with the PowerShell extension, so I'm adding it here if possibly relevant.
But the reproduction steps has been run directly in PowerShell outside of VSCode.

2025-03-25 15:01:05.940 [info] [PSES] [Error - 3:01:05 PM] <Error>Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Error Occurred in TabExpansion2 | 
2025-03-25 15:01:05.945 [info] [PSES] [Warn  - 3:01:05 PM] <Warning>Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.<GetCompletionsInFileAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.<Handle>d__13.MoveNext() | 
````

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions