PS:3> $a = [System.Management.Automation.Language.Parser]::ParseInput('[int[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]]', [ref]$null, [ref]$null)
MethodInvocationException: Exception calling "ParseInput" with "3" argument(s): "Unrecoverable error in PowerShell."
PS:4> Get-Error
Exception :
Type : System.Management.Automation.MethodInvocationException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Exception calling "ParseInput" with "3" argument(s): "Unrecoverable error in PowerShell."
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : ParseException
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : -1
Line : $a = [System.Management.Automation.Language.Parser]::ParseInput('[int[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]]',
[ref]$null, [ref]$null)
PositionMessage : At line:1 char:1
+ $a = [System.Management.Automation.Language.Parser]::ParseInput('[int …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
TargetSite :
Name : ConvertToMethodInvocationException
DeclaringType : System.Management.Automation.ExceptionHandlingOps, System.Management.Automation, Version=7.1.3.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName,
Int32 numArgs, MemberInfo memberInfo)
at CallSite.Target(Closure , CallSite , Type , String , PSReference , PSReference )
at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at System.Management.Automation.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Message : Exception calling "ParseInput" with "3" argument(s): "Unrecoverable error in PowerShell."
Data : System.Collections.ListDictionaryInternal
InnerException :
Type : System.Management.Automation.ParseException
Message : Unrecoverable error in PowerShell.
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Unrecoverable error in PowerShell.
HResult : -2146233087
CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : Parse
TargetSite :
Name : ParseInput
DeclaringType : System.Management.Automation.Language.Parser
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.Language.Parser.ParseInput(String input, String fileName, Token[]& tokens, ParseError[]& errors)
at CallSite.Target(Closure , CallSite , Type , String , PSReference , PSReference )
InnerException :
Type : System.TypeLoadException
Message : 'System.Int32[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]' from assembly 'System.Private.CoreLib, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e' has too many dimensions.
TypeName : System.Int32[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]
TargetSite :
Name : MakeArray
DeclaringType : System.RuntimeTypeHandle
MemberType : Method
Module : System.Private.CoreLib.dll
StackTrace :
at System.RuntimeTypeHandle.MakeArray(Int32 rank)
at System.RuntimeType.MakeArrayType(Int32 rank)
at System.Management.Automation.Language.ArrayTypeName.GetReflectionType()
at System.Management.Automation.Language.SymbolResolver.VisitArrayTypeName(ArrayTypeName arrayTypeName)
at System.Management.Automation.Language.SymbolResolver.VisitTypeExpression(TypeExpressionAst typeExpressionAst)
at System.Management.Automation.Language.TypeExpressionAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.CommandExpressionAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.PipelineAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.StatementBlockAst.InternalVisit(AstVisitor visitor, ReadOnlyCollection`1 traps, ReadOnlyCollection`1
statements, AstVisitAction action)
at System.Management.Automation.Language.NamedBlockAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.ScriptBlockAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.Ast.Visit(AstVisitor astVisitor)
at System.Management.Automation.Language.SymbolResolver.ResolveSymbols(Parser parser, ScriptBlockAst scriptBlockAst)
at System.Management.Automation.Language.ScriptBlockAst.PerformPostParseChecks(Parser parser)
at System.Management.Automation.Language.Parser.ParseTask(String fileName, String input, List`1 tokenList, Boolean recursed, ParseMode parseMode)
at System.Management.Automation.Language.Parser.Parse(String fileName, String input, List`1 tokenList, ParseError[]& errors, ParseMode parseMode)
at System.Management.Automation.Language.Parser.ParseInput(String input, String fileName, Token[]& tokens, ParseError[]& errors)
Source : System.Private.CoreLib
HResult : -2146233054
Source : System.Management.Automation
HResult : -2146233087
Source : System.Management.Automation
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : ParseException
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : -1
Line : $a = [System.Management.Automation.Language.Parser]::ParseInput('[int[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]]', [ref]$null,
[ref]$null)
PositionMessage : At line:1 char:1
+ $a = [System.Management.Automation.Language.Parser]::ParseInput('[int …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Prerequisites
Steps to reproduce
This was originally reported in PowerShell/PSReadLine#2923 by @HumanEquivalentUnit
Run the following script in pwsh:
Expected behavior
No exception thrown from `Parser.ParseInput`Actual behavior
Error details
Environment data
Visuals
No response