Unable to Render in Tables and Datagrids

Product: PowerShell Universal
Version: 4.0.2

I am unable to use the render parameter in datagrids and tables. No matter what I try to render. It can be -render { new-udtypography “Hello World” } and it will generate the same error. I’ve tried both the sample tables found in docs.powershellunviersal.com but the same errors persist.

“Self referencing loop detected for property ‘parent’ with type ‘System.Management.Automation.Language.CommandAst’. Path ‘[0].content[0].columns[3].render.ast.endBlock.statements[0].pipelineElements[0].commandElements[0]’.”

This is within a udstepper.

The same script is working on another server with the same verison of PSU installed 4.0.2.

If I remove the render paramenter, the table and datagrids load fine.

Any help would be appreciated.

Regards,

Stumped

First off, your running a 2+ year old version of PSU (6/25/23) and officially 101 versions behind the most current version. #1 I would recommend, at a minimum, upgrading to the most recent version of 4.X which would be 4.5.5 (7/25/25). There were a number of table/grid render fixes since your 4.0.2. Such as:

4.1.7 - 10/23/2023
Fixed an issue with variable scoping in rendered table rows (#2776)

4.3.4 - 7/29/2024
Fixed an issue with data grid columns not rendering properly (#3443)

4.4.1 - 10/1/2024

Fixed an issue rendering a nested table.

Fixed a rendering issue with dropdown buttons in a data grid cell (#3327)

That being said, if this works on another server running the same version then I would try to re-install PSU. Also try creating a new page with just that render example to see if maybe their is something else in your page code that is messing things up.

New-UDPage -Url “/Test” -Name “Test” -Content {$Data = @(@{Dessert = ‘Frozen yoghurt’; Calories = 1; Fat = 6.0; Carbs = 24; Protein = 4.0 }@{Dessert = ‘Ice cream sandwich’; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }@{Dessert = ‘Eclair’; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }@{Dessert = ‘Cupcake’; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }@{Dessert = ‘Gingerbread’; Calories = 200; Fat = 6.0; Carbs = 24; Protein = 4.0 })
$Columns = @(
    New-UDTableColumn -Property Dessert -Title Dessert -Render { 
        New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert } 
    }
    New-UDTableColumn -Property Calories -Title Calories 
    New-UDTableColumn -Property Fat -Title Fat 
    New-UDTableColumn -Property Carbs -Title Carbs 
    New-UDTableColumn -Property Protein -Title Protein 
)

New-UDTable -Data $Data -Columns $Columns -Sort -Export
}