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.