Title: pwsh 7.0.0rc2 : Bug in Compact Error view Formatter · Issue #11827 · PowerShell/PowerShell · GitHub
Open Graph Title: pwsh 7.0.0rc2 : Bug in Compact Error view Formatter · Issue #11827 · PowerShell/PowerShell
X Title: pwsh 7.0.0rc2 : Bug in Compact Error view Formatter · Issue #11827 · PowerShell/PowerShell
Description: <# Steps: 1. Ensure terminal is 120 characters or less wide 2. Save this script to a file (e.g. bug.ps1), then run with ./bug.ps1 Expected: See compact error view outline of the exception message Actual: Script terminates without showing...
Open Graph Description: <# Steps: 1. Ensure terminal is 120 characters or less wide 2. Save this script to a file (e.g. bug.ps1), then run with ./bug.ps1 Expected: See compact error view outline of the exception message A...
X Description: <# Steps: 1. Ensure terminal is 120 characters or less wide 2. Save this script to a file (e.g. bug.ps1), then run with ./bug.ps1 Expected: See compact error view outline of the exception messag...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11827
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pwsh 7.0.0rc2 : Bug in Compact Error view Formatter","articleBody":"```powershell\r\n\u003c#\r\n\r\nSteps: \r\n1. Ensure terminal is 120 characters or less wide\r\n2. Save this script to a file (e.g. bug.ps1), then run with ./bug.ps1 \r\nExpected: See compact error view outline of the exception message\r\nActual: Script terminates without showing any error\r\nLooking at $error[0] shows Substring error in a powershell formatter\r\nMethodInvocationException:\r\nLine |\r\n 172 | … $remainingMessage = $remainingMessage.Substring($substrin …\r\n\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Exception calling \"Substring\" with \"1\" argument(s): \"StartIndex cannot be less than zero. (Parameter 'startIndex')\"\r\nThis is in:\r\nhttps://github.com/PowerShell/PowerShell/blob/66912b7428d1f042cafaff70a76c60007716f4a7/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs\r\n#>\r\nfunction Break-CompactErrorView {\r\n $msg = @\"\r\n0\r\n\"@\r\n $errorMsg = ''\r\n for ($i = 0; $i -lt 121; $i++) {\r\n $errorMsg += $msg\r\n }\r\n throw $errorMsg\r\n\r\n}\r\n\r\n$error.Clear()\r\nBreak-CompactErrorView\r\n```\r\n\r\nNote that if pasting the script directly into a console window and running it, the expected behaviour occurs - only if run from a saved script does the exception get \"lost\" due to the exception in the error formatting code.\r\n\r\n```\r\nfoo.ps1\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-rc.2\r\nPSEdition Core\r\nGitCommitId 7.0.0-rc.2\r\nOS Microsoft Windows 10.0.18363\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\nAlso occurs on Linux (both rc1 and rc2, rc1 shown here):\r\n```\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-rc.1\r\nPSEdition Core\r\nGitCommitId 7.0.0-rc.1\r\nOS Linux 4.14.158-129.185.amzn2.x86_64 #1 SMP Tue …\r\nPlatform Unix\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\nDaily build from powershell-core-daily - not sure if this is the most recent as I've never run dailies before:\r\n```\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-dailypreview7.45555\r\nPSEdition Core\r\nGitCommitId 7.0.0-dailypreview7.45555\r\nOS Microsoft Windows 10.0.18363\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```","author":{"url":"https://github.com/stevenebutler","@type":"Person","name":"stevenebutler"},"datePublished":"2020-02-11T06:26:57Z","url":"https://github.com/PowerShell/PowerShell/issues/11827"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f3e98244-af02-5594-0a99-507031e994fc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE4E:19658F:34633:48EBC:6AFD5680 |
| html-safe-nonce | 3dba9a685e646b20372de56a91d845a6c9aa4cc7d081374677f9a89b0e148f85 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTRFOjE5NjU4RjozNDYzMzo0OEVCQzo2QUZENTY4MCIsInZpc2l0b3JfaWQiOiIxODg5MzgxNjc0NjU1NzY2MTQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ac672bc74d17ece242f774876d9f2ba0efec54f00d48ca4a6141ad22dc4f4d56 |
| hovercard-subject-tag | issue:563001792 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/11827/issue_layout |
| twitter:image | https://opengraph.githubassets.com/48731a0024c904e25007278d0ee4fc4333e6a4f5e94338572242af3eac45d4d2/PowerShell/PowerShell/issues/11827 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/48731a0024c904e25007278d0ee4fc4333e6a4f5e94338572242af3eac45d4d2/PowerShell/PowerShell/issues/11827 |
| og:image:alt | <# Steps: 1. Ensure terminal is 120 characters or less wide 2. Save this script to a file (e.g. bug.ps1), then run with ./bug.ps1 Expected: See compact error view outline of the exception message A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | stevenebutler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width