Skip to content

Export-MamlCommandHelp Error - Index was outside the bounds of the array. #732

@sdwheeler

Description

@sdwheeler

Prerequisites

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

Steps to reproduce

PSConsoleHostReadLine is a function in the PSReadLine module. Import the markdown file and export it to MAML.

PSConsoleHostReadLine.md

PS> Import-MarkdownCommandHelp -Path .\PSReadLine\PSConsoleHostReadLine.md |
    Export-MamlCommandHelp -OutputFolder '.\maml' -Force

Expected behavior

Create a MAML file containing the documentation of the function.

Actual behavior

Export-MamlCommandHelp:
Line |
   2 |      Export-MamlCommandHelp -OutputFolder '.\maml' -Force
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Index was outside the bounds of the array.

Error details

Get-Error

Exception             :
    Type       : System.IndexOutOfRangeException
    TargetSite :
        Name          : ThrowIndexOutOfRangeException
        DeclaringType : [Internal.Runtime.CompilerHelpers.ThrowHelpers]
        MemberType    : Method
        Module        : System.Private.CoreLib.dll
    Message    : Index was outside the bounds of the array.
    Source     : System.Private.CoreLib
    HResult    : -2146233080
    StackTrace :
   at Microsoft.PowerShell.PlatyPS.MAML.MamlConversionHelper.ConvertCommandDetails(CommandHelp commandHelp) in
D:\Git\PS-Src\platyPS\src\MamlWriter\MamlHelpers.cs:line 220
   at Microsoft.PowerShell.PlatyPS.MAML.MamlConversionHelper.ConvertCommandHelpToMamlCommand(CommandHelp commandHelp)
in D:\Git\PS-Src\platyPS\src\MamlWriter\MamlHelpers.cs:line 54
   at Microsoft.PowerShell.PlatyPS.MAML.MamlConversionHelper.ConvertCommandHelpToMamlHelpItems(List`1 commandHelp) in
D:\Git\PS-Src\platyPS\src\MamlWriter\MamlHelpers.cs:line 43
   at Microsoft.PowerShell.PlatyPS.ExportMamlCommandHelpCommand.EndProcessing() in
D:\Git\PS-Src\platyPS\src\Command\ExportMamlCommandHelp.cs:line 86
   at System.Management.Automation.CommandProcessorBase.Complete()
CategoryInfo          : NotSpecified: (:) [Export-MamlCommandHelp], IndexOutOfRangeException
FullyQualifiedErrorId : System.IndexOutOfRangeException,Microsoft.PowerShell.PlatyPS.ExportMamlCommandHelpCommand
InvocationInfo        :
    MyCommand        : Export-MamlCommandHelp
    ScriptLineNumber : 2
    OffsetInLine     : 5
    HistoryId        : 60
    Line             :     Export-MamlCommandHelp -OutputFolder '.\maml' -Force

    Statement        : Export-MamlCommandHelp -OutputFolder '.\maml' -Force
    PositionMessage  : At line:2 char:5
                       +     Export-MamlCommandHelp -OutputFolder '.\maml' -Force
                       +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Export-MamlCommandHelp
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

Environment data

Microsoft.PowerShell.PlatyPS built from latest commit in v2 branch - 33b90b4

Visuals

No response

Metadata

Metadata

Labels

Area-MAMLIssue concerns conversion to MAMLResolution-FixedThe issue is fixed.

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions