The following piece of code crashes the Toolkit:
private void GestureListener_Tap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
ContextMenu menu = new ContextMenu();
menu.Items.Add(new MenuItem() { Header = "test" });
menu.IsOpen = true;
}
The crash happens only if a context menu is created and opened in response to a GestureListenet event. The same code outside of a GestureListener event handler works fine.
A complete sample project that illustrates the crash is attached. To trigger a crash, tap anywhere on the main page.
Comments:
private void GestureListener_Tap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
ContextMenu menu = new ContextMenu();
menu.Items.Add(new MenuItem() { Header = "test" });
menu.IsOpen = true;
}
The crash happens only if a context menu is created and opened in response to a GestureListenet event. The same code outside of a GestureListener event handler works fine.
A complete sample project that illustrates the crash is attached. To trigger a crash, tap anywhere on the main page.
Comments:
I was unable to repro this issue using the attached sample. I see a different issue where you can never dismiss the ContextMenu as the Tap event keeps getting re-raised over and over again.