Hi,
I'm facing an issue where my code is working inside Visual Studio, but failing when I build the application and run it. I have tried Googling for code alternatives to where I've tracked the bug down to, and I can't find anything that works the way I need it to.
Here is my code:
this.console.addLine("Create Notification invoked: " + mainForm.IsHandleCreated.ToString());
mainForm.BeginInvoke((MethodInvoker)delegate() {
this.console.addLine("Started");
Notification noti = new Notification();
noti.setQueue(this);
//noti.setInformation(match);
noti.test(match);
this.notifications.Add(noti);
this.showNext();
this.console.addLine("Creating notification ID... " + noti.GetHashCode().ToString());
});
(console.addLine is a custom output method, which works).
So when I run the application inside Visual Studio I get the first line of "Create Notification invoked: True", then I get a line which says "Started" and it all works fine. But if I build the application and run it outside of Visual Studio, I only get the first line "Create Notification invoked: True". I don't get the "Started" line, and it doesn't create the new Notification form instance.
Help is greatly appreciated,
Thanks!
EDIT:
I should probably also mention that 'mainForm' is set to a new Form1 (startup form);public static Form1 mainForm = new Form1();