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
Update: The issue is not one of missing InnerException information, but one of situationally different ordering.
Steps to reproduce
Expected behavior
Both tests should succeed.
Actual behavior
The 2nd test fails:
That is, the
InnerException:line wasn't followed by theMessage:line.Environment data