Thursday, May 24, 2012

Upgrading to 7.1


I upgraded my app project to 7.1 back in late March, but it didn't go smoothly. 

Immediately after upgrading, I wanted to run the project and make sure upgrading hadn't broken anything. Unfortunately the first thing I got was a cryptic runtime Exception: 'WrappedException' with details 'Unspecified Error', breaking when I initialised a boolean for the first time. I googled the exception and found other people complaining that upgrading their projects gave them these errors as well - http://forums.create.msdn.com/forums/t/88547.aspx - the problem seemed to be running the old version of the Silverlight Toolkit or the CodingForFun toolkit. I have both of these, so time to upgrade them through nuget.
But...it turned out I have the most recent version? Crap. Try rebuilding from clean - didn't help. 

I searched again and found two articles both mentioning this error in relation to template bindings - http://www.wirebear.com/blog/2010/10/21/windows-phone-7-unspecified-error/ and http://www.telerik.com/community/forums/windows-phone/databound-listbox/unspecified-error-on-databoundlistbox-for-mango.aspx  so I guess I went through my project and checked the templates on that page.
  1. Commented out both the headertemplate and the jumplist itemtemplate - the app ran fine
  1. Put back in just the header template - app ran fine. So I guess it is /sigh/ somewhere within my horrible nested jumplist template.
  1. Just for fun, put them all back in - fails! The exception detail:

MS.Internal.WrappedException was unhandled
  Message=Unspecified error
  StackTrace:
       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.UIElement_UpdateLayout(UIElement element)
       at System.Windows.UIElement.UpdateLayout()
.....
 InnerException:
       Message=Unspecified error
       StackTrace:
            at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
            at MS.Internal.XcpImports.UIElement_Measure_WithDesiredSize(UIElement element, Size availableSize)
            at System.Windows.UIElement.Measure_WithDesiredSize(Size availableSize)
            at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(UIElement child, Size layoutSlotSize)
            at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)

 
And I've narrowed it down to this template:
  <DataTemplate x:Key="pivotJumplistTemplate">
            <l:JumpList
               
 ScrollDuration="400"
               
 ItemsSource="{Binding events}"
               
 ItemTemplate="{StaticResource eventTemplateByDay}"
               
 JumpButtonStyle="{StaticResource AccentColoredButtonStyle}">
                <l:JumpList.CategoryProvider>
                    <l:DistinctPropertyValueCategoryProvider PropertyName="StartTime"/>
                </l:JumpList.CategoryProvider>
            </l:JumpList>
        </DataTemplate>

If I replace this one with the non-jumplist, it works.

        <DataTemplate x:Key="pivotListTemplate">
            <ListBox
               
 ItemsSource="{Binding events}"
               
 ItemTemplate="{StaticResource eventTemplate}">
            </ListBox>
        </DataTemplate>

Aha - and now adding Jumplist to my search,  I get this article from the guy who wrote the control I'm using - 
All the comments say they are seeing this error. Turns out the control is now distributed as part of http://wp7contrib.codeplex.com/, which has been updated for 7.1. Installed the new package with nuget and swapped out my assembly references….and got the same exception.  And so were other people since September - I can't find an indication that he's updated it since then. I left a comment on the post asking if it had been updated. He's responded a couple of times since then saying he is planning to update, but hasn't had time recently.

Fortunately Telerik recently had a special for Microsoft employees, so I got their Windows Phone suite free - I can insert their jumplist instead.

No comments: