02Apr
How to fix UnSpecified error when deploying a Windows Phone app in Visual studio?
Posted by admin as .Net, C#, Microsoft, Silverlight, Windows Phone
When you compile your windows phone app, it might build fine but throw an “unspecified error” when you try to deploy your app either onto your phone or to the emulator. The most probable reason that causes this is that there is style incompatibility in your xaml that the parser failed to resolve.
To fix the issue,
- In you xaml verify if you are using any style with fixed values for one control. That is you use style resource and also give static values for font size etc. Usually when you do this for TextBlocks etc., it will throw off the Windows phone xaml parser.
- Another situation is when you have templated pivot or panorama controls. Make sure that your header template for pivot or panorama controls is not funky. One common place where I have seen this is, during the 7.0 release, they allowed a static binding resource for the “FirstCharacter” in the pivot control. Access to this has been disabled starting 7.1 version of the Windows Phone SDK. To fix this all you have to do it remove the converter from your template.
For example, in your old 7.0 code, a pivot header template might look like
<controls:Pivot> <controls:Pivot.HeaderTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource FirstCharacter}}" Foreground="{StaticResource PhoneAccentBrush}"/> </DataTemplate> </controls:Pivot.HeaderTemplate> </controls:Pivot>
This does not work anymore after the 7.1 SDK. Change the above code to
<controls:Pivot> <controls:Pivot.HeaderTemplate> <DataTemplate> <TextBlock Text="{Binding}" Foreground="{StaticResource PhoneAccentBrush}"/> </DataTemplate> </controls:Pivot.HeaderTemplate> </controls:Pivot>
And you should be fine. (Just removed the converter part from the Text binding). I did not see any functional difference from doing this.
Hope this helps,
- No comments
- Tags: C#, Microsoft, Visual Studio, Windows Phone, Xaml
