Skip to content

Get-Error situationally places other InnerException information before the Message output line #11121

@mklement0

Description

@mklement0

Update: The issue is not one of missing InnerException information, but one of situationally different ordering.

Steps to reproduce

# OK: The "InnerException :" line is followed by a "Message: " line for the inner exception.
try { 1/0 } catch {}; (Get-Error | Out-String -Stream) -replace '\e[^m]*m' | Select-String -context 0,1 '\bInnerException\b' | % { $_.Context.PostContext } | Should -Match 'Attempted to divide by zero'

# FAILS: The "InnerException :" line is followed by no fields describing the inner exception.
try { [int]::parse('foo') } catch {}; (Get-Error | Out-String -Stream) -replace '\e[^m]*m' | Select-String -context 0,1 '\bInnerException\b' | % { $_.Context.PostContext } | Should -Match 'not in a correct format'

Expected behavior

Both tests should succeed.

Actual behavior

The 2nd test fails:

Expected regular expression 'not in a correct format' to match '        TargetSite : ', but it did not match.

That is, the InnerException: line wasn't followed by the Message: line.

Environment data

PowerShell Core 7.0.0-preview.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions