-
Notifications
You must be signed in to change notification settings - Fork 316
Closed
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues, especially the pinned issues.
Exception report
### Environment
PSReadLine: 2.3.5+2cc85806c561a9395751a96a818e8ff1592d19f7
PowerShell: 7.4.2
OS: Microsoft Windows 10.0.22631
BufferWidth: 160
BufferHeight: 9000
Last 30 Keys:
Enter
Enter
Ctrl+v Enter
Ctrl+v Spacebar | Shift+Spacebar o u t - n Tab Enter
" " + Spacebar Ctrl+v Enter
Ctrl+v Enter
Enter
Ctrl+v Enter
Ctrl+v Enter
[ R
### Exception
System.Management.Automation.PSArgumentException: Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
at System.Management.Automation.Language.TypeName..ctor(IScriptExtent extent, String name)
at System.Management.Automation.Language.TypeResolver.ResolveTypeNameWithContext(TypeName typeName, Exception& exception, Assembly[] assemblies, TypeResolutionState typeResolutionState)
at System.Management.Automation.Language.SymbolResolver.VisitTypeName(TypeName typeName, Int32 genericArgumentCount, Boolean isAttribute)
at System.Management.Automation.Language.SymbolResolver.VisitTypeExpression(TypeExpressionAst typeExpressionAst)
at System.Management.Automation.Language.CommandExpressionAst.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.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)
Screenshot
Environment data
PS Version: 7.4.2
PS HostName: ConsoleHost
PSReadLine Version: 2.3.5
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 160
BufferHeight: 9000
Steps to reproduce
I ran into this when looking for a way to simplify the type name of a fully-qualified type, like [System.Security.Cryptography.RandomNumberGenerator]
so that I could reference it simply as [RandomNumberGenerator]
. Powershell has the using namespace
or using assembly
statements to assist with this.
- PS>
using namespace [System.Security.Cryptography]
- PS>
#[RandomNumberGenerator]::GetBytes(32)
- [Note]: This command is commented to prevent syntax parsing, but this is what I eventually wanted to try.
- The #commented version of this line is not required for the repro.
- Attempt to type the following characters from above (don't directly paste the command)...
- PS>
[
R
a
n
d
o
m
. . .
- PS>
- PSReadLine will throw an exception as soon as you type the
R
in[Random
.- I wasn't even able to attempt a Tab-completion or RightArrow statement completion.
Expected behavior
Expected no error, no thrown exception, and allow me to continue typing out the command line.
Actual behavior
- As soon as I typed the
R
when attempting to type[RandomNumberGenerator]
, it threw an error exception. - The screenshot shows the last successfully typed char was the opening
[
.- The attempted
R
isn't shown as the exception was part of its keystroke.
- The attempted
- Repeating this in a new PWSH shell wil repro.
[Note]: For now, I have since deleted these commands from my ConsoleHost_History.txt to prevent me from accidentally triggering the error in the future. 😄
Metadata
Metadata
Assignees
Labels
No labels