Skip to content

Commit 36893ee

Browse files
authored
Fix parameter dynamic help when the help content is specified in ParameterAttribute (#3370)
1 parent 0ac6c07 commit 36893ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

PSReadLine/DynamicHelp.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ private void WriteParameterHelp(dynamic helpContent)
198198
{
199199
Collection<string> helpBlock;
200200

201-
if (string.IsNullOrEmpty(helpContent?.Description?[0]?.Text))
201+
if (helpContent?.Description is not string descriptionText)
202+
{
203+
descriptionText = helpContent?.Description?[0]?.Text;
204+
}
205+
206+
if (descriptionText is null)
202207
{
203208
helpBlock = new Collection<string>()
204209
{
@@ -216,7 +221,7 @@ private void WriteParameterHelp(dynamic helpContent)
216221
string.Empty
217222
};
218223

219-
string text = helpContent.Description[0].Text;
224+
string text = descriptionText;
220225
if (text.Contains("\n"))
221226
{
222227
string[] lines = text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

0 commit comments

Comments
 (0)