Why does Application exit using this code?

Topics: Prism v2 - WPF 3.5
Oct 26, 2009 at 7:29 PM


Using the Prism libraries I have this code in the App.OnStartup:

        protected override void OnStartup(StartupEventArgs e)

            LoginWindow l = new LoginWindow();
            Nullable<bool> dialogResult = l.ShowDialog();

            BootStrapper bootStrapper = new BootStrapper();


Without the LoginWindow code in place the bootStrapper (derived from UnityBootStrapper) runs as expected and displays the shell. With the LoginWindow code inserted the bootstrapper code still executes but on completion the whole application exits. Why?

Oct 27, 2009 at 9:46 PM


I've created a post about this, that provides two sample applications to better understand what happens with your application.

I hope that this answer helps you. Your feedback is really appreciated.

Fernando Antivero

Oct 28, 2009 at 10:29 AM


Thank you for the explanation! I guess I should have been looking to normal WPF behaviour rather than Prism for the cause of the problem!

In practice I may or may not want the application to exit after the Dialog closes but now that I understand what's going on that shouldn't be a problem.

Thank you again for the assistance, Best,