Quantcast
Channel: Silverlight Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 801

Commented Issue: NullReferenceException [10220]

$
0
0
I get a NullReferenceException when trying to activate ContextMenu. Stack trace:

Microsoft.Phone.Controls.Toolkit.dll!Microsoft.Phone.Controls.ContextMenu.UpdateVisualStates(bool useTransitions) + 0x4f bytes
Microsoft.Phone.Controls.Toolkit.dll!Microsoft.Phone.Controls.ContextMenu.OnOpened(System.Windows.RoutedEventArgs e) + 0x13 bytes
Microsoft.Phone.Controls.Toolkit.dll!Microsoft.Phone.Controls.ContextMenu.OpenPopup.AnonymousMethod__12(object s, System.EventArgs e) + 0xb bytes
System.Windows.dll!MS.Internal.CoreInvokeHandler.InvokeEventHandler(int typeIndex, System.Delegate handlerDelegate, object sender, object args) + 0x1f9 bytes
System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj, System.IntPtr unmanagedObjArgs, int argsTypeIndex, int actualArgsTypeIndex, string eventName) + 0x178 bytes
[External Code]

The situation that leads to this is that I have a list box that is populated with a databinding from an observable collection. ContextMenu is attached to the stack panel that is inside the data template. Initially I load collection from a database. Everything works fine now. The trouble starts when I add items to the collection. The new item appeara to the display normally, but when I now long press what ever item in the list (old, new) the exception occurs.

Any ideas why?
Comments: ** Comment from web user: jyrkio **

The problem was related to the use of camera and it's shutter key events. I had left them hanging around when navigating out of the page where they were used. Am am still not sure what was the exact mechanism that caused the null reference just in ContextMenu. But, by properly clening up things when navigating away from the page corrected the fault.


Viewing all articles
Browse latest Browse all 801

Trending Articles