Sunday, August 5, 2012

Success: a 7.1 app backed up on a remote server!


I've spent a bit of time now trying to get the upgraded 7.1 version working, however the app crashes on loading the schedule pivot page containing the jumplist.  I decided to try and put a plain list of the items in order to get a functioning 7.1 app - but  found that the crash wasn't caused by the telerik controls at all.

I tried to get the minimal list going with this:
        <controls:Pivot
           
 x:Name="schedulePivot"
           
 HeaderTemplate="{StaticResource pivotTitleTemplate}">
            <controls:PivotItem>
                <ListBox
                   
 ItemsSource="{Binding events}"
                   
 ItemTemplate="{StaticResource eventTemplate}">
                </ListBox>
            </controls:PivotItem> (line 64)
        </controls:Pivot>

I got this XAML parse error: AG_E_UNKNOWN_ERROR [Line: 64 Position: 34]


        <controls:Pivot
           
 x:Name="schedulePivot"
           
 HeaderTemplate="{StaticResource pivotTitleTemplate}">
            <controls:PivotItem>
                <TextBlock Text="hello" />
            </controls:PivotItem> (line 61)
        </controls:Pivot>

Gives me the same error on line 61, so it isn't about the lists at all.

It turns out I got this error as soon as I add any PivotItem to the pivot, even an empty one.

Ok...looked into the exception stack trace and it included this detail:


            at System.Windows.UIElement.UpdateLayout()
            at Microsoft.Phone.Controls.Pivot.OnItemsChanged(NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.ItemsControl.OnItemCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.ItemCollection.NotifyCollectionChanged(NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.ItemCollection.NotifyCollectionReady()
            at System.Windows.Controls.ItemsControl.NotifyAllItemsAdded(IntPtr nativeItemsControl)
            at MS.Internal.XcpImports.Application_LoadComponentNative(IntPtr pContext, IntPtr pComponent, UInt32 cUriStringLength, String uriString, UInt32 cXamlStrLength, Byte* pXamlStr, UInt32 cAssemblyStrLength, String assemblyStr)
            at MS.Internal.XcpImports.Application_LoadComponent(IManagedPeerBase componentAsDO, String resourceLocator, UnmanagedMemoryStream stream, UInt32 numBytesToRead, String assemblyString)
            at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
            at PAX7.View.SchedulePivotView.InitializeComponent()
            at PAX7.View.SchedulePivotView.OnNavigatedTo(NavigationEventArgs e)
            at Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)

So I thought perhaps the exception was something to do with the pivotitems I was creating not working with the data I'm assigning to it? I removed the PivotItems and set DataTemplates on the Pivot itself, like this:


        <controls:Pivot x:Name="schedulePivot"
                       
 HeaderTemplate="{StaticResource pivotTitleTemplate}"
                       
 ItemTemplate="{StaticResource pivotListTemplate}">
                        
        </controls:Pivot>

Referring to existing templates like this:
        <DataTemplate x:Key="pivotListTemplate">
            <ListBox
               
 ItemsSource="{Binding events}"
               
 ItemTemplate="{StaticResource eventTemplate}">
            </ListBox>
        </DataTemplate>

Magic! Finally I have a working app built on the 7.1 SDK :) Obviously I committed it straight away. Then I remembered that I hadn't got a backup on a separate machine yet, so I googled remote repository hg nearlyfreespeech, and found this awesome page:

Before sending it up to my new remote repository,  I thought I'd make sure it wasn't including all my generated files. I found a couple relevant Stack Overflow questions  (e.g. http://stackoverflow.com/questions/3426231/mercurial-hgignore-some-questions-on-how-to-ignore-a-single-file) that led me to the help page (http://www.selenic.com/mercurial/hgignore.5.html). Although when I look at 'all files' in the repository it doesn't list the bin/obj directories now, when I ran the clone it still did because it was looking at the history of the repository, which obviously still mentioned them.

Then cloning failed anyway with an 'invalid argument' error. Google told me there was a known issue with clone/push/pull of large filesets on windows? Lame! (http://mercurial.808500.n3.nabble.com/TortoiseHG-Large-File-Commit-only-40Meg-is-size-td2140178.html) 
So I tried creating a bundle of just the latest revision (http://tortoisehg.bitbucket.org/manual/0.9/changelog.html#revision-context-menus) and cloning it, but tortoise just went ahead and tried creating a stupid huge bundle again when I hit clone, instead of pulling from the bundle. So I turned on the server option, but couldn't figure out what the url should be - when I tried hg pull <url listed in serve ui> I got an error that the hostname wasn't recognised.
I uploaded the bundle I'd created through ssh, and tried pulling from it locally (inspired by http://weblogs.java.net/blog/kohsuke/archive/2007/08/mercurial_trans.html) but got an error that the parent wasn't recognised. However import/export also didn't work, saying it couldn't find files to patch. So I created a backup bundle as listed here (http://www.southampton.ac.uk/~fangohr/computing/hg.html#use-mercurial-without-access-to-server-using-bundles) and copied that to the server, pulled from that and finally had a repository. Done!

I think the whole rigmarole indicates that I don't have a strong enough grasp on how hg is supposed to work.  Let's see how it goes when I try and just copy over a changeset...

No comments: