UD.Community - Problem with Refreshing Page

Hello there,

i’ve a problem. My Dashboard has 2 Charts and 2 Grids. The Data comes from an rest API via Schedulded Enpoint that is updated every 30 Seconds. The Data is saved in $Cache:Variables and used in the Page for the Charts and Grids. I used the Sample AD Dashboard as a “Template”. The Problem is in My Dashboard as well as in the Active Directory Dashboard Example from Adam.

The first Call from the Start Page works fine. Charts and Grids are loaded.

When i hit F5 to refresh the Page manually the Charts go empty and the Grids shows an Error “The listing has been changed. The enumeration operation may not be performed.”. When i hit F5 again sometimes the Grid or the Charts , sometimes both of the Elements are showing Data again. Same happens when i load another dashbaord page and then come back to my start page.

I’m running the UD Dashboard on Windows 2016 through Powershell not IIS.

When i use the Code from the New-UDEndpoint directly in the Charts Endpoint Parameter for example. The Dashboard needs a long time to load but the data is always loaded. I think it has something to do with the Cache Handling.

Some Example Code:

Endpoint:

New-UDEndpoint -Endpoint {
try
{

    Initialize-bConnect -Server $Cache:Server -Credentials $Cache:Credentials -AcceptSelfSignedCertificate

    $Jobs = Get-bConnectJob

    $Cache:Jobs = @{
        Windows = $($Jobs | Where {$_.CanRunOnMobileDevice -eq $False}).Count
        Mobile  = $($Jobs | Where {$_.CanRunOnMobileDevice -eq $True}).Count
    }.GetEnumerator()

}
catch
{
    $Cache:Error = "Failed to load bConnect data. $_"
}
finally
{
    $Cache:Loading = $false
}
} -Schedule (New-UDEndpointSchedule -Every 30 -Second)

Page:

New-UDPage -Name "Home" -Icon home -Content {
    New-UDRow -Endpoint {
        New-UDColumn -Size 12 -Content {
            if ($Cache:Loading)
            {
                New-UDPreloader -Circular
            }
            elseif ($Cache:Error -ne $null)
            {
                New-UDCard -Title "Error loading data" -Content {
                    $Cache:Error
                }
                New-UDCard -Title "Test" -Content {
                    $Cache:Test
                }
            }
            else
            {
                New-UDRow -Columns {
                    New-UDColumn -SmallSize 12 -MediumSize 6 -LargeSize 4 -Content {
                        New-UDChart -Type Doughnut -Title "Jobs nach Art" -Endpoint {
                            $Cache:Jobs | Out-UDChartData -DataProperty 'Value' -LabelProperty 'Name' -BackgroundColor $Cache:ChartColorPalette
                        } -AutoRefresh -RefreshInterval 60
                    }
                }
            }
        }
    }
}

Hmmm this may be a bit of an issue with how cache variables work. If you increase the interval on the scheduled endpoint do you still experience the problem? Try cranking it up to like 5 minutes just for test purposes.

I set the Interval for the Endpoint to 5 Minutes. But that dosn’t solved the problem.

Even when i use other Data in the Grid, for example Data from Get-Process or Get-Childitem i’ve always the problem that the grid or the chart produces no output or the error “ The listing has been changed. The enumeration operation may not be performed .”

Can you reproduce the error in your environment?