Resolve-Path: C:\temp\repro.ps1:5
Line |
5 | Resolve-Path -LiteralPath 'C:\really\long\path\that\does\not\exist\bu …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path
| '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'
| because it does not exist.
Exception :
Type : System.Management.Automation.MethodInvocationException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Exception calling "Substring" with "1" argument(s): "StartIndex cannot be less than zero. (Parameter 'startIndex')"
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : ArgumentOutOfRangeException
InvocationInfo :
ScriptLineNumber : 171
OffsetInLine : 53
HistoryId : -1
Line : $remainingMessage = $remainingMessage.Substring($substring.Length - $prefix.Length).Trim()
PositionMessage : At line:171 char:53
+ … $remainingMessage = $remainingMessage.Substring($substrin …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at Get-ConciseViewPositionMessage, <No file>: line 171
at <ScriptBlock>, <No file>: line 227
at <ScriptBlock>, C:\temp\repro.ps1: line 5
at <ScriptBlock>, <No file>: line 1
TargetSite :
Name : CheckActionPreference
DeclaringType : System.Management.Automation.ExceptionHandlingOps, System.Management.Automation, Version=7.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope,
Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object
scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object
dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1
variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object
dollarUnder, Object input, Object scriptThis, Object[] args)
at Microsoft.PowerShell.Commands.PSPropertyExpression.GetValue(PSObject target, Boolean eatExceptions)
Message : Exception calling "Substring" with "1" argument(s): "StartIndex cannot be less than zero. (Parameter 'startIndex')"
Data : System.Collections.ListDictionaryInternal
InnerException :
Type : System.ArgumentOutOfRangeException
Message : StartIndex cannot be less than zero. (Parameter 'startIndex')
ParamName : startIndex
TargetSite :
Name : Substring
DeclaringType : string
MemberType : Method
Module : System.Private.CoreLib.dll
StackTrace :
at System.String.Substring(Int32 startIndex, Int32 length)
at CallSite.Target(Closure , CallSite , Object , Object )
Source : System.Private.CoreLib
HResult : -2146233086
Source : System.Management.Automation
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : ArgumentOutOfRangeException
InvocationInfo :
ScriptLineNumber : 171
OffsetInLine : 53
HistoryId : -1
Line : $remainingMessage = $remainingMessage.Substring($substring.Length - $prefix.Length).Trim()
PositionMessage : At line:171 char:53
+ … $remainingMessage = $remainingMessage.Substring($substrin …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at Get-ConciseViewPositionMessage, <No file>: line 171
at <ScriptBlock>, <No file>: line 227
at <ScriptBlock>, C:\temp\repro.ps1: line 5
at <ScriptBlock>, <No file>: line 1
Name Value
---- -----
PSVersion 7.0.0-rc.3
PSEdition Core
GitCommitId 7.0.0-rc.3
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Steps to reproduce
C:\temp\repro.ps1file with the following content:c:\temp\repro.ps1Expected behavior
Concise error view should be shown:
Actual behavior
$? = TrueGet-Errorreturns information about an exception thrown byGet-ConciseViewPositionMessage.Environment data