Skip to content

PlatyPS cmdlets don't work with PSReadLine focused parameter help (ShowParameterHelp) #802

@pewill

Description

@pewill

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

When I try to get help for PlatyPS cmdlet parameters (like New-CommandInfo -CommandInfo and press ALT+h) it throws and error.
Repro:

Update-Help -Module Microsoft.PowerShell.PlatyPS # make sure not to use the autogenerated help
New-CommandHelp -CommandInfo # press ALT+h when cursor is at the end of -CommandInfo parameter to trigger ShowParameterHelp function

I think it can be related to #801 (if the PlatyPS help is generated with PlatyPS itself) since PSReadline expects a default value and it is typically set to None if it is not provided. https://github.com/PowerShell/PSReadLine/blob/ceaad10f3d49df1b62957cf282f15b5a2fb2017f/PSReadLine/DynamicHelp.cs#L238C14-L238C226

Expected behavior

The focused parameter help should be shown for the parameter

Actual behavior

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.26100
BufferWidth: 120
BufferHeight: 30

Last 145 Keys:

 h e l p Spacebar n e w - c o m m a n d h Tab Enter
 n e w - c o m m a n d h e Tab Spacebar - Tab Spacebar Backspace Alt+h Escape Escape U p d a t e - H e l - Backspace p Spacebar - p l Tab Backspace Backspace Backspace - m o Tab Spacebar M i c r o s o f t . P o w e r S h e l l . P l a t Tab Enter
 h e l p RightArrow Enter
 n e w - c o m m a n d Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace n e w p Backspace - c o m m a n Tab Spacebar - Tab Alt+h

### Exception

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
   at CallSite.Target(Closure, CallSite, Object)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
   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.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

1.0.1

Visuals

No response

Metadata

Metadata

Labels

Area-MAMLIssue concerns conversion to MAML

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions