Adding suggestions to SearchBox causes app to crash


  • I have a Win 8.1 app (part of a universal app project) that crashes when I interact with a SearchBox control on the only page in the app.  The problem exhibited itself in a larger app which I have cut down to a single page example app that has no external dependencies.  I can make the app fail every time.

    The app has a single page that contains 1 SearchBox control.  The app does not implement the search contract.  When I add search suggestions in a certain order the app fails with an unhandled exception in the code generated for the Application class.  This is the sequence of interaction that causes the crash:

    Type a character in the SearchBox which causes 3 strings to be appended to the SearchSuggestionsCollection in the SuggestionsRequested event handler.

    Type a second character causing 1 string to be appended.

    Type a third character.  The 3 characters match nothing so nothing is appended to the SearchSuggestionsCollection.

    Type backspace causing 1 string to be appended.

    Type another backspace causing 3 string to be appended.

    Type another backspace which causes the query string passed to the SuggestionsRequested event handler to be empty.  Nothing is appended to the SearchSuggestionsCollection by the handler.

    The app crashes with an unhandled exception.  The exception message is:  Incorrect parameter.

    I have the solution that exhibits this behavior and will be happy to send it.

    Wednesday, May 14, 2014 12:38 AM

All replies

  • can you send the project ? link to onedrive file?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, May 14, 2014 9:31 AM
  • Sure thing.  Here's a link to the zipped solution:  https://skydrive.live.com/redir?resid=F54DAE3A198AEB78!7070
    Wednesday, May 14, 2014 5:11 PM
  • I am seeing this as well. Even with a simple example in a test project using a simple List<string> to search.

    It intermittently throws an unhandled exception which is caught in the App.g.i.cs file - even with a try-catch-finally block in the the OnSuggestionsRequested event handler and an args.Request.GetDeferral() call with the Complete call in the finally block.

    The error message is rather unhelpful: "The parameter is incorrect" :(
    • Edited by Joan Miró Thursday, September 11, 2014 12:29 PM
    Thursday, September 11, 2014 11:57 AM