Hello, I have spent over a day trying to resolve an intermittent issue. I am unable to recreate this issue in a sample app, nor am I able to recreate it with any real consistency. But I’m hoping you can make a suggestion to help me out, so here it goes…
LoginForm contains a user/password text box and a login button. Upon successful login, LoginForm fires an event. Here is the relevant code from Program.cs
static void Main()
LogonForm logonForm = new LogonForm();
logonForm.Authenticated += LogonForm_Authenticated;
private static void LogonForm_Authenticated(object sender, EventArgs e)
MainForm mainForm = new MainForm();
MainForm does a ton of crap on load. It builds a main menu, checks security, runs multiple database queries. Our current VWG app takes 5-ish seconds to load the form after login.
But roughly 75% of the time, MainForm displays as an empty form (in WiseJ). The main menu is there and can be used to open screens. But the “NewsPage” (our default page we display after login, contains a datagrid and html panel) is not shown. About 20% of the time it is shown perfectly. About 5% of the time I get 3-15 error message boxes saying “Component not found” (I have no idea which component) and then an empty MainForm.
And, to add to this gripping mystery, if I add a breakpoint anywhere during the MainForm load logic, the NewsPage is displayed perfectly.
I’ve tried everything I can think of. I cannot (so far) recreate the issue in a sample app. I cannot get any of those three failures to happen with any consistency. I’ve tried (just to name a few):
– Displaying another page on login (besides NewsPage)
– Adding timers to throw events to load the NewsPage 5 seconds after FormLoad is complete
– Using ShowDialog() instead of Show()
– Loading the NewsPage into MainForm after instantiation but before FormLoad
– Adding LogonForm to a desktop control
And what feels like 100 things over the past day and a half. If you have any other suggestions please let me know.
Frank, I have successfully recreated the issue in a sample app. I just emailed it to you, please confirm you received it.
The app consists of two forms and a single user control. Window1 contains a single login button, which fires an event to display Window2. On Window2_Load I call the function “LoadACrapTonOfUserControls()” which instantiates UserControl1 20 times using this line.
object hostObject = Activator.CreateInstance(typeof(UserControl1));
This causes UserControl1 to not be displayed in Window2. If you comment out the “LoadACrapTonOfUserControls()” function, UserControl1 is displayed properly. This exactly recreates the issue we have in our application.
Now it’s time for an early happy hour.
it´s possible that we are already working on a related issue and it could already be fixed in our build.
Are the long running tasks invoked in your MainForm on load ? We will try to reproduce the problem on our side.
A screen capture video could help, please send it to email@example.com , thanks !
I will contact you privately if we need more information or a webex session to track it down.