Derik Whittaker



XamlParseException from WP7 Mango and Caliburn.Micro

*** 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:

  1. Created a new WP7 Mango Application (not pivot, not panorama)
  2. Downloaded the latest nightly build of Calibrun.Micro
  3. Opened one of the Caliburn.Micro sample applications and copied it’s WP7AppBootstraper
  4. 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.

  1. Is this a Mango only issue w/ Caliburn.Micro (assuming it is an issue at ALL w/ CM)
  2. 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,

Posted 07-03-2011 5:41 PM by Derik Whittaker



Rob Eisenberg wrote re: XamlParseException from WP7 Mango and Caliburn.Micro
on 07-03-2011 7:33 PM

Caliburn.Micro's bootstrapper actually creates and adds the PhoneApplicationService. So, it should be removed from the App.xaml. Furthermore, everything in the App.xaml.cs should be removed because the bootstrapper has a better version of all of that stuff which you don't have to maintain. The error can happen pre-mango as well if you leave that in there, but it might manifest differently between the versions. I'm not sure about that.

Derik Whittaker wrote re: XamlParseException from WP7 Mango and Caliburn.Micro
on 07-03-2011 7:50 PM


That is great to know.  thanks for adding a comment to this so others will know how to solve the issue.  I will update the post to reflect that the app.xaml.cs should be empty.

Rob Eisenberg wrote re: XamlParseException from WP7 Mango and Caliburn.Micro
on 07-03-2011 10:14 PM

Actually, it still needs the ctor and the call to InitializeComponent, but other that that, it should be empty.

Online CPR Certification wrote re: XamlParseException from WP7 Mango and Caliburn.Micro
on 07-08-2011 2:09 AM

perfect, I found your post helpful and listening to the big designers is always i like .

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)