dahlbyk / posh-git

A PowerShell environment for Git
http://dahlbyk.github.io/posh-git/
MIT License
7.62k stars 801 forks source link

Cannot bind argument to parameter 'CommandName' because it is null. #901

Closed cyclr-adrian closed 2 years ago

cyclr-adrian commented 2 years ago

System Details

Issue Description

I was using posh-git quite happily on Windows 10. I got a new laptop with Windows 11 on it and I have tried to install post-git and use it like I did on my old Windows 10 laptop.

In my PowerShell profile I call:

# Setup Git Posh with arguments
# [bool]$ForcePoshGitPrompt,
# [bool]$UseLegacyTabExpansion,
# [bool]$EnableProxyFunctionExpansion
Import-Module posh-git -arg 0,0,1

This then throws the following error:

Register-ArgumentCompleter: C:\Users\{Username}\Documents\PowerShell\Modules\posh-git\1.1.0\GitTabExpansion.ps1:558
Line |
 558 |  … rShell.Core\Register-ArgumentCompleter -CommandName $cmdNames -Native …
     |                                                        ~~~~~~~~~
     | Cannot bind argument to parameter 'CommandName' because it is null.

image

Does anyone know why this might of started happening, is it a Windows 11 issue?

cyclr-adrian commented 2 years ago

I fixed this issue by removing the arguments, so instead of Import-Module posh-git -arg 0,0,1 I now use Import-Module posh-git.