You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search the existing issues, especially the pinned issues.
Exception report
### EnvironmentPSReadLine: 2.3.5+2cc85806c561a9395751a96a818e8ff1592d19f7PowerShell: 7.4.6OS: Microsoft Windows 10.0.19045BufferWidth: 150BufferHeight: 300Last 54 Keys: c l a s s Spacebar M y C l a s s Enter { Enter Spacebar Spacebar h i d d e n Spacebar M u C l a Backspace Backspace Backspace Backspace y C l a s s ( [ V o i d ] $ V o i d ) {### ExceptionSystem.ArgumentException: The type 'System.Void' may not be used as a type argument. at System.RuntimeType.SanityCheckGenericArguments(RuntimeType[] genericArguments, RuntimeType[] genericParameters) at System.RuntimeType.MakeGenericType(Type[] instantiation) at System.Management.Automation.Language.VariableAnalysis.FinishAnalysis(Boolean scriptCmdlet) at System.Management.Automation.Language.VariableAnalysis.AnalyzeMemberFunction(FunctionMemberAst ast) at System.Management.Automation.Language.SemanticChecks.VisitFunctionMember(FunctionMemberAst functionMemberAst) at System.Management.Automation.Language.FunctionMemberAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.TypeDefinitionAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.NamedBlockAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.ScriptBlockAst.InternalVisit(AstVisitor visitor) 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)
The exception is thrown by PowerShell when parsing the input script and it's a legit error to be thrown because it's invalid to use System.Void for a parameter type, or variable type. It's only used to represent the absence of a return value for a method.
Prerequisites
Exception report
Screenshot
Environment data
Steps to reproduce
While defining a custom class from the command line, specifying [System.Void] as a constructor type argument causes PSReadLine to throw an exception.
Expected behavior
PowerShell to throw a System.ArgumentException and PSReadLine functionality to remain available in the current PS session.
Actual behavior
PSReadLine throws a System.ArgumentException. PowerShell is still running, but PSReadLine functionality is not until a new PS session is started.
The text was updated successfully, but these errors were encountered: