views:

45

answers:

1

I'm wondering what happens after the constructor is done executing my code, because the constructor is taking like 10 seconds to run on a cold start up, but according to the profiler, my code is done executing in like 2 seconds.

Also stepping through the code in the debugger, after the last line of my constructor, I sit there and wait for 7-8 seconds before the window appears. Why is this?

If the window is loading content or something, why isn't it displayed on the screen, done loading or not after the constructor finishes it's job? What's the hold up? (or how do i figure that out)

+1  A: 

Once your constructor has run, it has built all the UI elements needed for the window. However it still needs to do several things:

  • Run a measure and layout pass to put the UI elements in the right place
  • Resolve any data bound values
  • Load, decode and resize images on the window
  • Do the actual rendering

If your problem was in the render thread (includes image loading), you'd see an unresponsive window "shell" rather than no window at all, so I don't think the problem is there. Having something take a long time fetching a data bound value or simply having a complex layout seem like likely causes to me.

One other thing to check would be to see if your CPU is pegging or if you're hitting the disk a lot during those 7-8 seconds. Might give you some clues of where to look.

RandomEngy