Title: Get-ConciseViewPositionMessage throws ArgumentOutOfRangeException in some cases · Issue #11976 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-ConciseViewPositionMessage throws ArgumentOutOfRangeException in some cases · Issue #11976 · PowerShell/PowerShell
X Title: Get-ConciseViewPositionMessage throws ArgumentOutOfRangeException in some cases · Issue #11976 · PowerShell/PowerShell
Description: Steps to reproduce Create a C:\temp\repro.ps1 file with the following content: $global:ErrorView = 'ConciseView' # NormalView and CategoryView work as expected # Bug happens when the path is >= 128 characters long. # Shorten path to < 12...
Open Graph Description: Steps to reproduce Create a C:\temp\repro.ps1 file with the following content: $global:ErrorView = 'ConciseView' # NormalView and CategoryView work as expected # Bug happens when the path is >= 128...
X Description: Steps to reproduce Create a C:\temp\repro.ps1 file with the following content: $global:ErrorView = 'ConciseView' # NormalView and CategoryView work as expected # Bug happens when the path i...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11976
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-ConciseViewPositionMessage throws ArgumentOutOfRangeException in some cases","articleBody":"# Steps to reproduce\r\n\r\n1. Create a `C:\\temp\\repro.ps1` file with the following content:\r\n\r\n```powershell\r\n$global:ErrorView = 'ConciseView' # NormalView and CategoryView work as expected\r\n\r\n# Bug happens when the path is >= 128 characters long.\r\n# Shorten path to \u003c 128 characters and it works as expected.\r\nResolve-Path -LiteralPath 'C:\\really\\long\\path\\that\\does\\not\\exist\\but\\is\\exactly\\128\\characters\\long\\and\\breaks\\the\\world\\which\\is\\not\\great.oops.2bad.exe'\r\n```\r\n\r\n2. Open a PowerShell 7 RC3 prompt\r\n3. Run this command `c:\\temp\\repro.ps1`\r\n\r\n# Expected behavior\r\n\r\nConcise error view should be shown:\r\n\r\n```none\r\nResolve-Path: C:\\temp\\repro.ps1:5\r\nLine |\r\n 5 | Resolve-Path -LiteralPath 'C:\\really\\long\\path\\that\\does\\not\\exist\\bu …\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Cannot find path\r\n | 'C:\\really\\long\\path\\that\\does\\not\\exist\\but\\i\\exactly\\128\\characters\\long\\and\\breaks\\the\\world\\which\\is\\not\\great.oops.2bad.exe'\r\n | because it does not exist.\r\n```\r\n\r\n# Actual behavior\r\n\r\n* No error is written to the host.\r\n* `$? = True`\r\n* `Get-Error` returns information about an exception thrown by `Get-ConciseViewPositionMessage`.\r\n\r\n```none\r\nException :\r\n Type : System.Management.Automation.MethodInvocationException\r\n ErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.ParentContainsErrorRecordException\r\n Message : Exception calling \"Substring\" with \"1\" argument(s): \"StartIndex cannot be less than zero. (Parameter 'startIndex')\"\r\n HResult : -2146233087\r\n CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException\r\n FullyQualifiedErrorId : ArgumentOutOfRangeException\r\n InvocationInfo :\r\n ScriptLineNumber : 171\r\n OffsetInLine : 53\r\n HistoryId : -1\r\n Line : $remainingMessage = $remainingMessage.Substring($substring.Length - $prefix.Length).Trim()\r\n\r\n PositionMessage : At line:171 char:53\r\n + … $remainingMessage = $remainingMessage.Substring($substrin …\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n CommandOrigin : Internal\r\n ScriptStackTrace : at Get-ConciseViewPositionMessage, \u003cNo file>: line 171\r\n at \u003cScriptBlock>, \u003cNo file>: line 227\r\n at \u003cScriptBlock>, C:\\temp\\repro.ps1: line 5\r\n at \u003cScriptBlock>, \u003cNo file>: line 1\r\n TargetSite :\r\n Name : CheckActionPreference\r\n DeclaringType : System.Management.Automation.ExceptionHandlingOps, System.Management.Automation, Version=7.0.0.0, Culture=neutral,\r\nPublicKeyToken=31bf3856ad364e35\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n StackTrace :\r\n at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)\r\n at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)\r\n at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope,\r\nDictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object\r\nscriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)\r\n at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object\r\ndollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1\r\nvariablesToDefine, Dictionary`2 functionsToDefine, Object[] args)\r\n at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object\r\ndollarUnder, Object input, Object scriptThis, Object[] args)\r\n at Microsoft.PowerShell.Commands.PSPropertyExpression.GetValue(PSObject target, Boolean eatExceptions)\r\n Message : Exception calling \"Substring\" with \"1\" argument(s): \"StartIndex cannot be less than zero. (Parameter 'startIndex')\"\r\n Data : System.Collections.ListDictionaryInternal\r\n InnerException :\r\n Type : System.ArgumentOutOfRangeException\r\n Message : StartIndex cannot be less than zero. (Parameter 'startIndex')\r\n ParamName : startIndex\r\n TargetSite :\r\n Name : Substring\r\n DeclaringType : string\r\n MemberType : Method\r\n Module : System.Private.CoreLib.dll\r\n StackTrace :\r\n at System.String.Substring(Int32 startIndex, Int32 length)\r\n at CallSite.Target(Closure , CallSite , Object , Object )\r\n Source : System.Private.CoreLib\r\n HResult : -2146233086\r\n Source : System.Management.Automation\r\n HResult : -2146233087\r\nCategoryInfo : NotSpecified: (:) [], MethodInvocationException\r\nFullyQualifiedErrorId : ArgumentOutOfRangeException\r\nInvocationInfo :\r\n ScriptLineNumber : 171\r\n OffsetInLine : 53\r\n HistoryId : -1\r\n Line : $remainingMessage = $remainingMessage.Substring($substring.Length - $prefix.Length).Trim()\r\n\r\n PositionMessage : At line:171 char:53\r\n + … $remainingMessage = $remainingMessage.Substring($substrin …\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n CommandOrigin : Internal\r\nScriptStackTrace : at Get-ConciseViewPositionMessage, \u003cNo file>: line 171\r\n at \u003cScriptBlock>, \u003cNo file>: line 227\r\n at \u003cScriptBlock>, C:\\temp\\repro.ps1: line 5\r\n at \u003cScriptBlock>, \u003cNo file>: line 1\r\n```\r\n\r\n# Environment data\r\n\r\n```none\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-rc.3\r\nPSEdition Core\r\nGitCommitId 7.0.0-rc.3\r\nOS Microsoft Windows 10.0.17763\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/jpoehls","@type":"Person","name":"jpoehls"},"datePublished":"2020-02-28T18:35:12Z","url":"https://github.com/PowerShell/PowerShell/issues/11976"}
| 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:d325b177-75d5-7089-a5e7-c14152569897 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DE84:2258C3:1745C1:1FB075:6AFD4E60 |
| html-safe-nonce | eada478d94dce1c3c85e894118c96317359ab6d4e307b2adcd56c671e24fe3bc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTg0OjIyNThDMzoxNzQ1QzE6MUZCMDc1OjZBRkQ0RTYwIiwidmlzaXRvcl9pZCI6IjI2NDY5MzU0OTY3NDcyMDgyODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8b660b079bf97fa05dcaf4fe8f8172e98f63457bbf2a75bfd683ba35a42fdf1e |
| hovercard-subject-tag | issue:572931489 |
| 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/11976/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bfed3253ac46924d7f93b5d35e7cf1ac964ccd15931fdd1716ee87993841d3f7/PowerShell/PowerShell/issues/11976 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bfed3253ac46924d7f93b5d35e7cf1ac964ccd15931fdd1716ee87993841d3f7/PowerShell/PowerShell/issues/11976 |
| og:image:alt | Steps to reproduce Create a C:\temp\repro.ps1 file with the following content: $global:ErrorView = 'ConciseView' # NormalView and CategoryView work as expected # Bug happens when the path is >= 128... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jpoehls |
| 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