Ive got a UI and within it, a BackgroundWorker
.
While the BackgroundWorker
is running, it updates the UI by way of Marshalling. During one of the runs, the UI was unresponsive. I hit the pause button in Visual Studio to see what was going on.
The following lines were shown to be running in the Threads window:
Application.Run(new uxRunSetup());
private delegate void DisplayCounterHandler(int[] counts, int total);
private void DisplayCounter(int[] counts, int total) { if (InvokeRequired) { //stuck on Invoke below. Invoke(new DisplayCounterHandler(DisplayCounter), counts, total); return; } //some UI updates here. }
Ive been reading through this thread. My question is, lets say the call to DisplayCounterHandler
has been made. However, the BackgroundWorker has already completed. Could this cause the UI to be unresponsive and crash?
Thanks.