locked
Regarding App crash in BackgroundTask

    Question

  • Hi Friends,

    I am developing a metro app using c#.

    I have registered a Background Uploader Task which is sometimes causing crash for my app.

    Below are the event log details:

    (Logs under Windows Logs->Application)

    Faulting application name: backgroundTaskHost.exe, version: 6.3.9600.16384, time stamp: 0x5215e1f6
    Faulting module name: twinapi.appcore.dll, version: 6.3.9600.17195, time stamp: 0x53894a69
    Exception code: 0xc000027b
    Fault offset: 0x00000000000547ac
    Faulting process id: 0x1384
    Faulting application start time: 0x01cfb55547580c0f
    Faulting application path: C:\Windows\system32\backgroundTaskHost.exe
    Faulting module path: C:\Windows\System32\twinapi.appcore.dll
    Report Id: 8948bc85-2148-11e4-8299-c8f733a0270f
    Faulting package full name: xxxxxxxxx
    Faulting package-relative application ID: xxxxxxxxx

    (Logs under Applications and Services Logs->Microsoft->Windows->BackgroundTaskInfrastructure->Operational)

    Background task for package xxxxxx with entry point xxx.UploaderTask did not complete in response to a cancel notification.

    I did a detailed investigation and found that all possible places I am passing cancellation token.

    This crash is not consistent, it is crashing once or twice out of twenty(20) attempts.

    I put some try catch blocks in suspected area but it is not throwing any exception. I am not sure if there is any different mechanism to handle exception thrown by backgroundTaskHost.exe.

    Note: Run method for UploaderTask is async void and I am calling some async methods inside Run. I am passing cancellation token in all await calls.

    I want to know if I am doing anything wrong and also how to handle the exception thrown by backgroundTaskHost.exe.

    Thanks.

    Monday, August 11, 2014 2:46 PM

Answers

All replies

  • What is the entire callstack from the app crash?

    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.

    Monday, August 11, 2014 7:44 PM
    Moderator
  • App is not throwing any exception in logs.

    I am getting details from event logs only.

    I have mentioned the details of event logs in question.

    Thanks.

    Tuesday, August 12, 2014 10:10 AM
  • Is this on your local machine or via the Store?

    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.

    Tuesday, August 12, 2014 1:16 PM
    Moderator
  • I got a solution for this. Actually I missed to pass cancellation token in one of my async method which I am calling inside Run().

    Thanks.

    Monday, August 18, 2014 9:51 AM
  • This issue was on my local machine.
    Monday, August 18, 2014 9:51 AM