I’ve just got this exception in App.xaml, just at the bootstrapper line:
<Application x:Class="MyNamespace.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:caliburnMicro="clr-namespace:MyNamespace.CaliburnExt"> <!--Application Resources--> <Application.Resources> <local:LocalizedStrings xmlns:local="clr-namespace:MyNamespace"
x:Key="LocalizedStrings"/> <caliburnMicro:Bootstrapper x:Key="bootstrapper" /> </Application.Resources> </Application>
After a few investigation, I found out the problem was in the botstrapper, and precisely here:
protected override void Configure() { container = new PhoneContainer(); if (!Execute.InDesignMode) { container.RegisterPhoneServices(RootFrame); } Problem is here!!!! container.Instance<IMobileServiceClient>(new MobileServiceClient( "https://myMobileervice.azure-mobile.net/", "xxxxxxxxxxxxxxxx")); AddCustomConventions(); }
To fix the issue is sufficient to move the Mobile Service registration inside “if (!Execute.InDesignMode)”
The working code is the following:
protected override void Configure() { container = new PhoneContainer(); if (!Execute.InDesignMode) { container.RegisterPhoneServices(RootFrame); container.Instance<IMobileServiceClient>(
new MobileServiceClient( "https://myMobileervice.azure-mobile.net/", "xxxxxxxxxxxxxxxx")); } AddCustomConventions(); }