Skip to content

Length error on some logic app definitions #46

@gooseleggs

Description

@gooseleggs

Describe the bug
If the actionName has a length < 5, for example a Tri scope, then you will receive the following error message:

Where-Object : Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero.
Parameter name: length"
At C:\temp\gooseleggs-logicappdocs\logicappdocs\src\Helper.ps1:276 char:76
+ ... ($Actions | Where-Object { $_.RunAfter -eq $(('{0}-False') -f $(($cur ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Where-Object], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentOutOfRangeException,Microsoft.PowerShell.Commands.WhereObjectCommand

This is caused by the line

                # Current error is that there can be an newly created action that does not have a parent property.???
                elseif (($null -ne $currentAction.Parent) -and ($Actions | Where-Object { $_.RunAfter -eq $(('{0}-False') -f $(($currentAction.Parent).Substring(0, ($currentAction.Parent).length - 5))) } )) {

in `helper.ps1. This is because the it is assumed that the length of the string is at least 6 characters long, which is not always the case.

To Reproduce
Steps to reproduce the behavior:
Use a logicApp definition where the actionName is < 5 characters

Expected behavior
Should not error out

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions