Archive | December, 2012

The parameter is incorrect

17 Dec

For the last couple of months we have been working on some different Windows Phone projects. Yesterday we ran into an exception in one of our projects. Sometimes when we navigated into a specific page we got an argument exception “The parameter is incorrect”. The exception was inconsistent but we got it more often when debugging compared to when we ran our project in release mode.

2012-12-17_013042

First step was of course to enable as much debugging info as possible which resulted in this StackTrace:

at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add(UIElement value)
at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 index, DependencyObject container, Boolean needPrepareContainer)
at System.Windows.Controls.ItemsControl.AddContainers()
at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)
at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at Microsoft.Phone.Controls.Pivot.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at Microsoft.Phone.Controls.PhoneApplicationFrame.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)

The page was actually pretty simple – a Pivot control with 4 items each containing a usercontrol. So with the StackTrace in mind we looked for some dynamically sized controls within our usercontrols . First of all we tried to change the Pivot control with a Panorama control – still got the exception. So we had to go through our code and line by line we removed content – still got the exception. In the end we had removed all the content inside our usercontrols and the page was stripped down to contain only the most necessary properties. Still got the exception.

In the end I stumbled upon the naming of our usercontrols – not in the page but the x:name within the usercontrol itself. Some of the usercontrols had been giving names that was used as part of some animation. What caught my eye was that two of the usercontrols got the same x:name. I tried to change one of the names and boom! Problem solved.

So to take this little issue to the test I created a small sample demonstrating the issue. The sample automatically navigates from one page to another and back until the exception is through (takes about 2-5 minutes).

The issue is on both Windows Phone SDK 7.1 and 8.0.

// thomas

Spotify – we will do your Windows Store app for free!

14 Dec

It’s a shame to see that Spotify still isn’t available for Windows Phone 8 and Windows 8. I understand that they probably have a big backlog and can’t have apps of this size available in just a few weeks.

However Windows 8 have been available for some months now and we haven’t heard anything from Spotify about a realistic release date. The result is obvious – users cancel their subscriptions and find another musicplayer. Just check out the forums and the comments in this thread – users have an excellent alternative in Xbox music.

A few weeks back my team and I decided to take a radical step – we offered Spotify to do the Windows 8 app – for free. We have developed our share of apps for the Windows Store; 20+ apps ranging from video-on-demand apps to homebanking apps.

We still haven’t heard anything from Spotify.

http://community.spotify.com/t5/Spotify-Ideas/Windows-8-Metro-App/idc-p/223348#M14834

Follow

Get every new post delivered to your Inbox.

Join 1,356 other followers