Skip to content
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

Error during initialization #3

Open
oatkins opened this issue Apr 15, 2019 · 7 comments
Open

Error during initialization #3

oatkins opened this issue Apr 15, 2019 · 7 comments

Comments

@oatkins
Copy link

oatkins commented Apr 15, 2019

I get the following error when opening a PowerShell session after following the setup instructions.

Method invocation failed because [PoshGitTextSpan] does not contain a method named 'op_Addition'.
At C:\Program Files\WindowsPowerShell\Modules\posh-dynargs\0.1.0.4\posh-dynargs.psm1:36 char:5
+     $GitPromptSettings.DefaultPromptPrefix += '$(Register-LocalArgume ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Tab completion doesn't seem to work :-(

@tygerbytes
Copy link
Owner

What version of PowerShell and PoshGit are you running?

@oatkins
Copy link
Author

oatkins commented Apr 24, 2019

This was on a managed Win 10 machine (PS 5?), with the latest version of PoshGit from the PS Gallery feed.

I love the idea for this so it would be nice to get it working :-)

@tygerbytes
Copy link
Owner

tygerbytes commented Apr 25, 2019

I wonder if something else is customizing $GitPromptSettings.DefaultPromptPrefix and setting it to a PoshGitTextSpan object instead of a plain old string or string array.

Try editing your profile script ($profile) and add $GitPromptSettings.DefaultPromptPrefix = '' right before the line that imports the posh-dynargs module (Import-Module posh-dynargs.psd1)

If that works then maybe I'll adjust that line to just print a warning and clobber the existing value of $GitPromptSettings.DefaultPromptPrefix if it's set to something besides a string.

Ideally I'd love to find a better PoshGit hook than "DefaultPromptPrefix".

@oatkins
Copy link
Author

oatkins commented Apr 26, 2019

Hmm. No joy!

Versions are as follows:

C:\src\... [my-branch ↑8 +0 ~1 -0 !]> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17134  590

C:\src\... [my-branch ↑8 +0 ~1 -0 !]> (Get-Module posh-git).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
1      0      0      -1

Ah! That would be it. Sorry! It looks as though I've got a Beta version of Posh-Git installed. It must be that.

@oatkins
Copy link
Author

oatkins commented Apr 26, 2019

So, $GitPromptSettings.DefaultPromptPrefix = $null works around this for the time being.

@tygerbytes
Copy link
Owner

Good news on the workaround! 👍 I went ahead and made the change to print a warning and set $GitPromptSettings.DefaultPromptPrefix to $null if it's anything besides a string.

If the change makes it through Chocolatey moderation, version 0.1.0.5 should be available in a few days.

@tygerbytes
Copy link
Owner

It took a few weeks for the change to go through the Choco mods. Any success with version 0.1.0.5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants