Customization Auto Cycle through tabs

This may be more of a C# issue than Epicor, but I’m struggling to understand what part in the Epicor dashboard is breaking. I have a dashboard with 7 tabs. I’m using a BackgroundWorker to cycle through each tab after 30 seconds, assuming it would be safer and be more stable to be timing on a different asynchronously. It cycles fine, for about 1 and a half to 2 cycles through. Then it will error out with this exception:

Application Error

Exception caught in: Infragistics4.Win.v12.2

Error Detail 
============
Message: Object reference not set to an instance of an object.
Program: Infragistics4.Win.v12.2.dll
Method: VerifyChildElements

Client Stack Trace 
==================
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
   at Infragistics.Win.UltraWinDock.PaneControlAreaUIElement.PositionTabPanes(Rectangle workRect, DockableGroupPane group, UIElementsCollection oldElements)
   at Infragistics.Win.UltraWinDock.PaneControlAreaUIElement.PositionChildPanes(Rectangle workRect, DockableGroupPane group, UIElementsCollection oldElements)
   at Infragistics.Win.UltraWinDock.PaneControlAreaUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinDock.WindowDockingAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.ManagedContainerControlBase.OnPaint(PaintEventArgs pe)
   at Infragistics.Win.UltraWinDock.WindowDockingArea.OnPaint(PaintEventArgs pe)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I’m not really sure what’s up with this, because it appears that it’s the ViewListPanel that is erroring out. It disappears and the tabs disappear, and it instead becomes white with a red X through it, like a display error, or more familiar to most of you, like the red X you get when you don’t fill in a mandatory dropdown field in Business Activity Query when adding a new row in the designer.

Then it will continue cycling until the end of the cycle, and I’m not sure if it’s on the updatable query refresh that the grids start returning empty. Do grids get destroyed after an updatable refresh?
*update, it isn’t at the end of any specific cycle, or after any specific query refresh, the query (not the grid because I have gauges zeroing out as well) randomly starts returning no data, sometimes many cycles after it throws the exception.

I set up my worker.

public class Script
{
	BackgroundWorker work = new BackgroundWorker(); 

I initialize the worker’s DoWork

public void InitializeCustomCode()
{
       work.DoWork += new DoWorkEventHandler(work_DoWork);

(also have the relevant destroy custom code)

This is to kickstart the cycle when the dashboard launches.

private void edvV_DPSParkingLot2RO_1View1_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
    	work.RunWorkerAsync();

	}

Lastly, I cycle through the tabs indefinitely. (ignore the comments, the intervals have been adjusted)

	void work_DoWork(object sender, DoWorkEventArgs e)
    {
			parking.Focus();
	    	System.Threading.Thread.Sleep(1 * 30 * 1000);  // Wait one minutes
	        line1.Focus();
	    	System.Threading.Thread.Sleep(1 * 30 * 1000);  // Wait one minutes
	        line2.Focus();
	    	System.Threading.Thread.Sleep(1 * 30 * 1000);  // Wait one minutes
	        line3.Focus();
	    	System.Threading.Thread.Sleep(1 * 30 * 1000);  // Wait one minutes
	        line4.Focus();
	    	System.Threading.Thread.Sleep(1 * 30 * 1000);  // Wait one minutes
	        line5.Focus();
	    	System.Threading.Thread.Sleep(1 * 30 * 1000);  // Wait one minutes
	        hand.Focus();
	    	System.Threading.Thread.Sleep(1 * 15 * 1000);  // Wait one minutes
			work_DoWork(sender,e);
    }

Screenshots of the “red x” area before data is lost, about 4-5 cycles in. Exception occured on second cycle.

Screenshot of the errored out data (happened at beginning of a cycle, so maybe it does happen at beginnings?

A couple things I have found out:

A lot of the UI is causing background workers I create to be busy. When I force them to become unbusy, things bug out, such as Filters, refresh, the tabs, etc. Not really sure what a solution would be besides using background workers, otherwise the screen locks up well before grids and gauges are aligned in the proper spots.