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

PowerLine 3.4.0 fails to read a config that worked with 3.3.0 #66

Open
TBBle opened this issue Aug 28, 2021 · 8 comments
Open

PowerLine 3.4.0 fails to read a config that worked with 3.3.0 #66

TBBle opened this issue Aug 28, 2021 · 8 comments

Comments

@TBBle
Copy link

TBBle commented Aug 28, 2021

I've upgraded PowerLine 3.3.0 to 3.4.0 (also forcing Configuration 1.5.0 installation per PoshCode/Configuration#45 (comment)) and PowerLine now fails, with the following error:

Import-Metadata: C:\Users\paulh\Documents\PowerShell\Modules\Configuration\1.5.0\Configuration.psm1:457
Line |
 457 |              Import-Metadata $EnterprisePath @MetadataOptions
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:17 +     Colors = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gra … +                 ~~~~~~~~~~~~~~~
     | The command 'RgbColor' is not allowed in restricted language mode or a Data section.  At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:35 +     Colors =
     | @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gra … +                                   ~~~~~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.  At
     | C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:57 + …  = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gray'),(RgbCo … +
     | ~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.  At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:75 + …
     | ,(RgbColor 'DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbCo … +                                             ~~~~~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data
     | section.  At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:97 + … DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbColor 'Gray')) +
     | ~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.

The Configuration.ps1 in question:

@{
  PowerLineConfig = @{
    PowerLineFont = $True
    SetCurrentDirectory = $True
    DefaultAddIndex = 2
    RestoreVirtualTerminal = $True
    FullColor = $True
    Prompt = @((ScriptBlock ' New-PromptText { "&OSC;9;9;"+$executionContext.SessionState.Path.CurrentLocation+"&ST;" + $executionContext.SessionState.Path.CurrentLocation } -ForegroundColor DarkYellow -BackgroundColor Black -ElevatedBackgroundColor Gray'),(ScriptBlock ' "`t" '),(ScriptBlock ' New-PromptText { Write-VcsStatus } -ForegroundColor DarkYellow -BackgroundColor Black -ElevatedBackgroundColor Gray'),(ScriptBlock ' "`n" '),(ScriptBlock ' New-PromptText { ">" * ($NestedPromptLevel + 1) } -ForegroundColor Blue -ElevatedForegroundColor Yellow  -BackgroundColor Black -ElevatedBackgroundColor Gray'))
    Colors = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbColor 'Gray'))
  }
  EscapeSequences = @{
    Esc = '�['
    Store = '�[s'
    Recall = '�[u'
    Clear = '�[0m'
    OSC = '�]'
    ST = '�\'
  }
  ExtendedCharacters = @{
    ColorSeparator = ''
    ReverseColorSeparator = ''
    Separator = ''
    ReverseSeparator = ''
    Branch = ''
    Lock = ''
    Gear = ''
    Power = ''
  }
}

I can work around this by forcing the use of PowerLine 3.3.0 in my profile.ps1:

Import-Module PowerLine -RequiredVersion 3.3.0

This is under PowerShell 7.1.4, installed as a .NET Global Tool.

@Jaykul
Copy link
Owner

Jaykul commented Aug 29, 2021

This is a module load order problem, it'll probably never happen again after that first time when you loaded things after updating.

The issue is that RGBColor is defined in PANSIES and the serializer for it is added to the Metadata module when the PANSIES module is first imported. But if you reimport Metadata (after PANSIES is imported) it resets it's knowledge of serializers...

You could fix it by reimporting Pansies (Import-Module Pansies -Force) or just starting a new window.

I've thought of an enhanced way of registering these serializers so that Metadata could rediscover all the ones in modules that are already imported when it's reimported later, rather than loosing them...

I've also thought about having Metadata store the serializer list in the global scope so it would survive module reloads...

@TBBle
Copy link
Author

TBBle commented Aug 29, 2021

It's happening every time I start a new PowerShell. Even if I put Import-Module PANSIES -Force before Import-Module PowerLine, it does the same thing.

I just confirmed that even after rebooting it's doing the same thing.

Here's my full Microsoft.PowerShell_profile.ps1 in case it helps:

# Solarized Light when elevated
# https://serverfault.com/a/97599
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
  & (Join-Path -Path (Split-Path -Parent -Path $PROFILE) -ChildPath 'powershell-colours-solarized-canon\Set-SolarizedLightColorDefaultsCanon.ps1')
}
else {
  & (Join-Path -Path (Split-Path -Parent -Path $PROFILE) -ChildPath 'powershell-colours-solarized-canon\Set-SolarizedDarkColorDefaultsCanon.ps1')
}

function which($cmd) { Get-Command $cmd | Select-Object -expandProperty Source }

# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
  Import-Module "$ChocolateyProfile"
}

# posh-git (1.0 beta release)
# Install-Module posh-git -AllowPrerelease
Import-Module posh-git
# Override some colours which default to base colours in Solarized
# Generally, darkening anything except Red or Magenta
$GitPromptSettings.BranchColor.ForegroundColor = "DarkCyan"
$GitPromptSettings.BeforeStatus.ForegroundColor = "DarkYellow"
$GitPromptSettings.DelimStatus.ForegroundColor = "DarkYellow"
$GitPromptSettings.AfterStatus.ForegroundColor = "DarkYellow"
$GitPromptSettings.LocalStagedStatusSymbol.ForegroundColor = "DarkCyan"
$GitPromptSettings.BranchIdenticalStatusSymbol.ForegroundColor = "DarkCyan"
$GitPromptSettings.BranchAheadStatusSymbol.ForegroundColor = "DarkGreen"
$GitPromptSettings.BranchBehindAndAheadStatusSymbol.ForegroundColor = "DarkYellow"

# Set custom Prompt
# TODO: Convert and add to PowerLine instead
#Import-Module (Join-Path -Path (Split-Path -Parent -Path $PROFILE) -ChildPath 'Prompt.ps1')

# PowerLine (Pulls in PANSIES which overrides Write-Host)
# Install-Module PANSIES -AllowClobber
# Install-Module PowerLine
Import-Module PowerLine
# Settings are exported with `Export-PowerLinePrompt`, which writes to
#  ${ENV:AppData}\powershell\HuddledMasses.org\PowerLine\Configuration.psd1
# Sadly, this looks wrong in Solarized Dark until https://github.com/microsoft/terminal/issues/6807
# as we ask for "Black" (Solarized Dark BG Highlight) but the WT hack gives us "Background".
# Similarly, when elevated, Powerline's ColorSeparator is "Gray" (Solarized Light BG Highlight)
# but the WT hack gives us "Foreground"
# Note: You can test how it's _supposed_ to look with the dotnet global tool pwsh:
# dotnet tool install powershell --global
# & "$ENV:USERPROFILE\.dotnet\tools\pwsh.exe"

# Solarized colours for PANSIES
# Black
[PoshCode.Pansies.RgbColor]::ConsolePalette[0] = "#073642"
# DarkBlue
[PoshCode.Pansies.RgbColor]::ConsolePalette[1] = "#268bd2"
# DarkGreen
[PoshCode.Pansies.RgbColor]::ConsolePalette[2] = "#859900"
# DarkCyan
[PoshCode.Pansies.RgbColor]::ConsolePalette[3] = "#2aa198"
# DarkRed
[PoshCode.Pansies.RgbColor]::ConsolePalette[4] = "#dc322f"
# DarkMagenta
[PoshCode.Pansies.RgbColor]::ConsolePalette[5] = "#d33682"
# DarkYellow
[PoshCode.Pansies.RgbColor]::ConsolePalette[6] = "#b58900"
# Gray
[PoshCode.Pansies.RgbColor]::ConsolePalette[7] = "#eee8d5"
# DarkGray
[PoshCode.Pansies.RgbColor]::ConsolePalette[8] = "#002b36"
# Blue
[PoshCode.Pansies.RgbColor]::ConsolePalette[9] = "#839496"
# Green
[PoshCode.Pansies.RgbColor]::ConsolePalette[10] = "#586e75"
# Cyan
[PoshCode.Pansies.RgbColor]::ConsolePalette[11] = "#93a1a1"
# Red
[PoshCode.Pansies.RgbColor]::ConsolePalette[12] = "#cb4b16"
# Magenta
[PoshCode.Pansies.RgbColor]::ConsolePalette[13] = "#6c71c4"
# Yellow
[PoshCode.Pansies.RgbColor]::ConsolePalette[14] = "#657b83"
# White
[PoshCode.Pansies.RgbColor]::ConsolePalette[15] = "#fdf6e3"

I did noticed I have three versions of Pansies installed:

1▌~▌Get-Module -ListAvailable PANSIES

    Directory: C:\Users\paulh\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.3.1                 Pansies                             Core,Desk {New-Text, New-Hyperlink, Write-Host, Get-Gradient…}
Script     2.3.0                 Pansies                             Core,Desk {New-Text, New-Hyperlink, Write-Host, Get-Gradient…}
Script     2.0.0                 Pansies                             Core,Desk {New-Text, Write-Host, Get-Gradient, Get-Complement…}

is there any chance it's picking up the wrong one or something? 2.3.1 is the one that's been loaded, apparently. Edit: I force-uninstalled the older versions, and nothing changed.

I did confirm that if I manually re-import Pansies from the shell, it does seem to work, but my prompt doesn't get set up, so something else is up.

image

My actual prompt, if I import PowerLine 3.3.0:
image

One other possibility: I notice that in the failure case, I am somehow ending up with both versions of Configuration loaded:

1▌~▌Get-Module

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     1.3.1                 Configuration                       {Add-MetadataConverter, ConvertFrom-Metadata, ConvertTo-Metadata, Export-Configuration…}
Script     1.5.0                 Configuration                       {Export-Configuration, Get-ConfigurationPath, Import-Configuration, Import-ParameterConfiguration…}
Script     1.5.1                 Metadata                            {Add-MetadataConverter, ConvertFrom-Metadata, ConvertTo-Metadata, Export-Metadata…}
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Script     2.3.1                 Pansies                             {Get-ColorWheel, Get-Complement, Get-Gradient, New-Hyperlink…}
Script     1.0.0                 posh-git                            {Add-PoshGitToProfile, Expand-GitCommand, Format-GitBranchName, Get-GitBranchStatusColor…}
Script     3.4.0                 PowerLine                           {Add-PowerLineBlock, Export-PowerLinePrompt, Get-Elapsed, Get-ErrorCount…}
Script     2.1.0                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}

Clearly the right one is being used (you can see 1.5.0 in the error), but I'm wondering if it's possible this is what's blatted the Converters list, and for that matter what caused it to load.

Okay, last thing I confirmed. If I only have Configuration 1.5.0 installed, PowerLine 3.3.0 starts show the same issue. So whatever's going on here, it's maybe a Configuration problem, not a PowerLine issue (which makes sense).

I ended up uninstalling all the new stuff (I was testing to see if PowerLine 3.4.0 would consume Configuration 1.3.1, and broke stuff so had to remove them all), but I can reinstall things if there's something that'd be useful to test.

@cafuneandchill
Copy link

I have the same problem as @TBBle. Mind you, though, that I have a fresh install of PowerLine, and I have only a single instance of Pansies loaded. So, this might mean that it's something about the latest Pansies or PowerLine version that's at fault here.

Removing the Colors parameter from the PowerLine config file removes the issue. Although, you have to enjoy/endure the default colors in that case.

@stej
Copy link

stej commented Oct 4, 2021

Same here

C:\Users\stj>pwsh
PowerShell 7.1.0
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

   A new PowerShell stable release is available: v7.1.4
   Upgrade now, or check out the release page at:
     https://aka.ms/PowerShell-Release?tag=v7.1.4
>> Import-Module Pansies
>> Import-Module PowerLine
Import-Metadata: C:\Users\stj\OneDrive\Documents\PowerShell\Modules\Configuration\1.5.0\Configuration.psm1:457
Line |
 457 |              Import-Metadata $EnterprisePath @MetadataOptions
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | At C:\Users\stj\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:22
     | char:17 +     Colors = @((RgbColor '#FFDD00'),(RgbColor '#FF6600')) +
     | ~~~~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data
     | section.  At
     | C:\Users\stj\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:22 char:38
     | +     Colors = @((RgbColor '#FFDD00'),(RgbColor '#FF6600')) +
     | ~~~~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.

3▌~▌

The modules are there only once, downloaded yesterday.

3▌~▌Get-Module pansies -ListAvailable

    Directory: C:\Users\stj\OneDrive\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name    
---------- -------    ---------- ----    
Script     2.3.1                 Pansies 

4▌~▌Get-Module PowerLine -ListAvailable

    Directory: C:\Users\stj\OneDrive\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name    
---------- -------    ---------- ----    
Script     3.4.0                 PowerLine

5▌~▌Get-Module Configuration -ListAvailable

    Directory: C:\Users\stj\OneDrive\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name         
---------- -------    ---------- ----         
Script     1.5.0                 Configuration

6▌~▌Get-Module Metadata -ListAvailable

    Directory: C:\Users\stj\OneDrive\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name         
---------- -------    ---------- ----         
Script     1.5.1                 Metadata     

@Jaykul
Copy link
Owner

Jaykul commented Oct 8, 2021

So, I'll explain how this works, in hopes y'all can help figure this out.

  1. The Metadata module supports extensible serialization.
  2. The Configuration module prior to 1.5 shipped Metadata inside the Configuration module
  3. The PANSIES module adds the serialization for RGBColor when it's imported:
if(Get-Command Add-MetadataConverter -ErrorAction Ignore) {
    Add-MetadataConverter @{
        RgbColor = { [PoshCode.Pansies.RgbColor]$args[0] }
        [PoshCode.Pansies.RgbColor] = { "RgbColor '$_'" }
    }
}

The situation that TBBle had was due to PANSIES somehow finding the Add-MetadataConverter command exported by Configuration 1.3.1 instead of the one exported by Metadata 1.5.1 -- which means it registered the converter in the wrong place, because when PowerLine load it forces importing Configuration 1.5.0 which uses Metadata 1.5.1 and can't find the deserializer.

I'm reasonably sure you could resolve the problem in a given PowerShell session by:

  1. Re-importing PANSIES (with -Force) to re-run the Add-Metadata command (or just run that command from above)
  2. Test the serialization with Get-Module PowerLine | Import-Configuration
  3. (If that worked) re-import the configuration in PowerLine by running Set-PowerLinePrompt

But I'm not sure what's going wrong in your specific session. Normally this only happens if PANSIES can't find the Metadata command, so the serialization doesn't get registered, or if the Configuration module gets forcibly re-imported and looses it's memory of the registered serialization metadata..

I suppose that perhaps, since PowerLine is explicitly taking a dependency on both modules, it could re-run the registration of the serialization for RgbColor, just to be sure.

I'm also thinking about whether there's a way that I could improve the way the registration works so it can survive having the Configuration module reimported -- or even be permanent...

@TBBle
Copy link
Author

TBBle commented Oct 8, 2021

I was still seeing the problem with only Configuration 1.5.0 installed, so I don't think that it was that PANSIES was picking up Add-MetadataConverter from Configuration 1.3.1 in that case.

My suspicion (although I haven't looked in a while) was that something in PowerLine was reloading the Metadata module after PANSIES called Add-MetadataConverter (since manually importing PANSIES in my profile before loading PowerLine didn't fix the issue), so having the registrations persist through that would make sense, and also seems generally like a good way to avoid any surprise load-ordering interactions.

I don't know enough PowerShell to know if there's a useful per-session storage where this would make sense, or if indeed it should be persisted between sessions such that importing Metadata is sufficient to re-establish the converters.

@Jaykul
Copy link
Owner

Jaykul commented Dec 17, 2021

I'm not sure if this is related or not, but PoshCode/Metadata#3 was a bug in Metadata related to the serialization of objects, which is now fixed in Metadata 1.5.3

I have an idea about how to "permanently" register serializations -- based on what I did in EzTheme, but I'm not sure if that's really the root cause.

Fwiw, I'm using:

  • Metadata 1.5.3
  • Configuration 1.5.0
  • PowerLine 3.4.0
  • Pansies 2.3.1

And that's working on PS 5.1 and PS 7.2

However, I might have just re-set my config at some point, and I don't have the old export. If any of you are still stuck, can you dump your Configuration.psd1 and share it?

This should work to copy the contents:

Get-Module PowerLine | Get-ConfigurationPath | ls | Get-Content | Set-Clipboard

They're sometimes hard to read in a non-powerline font:

@{
  ExtendedCharacters = @{
    Branch = ''
    ColorSeparator = ''
    Gear = ''
    Lock = ''
    Power = ''
    ReverseColorSeparator = ''
    ReverseSeparator = ''
    Separator = ''
  }
  EscapeSequences = @{
    Clear = '[0m'
    Esc = '['
    Recall = '[u'
    Store = '[s'
  }
  PowerLineConfig = @{
    PowerLineCharacters = @{
      ColorSeparator = ''
      Separator = ''
      ReverseSeparator = ''
      ReverseColorSeparator = ''
    }
    PowerLineFont = $True
    DefaultAddIndex = -1
    Title = (ScriptBlock '')
    Colors = @((RgbColor '#36648B'),(RgbColor '#1874CD'),(RgbColor '#00B2EE'),(RgbColor '#7EC0EE'),(RgbColor '#5CACEE'),(RgbColor '#B0E2FF'))
    SetCurrentDirectory = $True
    Prompt = @((ScriptBlock ' $MyInvocation.HistoryId '),(ScriptBlock ' "&Gear;" * $NestedPromptLevel '),(ScriptBlock ' $pwd.Drive.Name '),(ScriptBlock ' Split-Path $pwd -leaf '),(ScriptBlock ' "`t" '),(ScriptBlock ' Get-Elapsed -Trim '),(ScriptBlock ' Get-Date -Format "T" '))
    PSReadLinePromptText = @('[48;2;102;102;102m[92m♥[38;2;242;242;242m PS[38;2;102;102;102m[49m[0m','[48;2;102;102;102m[38;2;255;99;71m♥[38;2;242;242;242m PS[38;2;102;102;102m[49m[0m')
    FullColor = $True
  }
}

@TBBle
Copy link
Author

TBBle commented Dec 18, 2021

My current config dump:

@{
  PowerLineConfig = @{
    PowerLineFont = $True
    SetCurrentDirectory = $True
    DefaultAddIndex = 2
    RestoreVirtualTerminal = $True
    FullColor = $True
    Prompt = @((ScriptBlock ' New-PromptText { "&OSC;9;9;"+$executionContext.SessionState.Path.CurrentLocation+"&ST;" + $executionContext.SessionState.Path.CurrentLocation } -ForegroundColor DarkYellow -BackgroundColor Black -ElevatedBackgroundColor Gray'),(ScriptBlock ' "`t" '),(ScriptBlock ' New-PromptText { Write-VcsStatus } -ForegroundColor DarkYellow -BackgroundColor Black -ElevatedBackgroundColor Gray'),(ScriptBlock ' "`n" '),(ScriptBlock ' New-PromptText { ">" * ($NestedPromptLevel + 1) } -ForegroundColor Blue -ElevatedForegroundColor Yellow  -BackgroundColor Black -ElevatedBackgroundColor Gray'))
    Colors = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbColor 'Gray'))
  }
  EscapeSequences = @{
    Esc = '�['
    Store = '�[s'
    Recall = '�[u'
    Clear = '�[0m'
    OSC = '�]'
    ST = '�\'
  }
  ExtendedCharacters = @{
    ColorSeparator = ''
    ReverseColorSeparator = ''
    Separator = ''
    ReverseSeparator = ''
    Branch = ''
    Lock = ''
    Gear = ''
    Power = ''
  }
}

which is working with PowerShell 7.2.0:

C:\Users\paulh
>Get-Module

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     1.3.1                 Configuration                       {Add-MetadataConverter, ConvertFrom-Metadata, ConvertTo-Metadata, Export-Configuration…}
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Script     2.3.1                 Pansies                             {Get-ColorWheel, Get-Complement, Get-Gradient, New-Hyperlink…}
Script     1.0.0                 posh-git                            {Add-PoshGitToProfile, Expand-GitCommand, Format-GitBranchName, Get-GitBranchStatusColor…}
Script     3.3.0                 PowerLine                           {Add-PowerLineBlock, Export-PowerLinePrompt, Get-Elapsed, Get-ErrorCount…}
Script     2.1.0                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}

Am I understanding correctly that the issue might have been fixed with Metadata 1.5.3, and you're looking for a test?

I did a quick test, and it still fails in a new Windows Terminal instance with

Import-Metadata: At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:17 +     Colors = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gra … +                 ~~~~~~~~~~~~~~~ The command
'RgbColor' is not allowed in restricted language mode or a Data section.  At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:35 +     Colors = @((RgbColor 'Cyan'),(RgbColor
'DarkCyan'),(RgbColor 'Gra … +                                   ~~~~~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.  At
C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:57 + …  = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gray'),(RgbCo … +
~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.  At C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:75 + … ,(RgbColor
'DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbCo … +                                             ~~~~~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.  At
C:\Users\paulh\AppData\Roaming\powershell\HuddledMasses.org\PowerLine\Configuration.psd1:10 char:97 + … DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbColor 'Gray')) +
~~~~~~~~~~~~~~~ The command 'RgbColor' is not allowed in restricted language mode or a Data section.

The state when it failed:

2▌~▌Get-Module -all

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     1.5.0                 Configuration                       {Export-Configuration, Get-ConfigurationPath, Import-Configuration, Import-ParameterConfiguration…}
Script     1.5.3                 Metadata                            {Add-MetadataConverter, ConvertFrom-Metadata, ConvertTo-Metadata, Export-Metadata…}
Binary     7.2.0.500             Microsoft.PowerShell.Commands.Mana… {Add-Content, Clear-Content, Clear-ItemProperty, Clear-RecycleBin…}
Binary     7.2.0.500             Microsoft.PowerShell.Commands.Util… {Add-Member, Add-Type, Compare-Object, ConvertFrom-SddlString…}
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Binary     2.1.0.0               Microsoft.PowerShell.PSReadLine2    {Get-PSReadLineOption, Set-PSReadLineOption, Set-PSReadLineKeyHandler, Get-PSReadLineKeyHandler…}
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Binary     1.0.0.0               Pansies                             {Get-ColorWheel, Get-Complement, Get-Gradient, New-Hyperlink…}
Script     2.3.1                 Pansies                             {Get-ColorWheel, Get-Complement, Get-Gradient, New-Hyperlink…}
Script     1.0.0                 posh-git                            {Add-PoshGitToProfile, Expand-GitCommand, Format-GitBranchName, Get-GitBranchStatusColor…}
Script     3.4.0                 PowerLine                           {Add-PowerLineBlock, Export-PowerLinePrompt, Get-Elapsed, Get-ErrorCount…}
Script     2.1.0                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}

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

4 participants