Repository navigation
Error on pressing keys Alt+h when trying to get a description of a parameter #4907
Description
Activity
- addedNeeds-Triage 🔍It's a new issue that core contributor team needs to triage.It's a new issue that core contributor team needs to triage.
on Aug 27, 2025 This is strange and it will be helpful if we can check on the
helpContentobject that is passed toWriteParameterHelp(Object helpContent).Can you please run the following script in the same PowerShell session where you can reproduce this issue with
Get-ChildItem -LiteralPathand then share the results of the last 3 commands here?## Get the PSReadLine singleton instance $t = [Microsoft.PowerShell.PSConsoleReadLine] $f = $t.GetField('_singleton', [System.Reflection.BindingFlags]::Static -bor [System.Reflection.BindingFlags]::NonPublic) $instance = $f.GetValue($null) ## Get the method used to retrieve the help content. $method = $t.GetMethods([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) | ? Name -Like *GetDynamicHelpContent ## Call the method with reflection $v = $method.Invoke($instance, @('Get-ChildItem', 'LiteralPath', $false))
## After running the above, please share the results from those 3 commands. $v | gm $null -eq $v.type $v | fl
- added and removedNeeds-Triage 🔍It's a new issue that core contributor team needs to triage.It's a new issue that core contributor team needs to triage.
on Aug 27, 2025 Good morning. I ran the script several times - before and after installing the help update. When pasting a script, the terminal window once encountered the disappearance of the mouse cursor within the window. But it was not possible to reproduce the problem. Results before "help-update":
PS C:\Users\user> $v | gm TypeName: ExtendedCmdletHelpInfo#parameter Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() aliases NoteProperty string aliases=PSPath, LP globbing NoteProperty string globbing=false isDynamic NoteProperty string isDynamic=false name NoteProperty string name=LiteralPath parameterSetName NoteProperty string parameterSetName=LiteralItems parameterValue NoteProperty System.String parameterValue=string[] pipelineInput NoteProperty string pipelineInput=true (ByPropertyName) position NoteProperty string position=Named required NoteProperty string required=true type NoteProperty ExtendedCmdletHelpInfo#type type=@{name=string[]} PS C:\Users\user> $null -eq $v.type False PS C:\Users\user> $v | fl name : LiteralPath required : true pipelineInput : true (ByPropertyName) isDynamic : false globbing : false parameterSetName : LiteralItems parameterValue : string[] type : @{name=string[]} position : Named aliases : PSPath, LPResults after running "update-help":
PS C:\Users\user> $v | gm TypeName: MamlCommandHelpInfo#parameter Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() aliases NoteProperty string aliases=none description NoteProperty psobject[] description=System.Management.Automation.PSObject[] globbing NoteProperty string globbing=false name NoteProperty System.String name=LiteralPath parameterValue NoteProperty System.String parameterValue=System.String[] pipelineInput NoteProperty string pipelineInput=false position NoteProperty string position=Named required NoteProperty string required=true variableLength NoteProperty string variableLength=false PS C:\Users\user> $null -eq $v.type True PS C:\Users\user> PS C:\Users\user> $v | fl parameterValue : System.String[] description : {@{Text=Specifies a path to one or more locations. The value of **LiteralPath** is used exactly as it's typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell to not interpret any characters as escape sequences. }, @{Text=For more information, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).}} name : LiteralPath required : true variableLength : false globbing : false pipelineInput : false position : Named aliases : none PS C:\Users\user>And one more problem. I don't know if it is related to the current one, but this is what I get in the file ''C:\Users\user\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt''. Instead of command history, I see this:
PS C:\Users\user> gc 'C:\Users\user\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt'
楨瑳牯൹⠊敇楆敬慈桳ⴠ汁潧楲桴䡓㉁㘵ⴠ慐桴䐠尺潐敷卲敨汬㜭㔮㈮眭湩砭㐶洮楳⸩慨桳ⴠ煥⠠敇楆敬慈桳ⴠ汁潧楲桴䡓㉁㘵ⴠ慐.
This is a file:After deleting this file and reopening the terminal, the newly created history file looks normal.
I also get this same stack trace on
7.5.2andPSReadLineversion2.3.6withShowParameterHelplike the below.filehash -Algorithm # + <Alt+h>
filehashis the "secret" shorthand forGet-FileHash.Oops, something went wrong. Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections. Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml Thank you! ### Environment PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767 PowerShell: 7.5.2 OS: Microsoft Windows 10.0.22631 BufferWidth: 209 BufferHeight: 51 Last 200 Keys: Backspace p s r e a d l i n e o p t i o n Enter p s r e a d l i n e k e y h a n d l e r Enter UpArrow Spacebar | Spacebar k Backspace ? Spacebar k e y Spacebar - m a Spacebar h Enter UpArrow LeftArrow + Enter UpArrow LeftArrow LeftArrow LeftArrow RightArrow \ Enter l s Spacebar l i p Tab Backspace t Tab Backspace Backspace - l i Backspace Backspace Backspace Backspace Backspace l Backspace Spacebar - l i Tab Alt+h Ctrl+Backspace Ctrl+Backspace Ctrl+Backspace Ctrl+Backspace Ctrl+Backspace g m o Enter f d r e s Spacebar p s r e a d l i n e Enter f i l e h a s h RightArrow Ctrl+a RightArrow Ctrl+a Backspace g c p Spacebar f i l e h a s h Enter UpArrow Ctrl+LeftArrow g e t - Enter n i Spacebar t . t x t RightArrow Spacebar | Spacebar f i l e h a s h Spacebar - a Spacebar Alt+h Backspace Backspace a Tab Alt+h Ctrl+a Backspace f i l e h a s h Spacebar - a Tab Alt+h ### Exception Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference at CallSite.Target(Closure, CallSite, Object) at Microsoft.PowerShell.PSConsoleReadLine.WriteParameterHelp(Object helpContent) at Microsoft.PowerShell.PSConsoleReadLine.WriteDynamicHelpContent(String commandName, String parameterName, Boolean isFullHelp) at Microsoft.PowerShell.PSConsoleReadLine.DynamicHelpImpl(Boolean isFullHelp) at Microsoft.PowerShell.PSConsoleReadLine.ShowParameterHelp(Nullable`1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
Interestingly,
PSReadlineKeyHandler -Chord+<alt+h>returnsNo help content available. Please use Update-Help to download the latest help content.Below is the output from Dongbo using
Get-FileHashPS> $v | gm TypeName: MamlCommandHelpInfo#parameter Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() aliases NoteProperty string aliases=none defaultValue NoteProperty System.String defaultValue=SHA256 description NoteProperty psobject[] description=System.Management.Automation.PSObject[] globbing NoteProperty string globbing=false name NoteProperty System.String name=Algorithm parameterValue NoteProperty System.String parameterValue=System.String pipelineInput NoteProperty string pipelineInput=False position NoteProperty string position=1 required NoteProperty string required=false type NoteProperty MamlCommandHelpInfo#type type=@{uri=; name=System.String} variableLength NoteProperty string variableLength=true PS> $null -eq $v.type False PS> $v | fl name : Algorithm defaultValue : SHA256 type : @{uri=; name=System.String} parameterValue : System.String description : {@{Text=Specifies the cryptographic hash function to use for computing the hash value of the contents of the specified file or stream. A cryptographic hash function has the property that it is infeasible to find two different files with the same hash value. Hash functions are commonly used with digital signatures and for data integrity. The acceptable values for this parameter are: }, @{Text=- SHA1 }, @{Text=- SHA256 }, @{Text=- SHA384 }…} required : false variableLength : true globbing : false pipelineInput : False position : 1 aliases : none
Below is the output using
FileHash. Notice theTypeNameis different and$v.Typeis$null.PS> TypeName: HelpInfoShort Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() alertSet NoteProperty MamlCommandHelpInfo#alertSet alertSet=@{alert=System.Management.Automation.PSObject[]} Category NoteProperty string Category=Cmdlet Component NoteProperty object Component=null description NoteProperty psobject[] description=System.Management.Automation.PSObject[] details NoteProperty MamlCommandHelpInfo#details details=@{name=Get-FileHash; verb=Get; description=System.Management.Automation.PSObject[]; noun=FileHash} examples NoteProperty MamlCommandHelpInfo#examples examples=@{example=System.Management.Automation.PSObject[]} Functionality NoteProperty object Functionality=null inputTypes NoteProperty MamlCommandHelpInfo#inputTypes inputTypes=@{inputType=@{type=@{name=System.String}; description=System.Management.Automation.PSObject[]}} ModuleName NoteProperty string ModuleName=Microsoft.PowerShell.Utility Name NoteProperty string Name=Get-FileHash parameters NoteProperty MamlCommandHelpInfo#parameters parameters=@{parameter=System.Management.Automation.PSObject[]} PSSnapIn NoteProperty object PSSnapIn=null relatedLinks NoteProperty MamlCommandHelpInfo#relatedLinks relatedLinks=@{navigationLink=System.Management.Automation.PSObject[]} returnValues NoteProperty MamlCommandHelpInfo#returnValues returnValues=@{returnValue=@{type=@{name=Microsoft.PowerShell.Utility.FileHash}; description=System.Management.Automation.PSObject[]}} Role NoteProperty object Role=null Synopsis NoteProperty string Synopsis=Computes the hash value for a file by using a specified hash algorithm. syntax NoteProperty MamlCommandHelpInfo#syntax syntax=@{syntaxItem=System.Management.Automation.PSObject[]} xmlns:command NoteProperty string xmlns:command=http://schemas.microsoft.com/maml/dev/command/2004/10 xmlns:dev NoteProperty string xmlns:dev=http://schemas.microsoft.com/maml/dev/2004/10 xmlns:maml NoteProperty string xmlns:maml=http://schemas.microsoft.com/maml/2004/10 xmlns:MSHelp NoteProperty string xmlns:MSHelp=http://msdn.microsoft.com/mshelp PS> $null -eq $v.type True PS> $v | fl alertSet : @{alert=System.Management.Automation.PSObject[]} inputTypes : @{inputType=@{type=@{name=System.String}; description=System.Management.Automation.PSObject[]}} examples : @{example=System.Management.Automation.PSObject[]} syntax : @{syntaxItem=System.Management.Automation.PSObject[]} returnValues : @{returnValue=@{type=@{name=Microsoft.PowerShell.Utility.FileHash}; description=System.Management.Automation.PSObject[]}} details : @{name=Get-FileHash; verb=Get; description=System.Management.Automation.PSObject[]; noun=FileHash} parameters : @{parameter=System.Management.Automation.PSObject[]} relatedLinks : @{navigationLink=System.Management.Automation.PSObject[]} description : {@{Text=The `Get-FileHash` cmdlet computes the hash value for a file by using a specified hash algorithm. A hash value is a unique value that corresponds to the content of the file. Rather than identifying the contents of a file by its file name, extension, or other designation, a hash assigns a unique value to the contents of a file. File names and extensions can be changed without altering the content of the file, and without changing the hash value. Similarly, the file's content can be changed without changing the name or extension. However, changing even a single character in the contents of a file changes the hash value of the file. }, @{Text=The purpose of hash values is to provide a cryptographically-secure way to verify that the contents of a file have not been changed. While some hash algorithms, including MD5 and SHA1, are no longer considered secure against attack, the goal of a secure hash algorithm is to render it impossible to change the contents of a file -- either by accident, or by malicious or unauthorized attempt -- and maintain the same hash value. You can also use hash values to determine if two different files have exactly the same content. If the hash values of two files are identical, the contents of the files are also identical. }, @{Text=By default, the `Get-FileHash` cmdlet uses the SHA256 algorithm, although any hash algorithm that is supported by the target operating system can be used.}} xmlns:maml : http://schemas.microsoft.com/maml/2004/10 xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10 xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10 xmlns:MSHelp : http://msdn.microsoft.com/mshelp Name : Get-FileHash Category : Cmdlet Synopsis : Computes the hash value for a file by using a specified hash algorithm. Component : Role : Functionality : PSSnapIn : ModuleName : Microsoft.PowerShell.Utility
Using
PSReadLineKeyHandleras the cmdlet, has the same output asFileHash. It does not throw the error though.Alias -Namedoes fail in the same way too.
Prerequisites
Exception report
Screenshot
Environment data
Steps to reproduce
Insert any commandlet with parameter, don't press Enter. Press Alt+h to get a hint. The exception occurs both in the terminal and in the console.
Expected behavior
Expecting to receive a short hint on the parameter
Actual behavior
We get an exception