NotImplementedException 0x80004001 after updating property in ViewModel

0

The context is a Silverlight application for Windows Phone 7. I am debugging with the emulator.

I have a MainPage.xaml with a ViewModel attached in its DataContext.
When the page is NavigatedTo, a method is called in the ViewModel to call an API and display information.

I have a method which create a Dictionary<string, string>, fill it with data and set it in a property implementing the PropertyChanged event.

After this method is called, the debugger breaks in App.Application_UnhandledException with a NotImplementedException.

If I skip the call to this method with the debugger, the exception is not raised.

The strange thing is that the exception is raised after calling the method and not within! The exception contains no InnerException. There is a HResult of -2147467263 and a message containing "0x80004001". Here is the StackTrace:

at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
at MS.Internal.XcpImports.MeasureNative(IntPtr element, Single inWidth, Single inHeight)
at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at Microsoft.Phone.Controls.Primitives.PanoramaPanel.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& 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, Single inWidth, Single inHeight, Single& outWidth, Single& 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.Panorama.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& 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, Single inWidth, Single inHeight, Single& outWidth, Single& 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, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

The debugging output contains:

A first chance exception of type 'System.ArgumentNullException' occurred in mscorlib.dll (x10)
A first chance exception of type 'System.NotImplementedException' occurred in System.Windows.dll (x6)
c#
silverlight
silverlight-3.0
windows-phone-7
viewmodel
asked on Stack Overflow Dec 18, 2010 by SandRock

1 Answer

1

Ohw. I found a user error by checking databindings in the XAML side. Here is my XAML:

<TextBlock Grid.Column="0" Text="{Binding Value}"
           Style="PhoneTextLargeStyle" />
<TextBlock Grid.Column="1" Text="{Binding Key}"
           Style="PhoneTextLargeStyle" />

I forgot to write it's a static resource:

<TextBlock Grid.Column="0" Text="{Binding Value}"
           Style="{StaticResource PhoneTextLargeStyle}" />
<TextBlock Grid.Column="1" Text="{Binding Key}"
           Style="{StaticResource PhoneTextLargeStyle}" />

Let's hope this stupid question/auto-answer will help someone :)

answered on Stack Overflow Dec 18, 2010 by SandRock

User contributions licensed under CC BY-SA 3.0