Recently I modified an application adding a splash screen. I decided to use WindowsFormsApplicationBase so I put all the heavy initialization logic inside
protected override void OnCreateMainForm()
On some computers all successive executions of the application after the first one cause the splash screen to be visible forever and main form is not displayed. I searched on internet to find a solution but it seems that after some bug fixes WindowsFormsApplicationBase is currently well trusted. So I did the educated guess that the race condition which causes my splash to remain on screen is related to something specific of my application. During initialization I write some progress signs on the splash with the following method:
public void showCurrentLoadStep(string message)
{
if (this.mySplash.IsHandleCreated)
{
this.mySplash.Invoke(new EventHandler(delegate
{
mySplash.label1.Text = message;
}));
}
}
but I think this is ok.
Besides the last operation done in the MainForm constructor is
timer1.Enabled = true;
I verified that the timer callback is executed also when the splash remains and MainForm is not displayed.
What I'm going to try is to move timer1.Enabled = true; after the creation of MainForm but I would like to understand what goes wrong because, as I have already said, this race condition happens only on some computers so if I don't see it any more I cannot say I have solved it.
Update: I'm using .net framework 4.0 extended