Title: Still some bugs in error formatting, indent somehow involved · Issue #11669 · PowerShell/PowerShell · GitHub
Open Graph Title: Still some bugs in error formatting, indent somehow involved · Issue #11669 · PowerShell/PowerShell
X Title: Still some bugs in error formatting, indent somehow involved · Issue #11669 · PowerShell/PowerShell
Description: Steps to reproduce N.B. The repro code is indented. THIS IS CRUCIAL TO THE REPRO. Include the indent when copying and pasting into your console window. $CopyErrors = New-Object 'System.Collections.ArrayList' function CopyFiles( $srcRoot,...
Open Graph Description: Steps to reproduce N.B. The repro code is indented. THIS IS CRUCIAL TO THE REPRO. Include the indent when copying and pasting into your console window. $CopyErrors = New-Object 'System.Collections....
X Description: Steps to reproduce N.B. The repro code is indented. THIS IS CRUCIAL TO THE REPRO. Include the indent when copying and pasting into your console window. $CopyErrors = New-Object 'System.Collecti...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11669
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Still some bugs in error formatting, indent somehow involved","articleBody":"# Steps to reproduce\r\n\r\n**N.B.** The repro code is indented. **THIS IS CRUCIAL TO THE REPRO.** Include the indent when copying and pasting into your console window.\r\n```powershell\r\n $CopyErrors = New-Object 'System.Collections.ArrayList'\r\n\r\n function CopyFiles( $srcRoot, $destRoot, $plat )\r\n {\r\n Write-Host \"Copying binaries from $($srcRoot)...\" -Fore Green\r\n\r\n $fullSrc = 'C:\\Windows\\system32\\ntdll.dll'\r\n $fullDst = 'C:\\does\\not\\exist'\r\n\r\n Copy-Item $fullSrc $fullDst -ErrorVariable +CopyErrors\r\n }\r\n\r\n CopyFiles\r\n\r\n $CopyErrors\r\n\r\n $error.Count\r\n\r\n $error\r\n\r\n $error.Count\r\n```\r\n\r\n# Expected behavior\r\n\r\nYou should see 1 error, from outputting `$CopyErrors`, then `$error.Count` should output \"1\", then `$error` should show that same error again, then `$error.Count` should still be \"1\".\r\n\r\n\r\n# Actual behavior\r\n\r\nDuring the formatting of `$CopyErrors`, things go sideways, and the errors don't appear in the console, but carnage starts accumulating in `$error`. Here are the printable errors:\r\n\r\n```\r\nMethodInvocationException:\r\nLine |\r\n 122 | … $line = $line.Insert($offsetInLine\r\n\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Exception calling \"Insert\" with \"2\" argument(s): \"Specified argument was out of the range of valid values. (Parameter 'startIndex')\"\r\n\r\nMethodInvocationException:\r\nLine |\r\n 122 | … $line = $line.Insert($offsetInLine\r\n\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Exception calling \"Insert\" with \"2\" argument(s): \"Specified argument was out of the range of valid values. (Parameter 'startIndex')\"\r\n```\r\n\r\n# Environment data\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```none\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","author":{"url":"https://github.com/jazzdelightsme","@type":"Person","name":"jazzdelightsme"},"datePublished":"2020-01-24T02:08:31Z","url":"https://github.com/PowerShell/PowerShell/issues/11669"}
| 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:24de3e0b-4162-79a1-66bb-7514ef13e882 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D5C:9FF1A:27A134A:374E2D7:6AFD4CCC |
| html-safe-nonce | 07189033809dbd1179d27287907130dfcd10d5cbe33e1449e2578d612afe9590 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDVDOjlGRjFBOjI3QTEzNEE6Mzc0RTJENzo2QUZENENDQyIsInZpc2l0b3JfaWQiOiIzNDk0MDE2NDIxNzcwMTIwMzk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 59567138b35f3de4d8d8d61d90b2d51f293d339f6765af93087cf7ec8a9d797d |
| hovercard-subject-tag | issue:554508897 |
| 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/11669/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b7ac5a63f4b00d2a93c52b3c12a4cb2da86f94c40751f8161ffa5887a83da17/PowerShell/PowerShell/issues/11669 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b7ac5a63f4b00d2a93c52b3c12a4cb2da86f94c40751f8161ffa5887a83da17/PowerShell/PowerShell/issues/11669 |
| og:image:alt | Steps to reproduce N.B. The repro code is indented. THIS IS CRUCIAL TO THE REPRO. Include the indent when copying and pasting into your console window. $CopyErrors = New-Object 'System.Collections.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jazzdelightsme |
| 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