*** UPDATE: Turns out the is expected as Caliburn will create its own instance of the PhoneApplicationService for you. Also when using Caliburn.Micro make sure that your App.xaml.cs is empty as Caliburn.Micro has better facilities for handling all these actions. ***
Today when I was kicking off a new Wp7 Mango project where I was going to use Caliburn.Micro soup to nuts I quickly ran into the following exception.
Now before I explain what is needed to resolve this error (I hope) let me quickly explain what I had done so far in my project which lead up to this. I did the following:
- Created a new WP7 Mango Application (not pivot, not panorama)
- Downloaded the latest nightly build of Calibrun.Micro
- Opened one of the Caliburn.Micro sample applications and copied it’s WP7AppBootstraper
- Hit F5
When I ran the application, which had NOTHING in it other than the default setup contents I received the error above. Since I had not setup the ability to walk though the Caliburn.Micro source (something I have since done) I quickly took another quick scan of the sample WP7 Navigation sample that is part of the Caliburn.Micro source tree to see what I had done differently.
After about 2 minutes of looking I noticed that my App.xaml was a bit different. I had the following in my App.xaml
Just for giggles I commented out the line which setup the PhoneApplicationService (as you see below):
After commenting out the line above I again hit F5. This time my error went away and the application loaded as expected. Now I am not sure of 2 things.
- Is this a Mango only issue w/ Caliburn.Micro (assuming it is an issue at ALL w/ CM)
- Is this something that should ALWAYS be removed when building a Caliburn.Micro application?
No matter the reason or the cause it did appear to solve my issue. So if you are having the same issue try removing the code above from your app.xaml and see if that helps.
Till next time,
07-03-2011 5:41 PM