locked
Crash on LoadListingInformationAsync

    Question

  • I have seen couple of posts about this. But nothing that really answer how to fix the issue.

    I believe I followed correctly what is explained on this page: Handling Errors in a task chain<u1:p></u1:p>
    http://msdn.microsoft.com/en-us/library/windows/apps/Hh780559.aspx

    Here is my code:

    // Dispatch to main thread (Is there an easier way to do this?)
    g_DirectXPage->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref newWindows::UI::Core::DispatchedHandler([]()
    {
     
           // Create LoadListingInformationAsync task
           auto listingTask = Concurrency::create_task(Windows::ApplicationModel::Store::CurrentApp::LoadListingInformationAsync());
           listingTask.then([](Windows::ApplicationModel::Store::ListingInformation^ listing)
    {
                  // It goes here if it worked.
           })
    .then([](Concurrency::task<void> t)
    {
                  try
    {
                         t.get(); // <- This will crash. Without going into the catch()
                         // .get() didn't throw, so we succeeded.
                         OutputDebugString(L"ListingInformation loaded.");
                  }
                  catch (Platform::Exception^ e)
    {
                         OutputDebugString(e->Message->Data());
                  }
           });
    }));
    

    It will crash on t.get(). How ever I call it. In what ever threads. I tried tons of way.
    I know it is supposed to throw an exception because it is not on the store. But it doesn't throw the exception that's the problem. I can't catch it.

    Thanks!

    Tuesday, June 03, 2014 9:42 PM

All replies

  • I'm wondering if it's throwing on a different thread. Can you break in on this using WinDBg to see where the error is being caused?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, June 04, 2014 7:25 PM
    Moderator