Skip to content

Formatting for unthrown exception incorrect #11413

@SeeminglyScience

Description

@SeeminglyScience

Steps to reproduce

$exception = [ComponentModel.Win32Exception]::new(0x8007007a)

# Send to output normally
$exception

# Throw
throw $exception

Expected behavior

Both the output stream exception and the ErrorRecord wrapped thrown exception to look similar, or at the very least display the Exception.Message text.

# Output stream
The data area passed to a system call is too small.

# Error stream
OperationStopped: The data area passed to a system call is too small.

Actual behavior

# Output stream

Error:

# Error stream
OperationStopped: The data area passed to a system call is too small.

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-rc.1
PSEdition                      Core
GitCommitId                    7.0.0-rc.1
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Including screenshot since the "Actual behavior" section looks potentially confusing on this one:

image

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions