New Posts New Posts RSS Feed: Cocktail probing exe files
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Cocktail probing exe files

 Post Reply Post Reply
Author
JohnBloom View Drop Down
Groupie
Groupie
Avatar

Joined: 30-Nov-2010
Location: Topeka, KS
Posts: 95
Post Options Post Options   Quote JohnBloom Quote  Post ReplyReply Direct Link To This Post Topic: Cocktail probing exe files
    Posted: 09-Aug-2012 at 10:29am
We had a problem recently that had us stumped for a whole day. We switched to a continuous integration model for our server side WPF application. The CI uses build scripts to compile and deploy every checkin. It compiles everything into a buildartifacts folder and then we take the build and generate an installer. One of the keys to this problem is that we had three separate executables that needed to be deployed together. 

However, our apps stopped working when we deployed them. They would crash without an error message and we would have to look at event viewer to see the crash report. We eventually found the problem to be that MEF was probing the other exe files and we had a EntityManagerFactory export per app. The app would fail because it was only expecting one import but found many. We also had the habit of naming the first viewmodel MainViewModel. This would fail as well because the bootstrapper would find multiple imports for the one view model it was expecting.

Two questions arise from this. 

First, our WPF error handling is lacking and I was wondering if there is a way to catch all errors, even ones as early as importing the VM into the bootstrapper, and show them without having to go to event viewer (which was not helpful at all). 

Second, why is Cocktail probing other exe files (or is this a MEF default). Shouldnt it only probe dlls? It seems like if you have code you would like to share it should be in a dll and not in an exe.
-John Bloom
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 09-Aug-2012 at 1:26pm
Are you handling the unhandled exceptions in the boostrapper? That's where you should be able to catch everything unless Caliburn.Micro eats up the exception if it can't find the root view model. I have to look at this.
 
On the probing topic, that's a DevForce/MEF thing. Because there is no manifest in WPF, the only way DevForce/Cocktail can build up the catalog is by probing every assembly in the same folder as your exe. That's the default behaviour. MEF doesn't differentiate between exe and dll, they are all just assemblies. This is actually a powerful feature, because it allows you to have a plug-in model, but yes it can result in what you are describing that it is picking things up that it shouldn't.
 
DevForce let's you control the probing, though. You'll basically have to exculde the files you don't want it to probe. See the following link.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down