Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Part 20: Implementing the Search Contract

19 minutes, 57 seconds


Right click “Save as…”

In this lesson, we learn how to respond to the user's request to search using the Search charm in Windows 8.  We see all of the changes to our app that are automated by including a search results page template.  We also demonstrate how to enable apps to provide spelling suggestions to items in our app as the user types in the search phrase.


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • the app did not show result for finding sugar from outside the app i tried rebuilding the solution  too

  • @ambar007: Hmm... After re-building, did you re-run the application, then close it, then search?  I'm sure this is a timing / sequence of events issue.

  • Hello Sir , If you can help me to resolve errors due to which my App fails on windows app certification kit. Here are the details.

    Crashes and hangs
    • Error Found: The crashes and hangs test detected the following errors:
      • Application efdbb58f-5054-4018-80dd-219406f454b4_1.0.0.1_neutral__64wcy81w2d2y0 was detected by Windows Error Reporting and experienced a crash or hang


    I have posted this query on forum also but haven't got any replies yet. 
    If i talk about my App, It's almost the similar like this "Contoso Cookbook" difference is that it does have only functionality taught till this video( 3 Labs on Hands on Labs ).

    And i am also facing error while searching from outside App. Search doesn't happen on the first try and after 1 try search result appears but when i click on item App restarts i just followed all steps shown on Lab of Search cotract and i dont find anything wrong in source code(have included event handler as shown in video). . 

    Event handler which defined is as below:
    private void OnItemClick(object sender, ItemClickEventArgs e)
                // Navigate to the page showing the animal that was clicked
                this.Frame.Navigate(typeof(ItemDetailPage), ((AnimalDataItem)e.ClickedItem).UniqueId);

    I think it may be the reason of failure of my App in 1st test as it restarts after clicking on item after search is made outside of App.

    Thank you. 

  • @nishant07: Just so you know, I've asked someone at Microsoft to see if they can comment further.  I'm not familiar with this issue myself.  Crossing my fingers for a speedy resolution.

  • ok.. Thank You

  • @nishant07: I have a reply from someone and I'll quote it:  "I am not following this. Sorry ...  Is the problem that "Search" is not working??  Or the problem with Certification Kit.  I would tell them to download the camp in a box and try the solutions.  It could be there is a bug on the labs, but I doubt it and sugar search just worked for me...   Would that help them?   If the problem is with WACK we would need their project."

    It might help if you could provide more details about the exact sequence of events / a better / more thorough description of the problem you're having and the steps you've taken so far to diagnose the issue.

  • Thank you sir, I was facing problems with both WACK and search contract.

    If i talk about search contract problem. When i try to search for Keyword from outside of app, search result appears perfectly but when i click to particular animal(item) ,app crashes and restarts. I followed your video and Hands On Labs. I found that the "OnSearchActivated method" in App.xaml.cs ,which i saw on this video has code which is different from the code in my project, but i didn't modify it , it is by default when i added search contract.
    Let me paste it here:

    protected async override void OnSearchActivated(Windows.ApplicationModel.Activation.SearchActivatedEventArgs args)
                // Reinitialize the app if a new instance was launched for search
                if (args.PreviousExecutionState == ApplicationExecutionState.NotRunning ||
                    args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                    args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    // Load recipe data
                    await AnimalDataSource.LoadLocalDataAsync();
                    // Register handler for SuggestionsRequested events from the search pane
                    SearchPane.GetForCurrentView().SuggestionsRequested +=OnSuggestionsRequested;
                GoWild.SearchResultsPage.Activate(args.QueryText, args.PreviousExecutionState);

    I would like to add that Search works perfectly while App is open , it doesn't happen only when i click on search result item when search is done outside of App.The code of event handler is pasted on previous comment.

    Now i come to WACK problem...
    I built this App on release preview and was also building packages on debug mode.But when i shifted to Windows 8 Pro and Visual Studio RTM version all test passed successfully without changing the code at all. So WACK issue has been fully resolved now. Thank you very much for helping.

    But yet not finding any error in "Search contract" code. I dont think anything is wrong in code .But as this is my first app i am not sure Smiley .Should i send you detailed code?or some file or anything you want . I just followed all steps shown on your video and as on Hands On Labs.

    And also have one more question regarding sharing contract. When i share item and send a mail of it , the mail shows only description ,no image at all. does this happen or there is some mistake on code ? because result is fine and perfect as shown in video when i use "Share Target" sample app for sharing.

  • @nishant07: re: search contract ... admittedly, I had issues with this too.  When I recompiled / rebooted / re-ran the app, it would work.  I would just say that I think it's an assembly versioning issue, but I'm not really sure.  What you see in the video took a couple of tried to get the right incantation.

    re: sharing contract ... I've had the same experience.  The mail program may not fully implement the share contract, I'm guessing.  I didn't delve into it deeply enough to try and figure it out.  Sorry I can't be more help ... you're as far along as I am at this point.  Smiley

  • @BobTabor: ok sir. thank you very much...And i feel happy to tell you that despite of these issues my App got published on store yesterday and  i would also like to quote that i would not have succeeded in doing that without going through this series . Thank you again for this wonderful series. I will be following your other series too.

  • Opening comments

Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.