1

Closed

NullReferenceException unhandled while opening ContextMenu in Landscape mode

description

Hi,
 
There is a bug in ContextMenu api.
Case Description:
  1. Set page's SupportedOrientation as PortraitOrLandscape
  2. Create a Panaroma View and have PanaromaItem in it.
  3. Create a ListBox inside PanaromaItem and bind it to a string based ObservationCollection<T>
  4. Create the DataTemplate in ListBox, where ListBoxItem contains one TextBlock, which is bounded to collection's data items.
  5. Generate Hold Event of TextBlock (inside ListBoxItem).
  6. Create and set ContextMenu at RUNTIME on Hold Event of textBlock (inside ListBoxItem).
  7. Change Configuration Type to 'Release' from 'Debug'
  8. Run the application in DEVICE.
  9. On Hold Event in Landscape mode. NullReferenceException is caught.
     
    Following is the stacktrace:
     
    at Microsoft.Phone.Controls.ContextMenu.UpdateContextMenuPlacement()
    at Microsoft.Phone.Controls.ContextMenu.OpenPopup(Point position)
    at Microsoft.Phone.Controls.ContextMenu.OnOwnerHold(Object sender, GestureEventArgs e)
    at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
    at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Closed Oct 22, 2012 at 8:33 PM by shawnoster
Closing all issues marked as fixed, dupe or no repro for the Windows Phone Toolkit September 2012 release.

comments

minzou wrote Sep 25, 2012 at 6:51 PM

good catch. fixed this in the latest version.

wrote Sep 26, 2012 at 5:36 AM

Fixed on changeset 79853