microsoft / DbgShell

A PowerShell front-end for the Windows debugger engine.
MIT License
675 stars 89 forks source link

Formatting: Format-Table et al need to handle -Property #71

Closed jazzdelightsme closed 5 years ago

jazzdelightsme commented 5 years ago

Repro Steps: (abstract)

  1. Gather some objects which have view definitions registered with the alternate formatting engine.
  2. Attempt to Format-Blah them, explicitly requesting certain properties ("$stuff | ft Name, DumpPath")

Expected results: Something sensible. Ideally we can just generate an alt-formatting view definition on the fly and use that.

Actual results: The already-registered view definition is used, ignoring the request for certain properties.

Concrete example:

$stuff = dir C:\temp\dumps\ -File | ForEach-DbgDumpFile {
   $thing = lm ntdll
   $thing | Format-List | Out-Null
   Write-Output $thing
}

# BUG: We get the default module table view here, not Name and DumpPath
$stuff | ft Name, DumpPath

Workarounds: To get the desired properties with the alternate formatting engine, use the alternate formatting cmdlets directly (like "$stuff | fat Name, DumpPath").

To use the standard formatting engine, use the module-qualified name of the formatting cmdlets (like "$stuff | Microsoft.PowerShell.Utility\Format-Table Name, DumpPath").

jazzdelightsme commented 5 years ago

Fixed this in #84 (commit).