MainWindow not on top after splash screen closes


I just built the entire code. Upon launching the sample application from within VS by pressing F6 (Start without Debugging):
  • splash screen presents itself on top of the z order (ie on top of VS)
  • splash screen shows module 1..3
  • splash screen closes
  • mainwindow is shown briefly (in fact so breifly that it's just a flash)
  • mainwindow is now hidden behind VS (but not behind any other window covering the desktop)
    If I remove the splash screen code, everything works as expected.