ExecutionEngineException when calling Application.Run
-
I'm trying to do a simple thing and WPF doesn't allow me to. I want to show a login form before running the main form. The login does run but the main form doesn't. It throws an ExecutionEngineException with message “Exception of type 'System.ExecutionEngineException' was thrown.” with no inner exception. I hope someone tell me the right way to do it before I turn to a workaround. Thank you in advance.
public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var login = new Login(); // a wpf window if (login.ShowDialog() == true) { var main = new MainForm(); // a wpf window Run(main); // exception here, .Show doesn't work, .ShowDialog doesn't work } } }
Eslam Afifi
-
I'm trying to do a simple thing and WPF doesn't allow me to. I want to show a login form before running the main form. The login does run but the main form doesn't. It throws an ExecutionEngineException with message “Exception of type 'System.ExecutionEngineException' was thrown.” with no inner exception. I hope someone tell me the right way to do it before I turn to a workaround. Thank you in advance.
public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var login = new Login(); // a wpf window if (login.ShowDialog() == true) { var main = new MainForm(); // a wpf window Run(main); // exception here, .Show doesn't work, .ShowDialog doesn't work } } }
Eslam Afifi
It turned out to be a low memory issue since I was running a virtual machine on a 1 GB RAM :doh:. Sorry if I wasted your time. .Show works so does .ShowDialog .Run doesn't since it's not what it is intended to do.
Eslam Afifi