Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty markdown out of bounds exception #516

Closed
BernieWhite opened this issue Aug 6, 2020 · 0 comments · Fixed by #532
Closed

Empty markdown out of bounds exception #516

BernieWhite opened this issue Aug 6, 2020 · 0 comments · Fixed by #532
Assignees
Labels
bug Something isn't working
Milestone

Comments

@BernieWhite
Copy link
Member

BernieWhite commented Aug 6, 2020

Description of the issue

When rule markdown help .md is an empty file, PSRule returns an exception.

Expected behaviour

PSRule should provide a more specific error or just not return any help.

Error output

Exception             :
    Type       : System.IndexOutOfRangeException
    TargetSite : Void .ctor(System.String)
    StackTrace :
   at PSRule.Parser.MarkdownStream..ctor(String markdown) in /home/vsts/work/1/s/src/PSRule/Parser/MarkdownStream.cs:line 97
   at PSRule.Parser.MarkdownReader.Read(String markdown, String path) in /home/vsts/work/1/s/src/PSRule/Parser/MarkdownReader.cs:line 82
   at PSRule.Commands.NewRuleDefinitionCommand.TryDocument(String path, RuleDocument& document) in /home/vsts/work/1/s/src/PSRule/Commands/NewRuleDefinitionCommand.cs:line 162
   at PSRule.Commands.NewRuleDefinitionCommand.GetHelpInfo(RunspaceContext context, String name) in /home/vsts/work/1/s/src/PSRule/Commands/NewRuleDefinitionCommand.cs:line 145
   at PSRule.Commands.NewRuleDefinitionCommand.ProcessRecord() in /home/vsts/work/1/s/src/PSRule/Commands/NewRuleDefinitionCommand.cs:line 75
   at System.Management.Automation.CommandProcessor.ProcessRecord()
    Message    : Index was outside the bounds of the array.
    Source     : PSRule
    HResult    : -2146233080
CategoryInfo          : NotSpecified: (:) [Invoke-PSRule], IndexOutOfRangeException
FullyQualifiedErrorId : System.IndexOutOfRangeException,Invoke-PSRule

Module in use and version:

  • Module: PSRule
  • Version: 0.19.0

Captured output from $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@BernieWhite BernieWhite added the bug Something isn't working label Aug 6, 2020
BernieWhite added a commit to BernieWhite/PSRule that referenced this issue Aug 30, 2020
@BernieWhite BernieWhite added this to the v0.20.0 milestone Aug 30, 2020
@BernieWhite BernieWhite self-assigned this Aug 30, 2020
This was referenced Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant