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

After installation I get this exception #2

Open
Tommasov opened this issue Nov 19, 2018 · 9 comments
Open

After installation I get this exception #2

Tommasov opened this issue Nov 19, 2018 · 9 comments

Comments

@Tommasov
Copy link

annotazione 2018-11-19 174622
Windows PowerShell
Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.

Set-PSReadLineOption : L'inizializzatore di tipo di 'Microsoft.PowerShell.PSConsoleReadLine' ha generato un'eccezione.
In C:\Users\Tommaso\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:26 car:5

  • Set-PSReadLineOption -Colors $tokenColors
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Set-PSReadLineOption], TypeInitializationException
    • FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.SetPSReadLineOption

C:\Users\Tommaso
λ

@Tommasov
Copy link
Author

I "fixed" commenting line 26, but it is not the right way

if((Get-Module -Name "PSReadline").Version.Major -gt 1) {
#Set-PSReadLineOption -Colors $tokenColors
} else { foreach ($tokenColor in $tokenColors.GetEnumerator()) {
Set-PSReadlineOption -TokenKind $tokenColor.Name -ForegroundColor $tokenColor.Value
}}

@seven-two-eight
Copy link
Owner

What do you get with

(Get-Module -Name "PSReadline").Version.Major

@Tommasov
Copy link
Author

PS C:\Users\Tommaso> (Get-Module -Name "PSReadline").Version.Major
2
PS C:\Users\Tommaso>

@Tommasov
Copy link
Author

Maybe is my build (1809). Since i upgraded i have no color inside powershell by default.

@seven-two-eight
Copy link
Owner

It is possible. Line 26 was there to support third-party PSReadline module: https://www.powershellgallery.com/packages/PSReadline/, which has major version 2.
But it is hard to believe Microsoft would introduce breaking changes without a warning.
Have you tried to change line 26 to

if(false) {

so the second branch is executed?

@jespinoza84
Copy link

Same issue as OP and I'm also on 1809.

@Tommasov
Copy link
Author

I believe it is bug of 1809. I also have troubles with vscode terminal: Terminal it is not visible until u hit return. (same on phpstorm…)

@seven-two-eight
Copy link
Owner

@jespinoza84 @Tommasov
what is your $PSVersionTable.PSVersion

@jespinoza84
Copy link

image

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

3 participants