our organization just started the PoshUD journey, but we are already facing a couple of issues. This thread is about the most problematic issue.
We are running PoshUD 2.9.0 as a Windows Service.
On the dashboard we have multiple sites in place with multiple UD-Charts.
The charts are loading properly and visualize the correct data.
But as soon I start to jump through the pages or reload the page, all the chart data is gone.
And interestingly the chart data is not just gone in the same browser session, the charts are completely broken for everyone.
This is my code of one of the charts (this is actually part of the Active Directory Dashboard)
Can you confirm that the -id on this element is definitely unique (no other elements use this).
How do you set $Cache:Users? Where is the data being populated? I had a similar issue once and had coded a ‘refresh’ of the data on page load but that was causing me problems - I ended up moving it to a scheduled endpoint instead.
If you use the admin mode console to physically inspect the contents of $Cache:Users at the time your chart is empty, you may be able to confirm if the issue is here or not.
As I wrote before I’m loading multiple endpoints. They are all pulling similar data from different domains. But I made sure they are using different variables. Not sure if this might have an impact on this issue.
I’d say then it’s almost certainly not an issue with your page/elements on that page - but the way in which the endpoint is handling and pushing the data (providing you don’t have any other code on your page interacting with the same cache variable in a writable way.)
If you recycle your app pool and start fresh, is the data always loaded on first run? are you able to identify if it’s after 60mins when it goes blank - in keeping with your schedule? or does it seem sporadic/random?
I’ve never tried calling files this way into the endpoint, i dot source although i suppose there shouldnt be any difference.
Have you always had this issue with this particular chart? or is it something you have recently noticed? After any recent code changes etc? Just trying to narrow down where we need to be looking…
Also, I know the thing is wrapped in a try catch, but have you tried using -erroraction stop just in case there’s a non terminating error catching you out? or maybe put an if statement around where you’re setting the cache variable to check that the data you put through isn’t null/empty at that point.
Either way you could also put some sort of write out to a log file of your own in your endpoint with a datetime and count of the data in your cache. That way, you’d know exactly when its being set and what with, should shed some light on it.