Code and form updates out of sync and controls disappearing

I'm building an application that works with the SAP Universe Designer SDK (which may or may not matter to this issue). It loops through several collections in a BusinessObjects universe and builds tables of information to put into a database.

For each part, there may be several thousand iterations. At the beginning it sets a progress bar with the Value=0 and Maximum=number of iterations for the loop. As the loop runs, it increments the progress bar by 1 and sets a label text to show "X of Y objects…" There's also a text box that shows "Checking object X". At the end of each part, the label's Text is set to an empty string and the progress bar is hidden and set to Value=0. It works as expected…mostly. Sometimes the progress bar and label don't update in sync with the text box and the rest of the application's progress. On the last part, which usually has way more iterations than the previous loops, the progress bar seems to update correctly but the label just disappears.

When I step through the code, the changes that should happen to the form from a line of code sometimes don't happen at all or happen later. Objects' values show up correctly when I'm debugging in the code, but the form doesn't display as expected. The label's properties show Visible=true and the Text property contains correct values, but the label just straight-up disappears from the form.

I thought maybe the Universe Designer instance is holding something up, but even after the form doesn't update right, the log.txt that the application writes shows that all of the expected operations were completed by the Designer and all universe info was collected. I enabled breaking on all exceptions and found that no exceptions were thrown either.

What am I missing? Is there too much going on or something that's keeping the form from updating in a timely manner (or not at all)? Any suggestions on how I might troubleshoot?

Thanks!

by toumei64 via /r/csharp

Leave a Reply