locked
"A method was called at an unexpected time." error when calling showAsync() on PopupMenu

    Question

  • I have a simple onclick handler which shows a context menu

    var menu = new Windows.UI.Popups.PopupMenu();
    	menu.commands.append(new Windows.UI.Popups.UICommand("test", function () {
    	}));
    	menu.showAsync({ x: e.screenX, y: e.screenY }).then(null);

    This works most of the time but from time to time I get a 'A method was called at an unexpected time.' exception (error number -2147483634) when calling showAsync().

    Once this exception happens I'm unable to show any PopupMenu from there on.

    I can't find any information about this error. Any clues?


    • Edited by PatrickKlug Tuesday, April 03, 2012 12:53 AM
    Tuesday, April 03, 2012 12:43 AM

Answers

  • Hi PatrickKlug,

    Could you please monitor the status of this app, try to check its CPU usage and memory size. I think there are other complex code in your app, it may be caused by other logical. Please try to narrow the scope, comment other features, or build a new empty JS project to test your code. I tested it in an empty JS project, it can work as expected.

    On the other hand, try to catch the error from Promise, http://msdn.microsoft.com/en-us/library/windows/apps/hh700337.aspx 


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, April 03, 2012 8:38 AM