1

Resolved

Thread race condition between UI thread and BackgroundWorker thread

description

In InformationDialog and ExportDialog forms there is a race condition between the BackgroundWorker thread and the UI thread. The worker thread starts updating the UI before ShowDialog method is called which results in the following exception:
 
System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at GK.SportTracks.AttackPoint.UI.ExportDialog.UpdateProgress(String message) in

comments