Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConciseView mangles multiline errors thrown from scripts, but not from binary cmdlets #23833

Open
5 tasks done
MatejKafka opened this issue May 23, 2024 · 0 comments
Open
5 tasks done
Labels
Needs-Triage The issue is new and needs to be triaged by a work group.

Comments

@MatejKafka
Copy link

MatejKafka commented May 23, 2024

Prerequisites

Steps to reproduce

echo 'throw "test`ntest"' >script.ps1
.\script.ps1

If a script throws a multi-line error using throw, all newlines are replaced with spaces. This does not happen with binary cmdlets and advanced functions using $PSCmdlet.ThrowTerminatingError(). Structured error messages are much harder to read this way. Example from one of my scripts:

throw ("Pog cannot create symbolic links, which are currently necessary for correct functionality.`n" +`
        "To allow creating symbolic links, do any of the following and re-run '$PSCommandPath':`n" +`
        "  1) Enable Developer Mode. (Settings -> Update & Security -> For developers -> Developer Mode)`n" +`
        "  2) Allow your user account to create symbolic links using Group Policy.`n" +`
        "     (Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment -> Create symbolic links)`n" +`
        "  3) Always run Pog as administrator.")

Expected behavior

Exception: D:\_\pog\setup.ps1:39
Line |
  39 |      throw ("Pog cannot create symbolic links, which are currently nec …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Pog cannot create symbolic links, which are currently necessary for correct functionality.
     | To allow creating symbolic links, do any of the following and re-run 'D:\_\pog\setup.ps1':
     |   1) Enable Developer Mode. (Settings -> Update & Security -> For developers -> Developer Mode)
     |   2) Allow your user account to create symbolic links using Group Policy.
     |      (Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment -> Create symbolic links)
     |   3) Always run Pog as administrator.

Actual behavior

Exception: D:\_\pog\setup.ps1:39
Line |
  39 |      throw ("Pog cannot create symbolic links, which are currently nec …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Pog cannot create symbolic links, which are currently necessary for correct functionality. To allow creating symbolic links, do any of the following and re-run 'D:\_\pog\setup.ps1':   1) Enable
     | Developer Mode. (Settings -> Update & Security -> For developers -> Developer Mode)   2) Allow your user account to create symbolic links using Group Policy.      (Windows Settings -> Security
     | Settings -> Local Policies -> User Rights Assignment -> Create symbolic links)   3) Always run Pog as administrator.

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.0-preview.2
PSEdition                      Core
GitCommitId                    7.5.0-preview.2
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

@MatejKafka MatejKafka added the Needs-Triage The issue is new and needs to be triaged by a work group. label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group.
Projects
None yet
Development

No branches or pull requests

1 participant