Skip to content

New-ExternalHelp produces corrupted output XML if a paragraph in a .md file exceeds 10,000 characters #777

@dsporov

Description

@dsporov

Prerequisites

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

Steps to reproduce

I'm experiencing a problem with the New-ExternalHelp сmdlet when one of the markdown files specified in the Path argument contains a paragraph longer than 10,000 characters. In this case, the resulting XML file (specified in the OutputPath argument) gets corrupted.

The issue is caused by the hardcoded longestExpectedParagraphSpan limit (reference, which restricts the string length sent to Regex.Match to 10,000 characters.
Removing this limit resolves the problem.

Expected behavior

'New-ExternalHelp' should work correctly regardless of paragraph length in the input .md file.

Actual behavior

'New-ExternalHelp' produces a corrupted .xml output file if any paragraph in the input .md file exceeds the 10,000-character limit.

Error details

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.20348.3932
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.3932
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

0.14.2

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions