Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blend does not call DesignTimeBootstrapper

I need Blend 4 to call some initialization code before it reasonably can display my application and I am using this approach by Josh Smith to get it done.

I am using the following project structure:

MainProgram
  -- Properties
     -- AssemblyInfo.cs (including the custom attribute)
  -- App.xaml
  -- HostWindow.xaml    (UserControls are embedded here)
  -- DesignTimeBootstrapperAttribute.cs

ViewsAssembly
  -- Lots of user controls

For some reason, the design time bootstrapper is not called after every build (leading to my custom markup extensions throwing exceptions and lots of error messages in Blend). It is however called when initially loading the solution, and I don't understand the way Blend behaves here.

What am I doing wrong, or is there another approach?

Edit: I've noticed that doing a complete rebuild does call the Bootstrapper every time. Maybe that will work as a workaround, but I still would like to understand it.

like image 704
Jens Avatar asked Oct 21 '22 16:10

Jens


1 Answers

Can you verify, that you really have the Main App's Assembly binaries changed after rebuilds which do not execute the start-up? (I'd expect Blend not to evaluate reflection if the binaries do not change). I'd also try solution clean and than rebuld.

As a heavy work-around you might consider changing solution/project file (say, add a space) in a post-build event which will cause Blend to reload the solution and execute your custom start-up code again.

As a side note, my experience with VS XAML UI Designer process (xDesProc) shows that it does not always catch the changes I make after re-build and I have to kill it using task manager to force reloading, sme may happen with blend.

like image 93
Isantipov Avatar answered Oct 30 '22 00:10

Isantipov