Skip to content

dotnet type lookup breaks after importing SharePointServer PowerShell module #4680

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

Open
3 tasks done
JMyklebust opened this issue Mar 25, 2025 · 6 comments
Open
3 tasks done
Labels
Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.

Comments

@JMyklebust
Copy link

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() | 
````
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Mar 25, 2025
@kilasuit
Copy link

kilasuit commented May 9, 2025

Which version & edition of SharePoint Server - please include information about what patches have been applied to the environment too

@JMyklebust
Copy link
Author

This is on Sharepoint Server Subscription Edition currently running cumulative patch of April 2025 (KB5002705).
It's running as a single server system, and it's installed on Windows Server 2022 also running with the April 2025 Windows patches.

This environment has a test and prod server that have matching configurations for the most part, so the issue is existing 2 two different machines.

@daxian-dbw
Copy link
Member

@JMyklebust Can you run TabExpansion2 -inputScript '[date' -cursorColumn 5 after importing SharePointServer module and share the results?

@JMyklebust
Copy link
Author

This is the result.

PS> TabExpansion2 -inputScript '[date' -cursorColumn 5

Exception calling "CompleteInput" with "3" argument(s): "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."
At line:38 char:16
+ ...      return [System.Management.Automation.CommandCompletion]::Complet ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ReflectionTypeLoadException

Side note; I'm away from work for 2 weeks now so can't really reply in a prompt manner in that time.
Technically I'm already off work but figured I could test this now while I had a chance.

@daxian-dbw
Copy link
Member

Thanks @JMyklebust! When you get a chance, can you please run it again and share the information exposed by the LoaderExceptions property?

@JMyklebust
Copy link
Author

Now I'm back and can give feedback.
This is the content of LoaderExceptions:

PS> $er.Exception.InnerException.LoaderExceptions

Could not load file or assembly 'Microsoft.Bond.Interfaces, Version=3.0.3.0, Culture=neutral, PublicKeyToken=cf7230938fec607f' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bond.Interfaces, Version=3.0.3.0, Culture=neutral, PublicKeyToken=cf7230938fec607f' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bond.Interfaces, Version=3.0.3.0, Culture=neutral, PublicKeyToken=cf7230938fec607f' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bond.Interfaces, Version=3.0.3.0, Culture=neutral, PublicKeyToken=cf7230938fec607f' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bond.Interfaces, Version=3.0.3.0, Culture=neutral, PublicKeyToken=cf7230938fec607f' or one of its dependencies. The system cannot find the file specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.
Projects
None yet
Development

No branches or pull requests

3 participants