Skip to content

hashtable formatting error #1530

Closed
Closed
@ghost

Description

i've got a new problem with powershell formatting.
i upgraded to powershell-preview@2020.6.1 an hour or two before i noticed this problem.
it may have existed prior to the upgrade, but i never noticed it.
it's particularly scary because i didn't notice it for some time until my code started failing.

the attached zip has all the files described below plus a debug log.

the before .ps1 code is in hashtable-formatting_BEFORE.ps1

$AzureAD = (Get-Command -FullyQualifiedModule @{ModuleName = 'AzureAD'; ModuleVersion = '2.0.2.76' }).Name 
$AzureADPreview = (Get-Command -FullyQualifiedModule @{ModuleName = 'AzureADPreview'; ModuleVersion = '2.0.2.102' }).Name

and the after .ps1 code is in hashtable-formatting_AFTER.ps1

$AzureAD = (Get-Command -FullyQualifiedModule @{ModuleName = '2.0.2.76' }).Name 
$AzureADPreview = (Get-Command -FullyQualifiedModule @{ModuleName 'AzureADPreview'; ModuleVersion '2.0.2.102' }).Name

i tried to reproduce the problem in unaffected-hashtables.ps1 but the code here formatted correctly.
i can't explain why.

i duplicated this problem on two machines. the details are in machine-details.txt.

here's the interesting part:

machine 2 is basically win10 winver 2004 with vscode ootb plus powershell-preview@2020.6.1.
on machine 2, hashtable-formatting_BEFORE.ps1 formatted correctly.
then i copied my settings.json from machine 1 (win8.1) to machine 2.
when i reformatted hashtable-formatting_BEFORE.ps1 with the new settings.json, i got hashtable-formatting_AFTER.ps1.

so take a look at settings.json.

thanks folks

powershell-preview-hashtable-format-error.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions