none
UWP Backgroundtask crashing when re-registering

    Frage

  • Hello,

    i found out, that my application that uses an ApplicationTrigger to trigger a backgroundtask crashes when trying to register the backgroundtask a second time. So after Register -> Unregister -> Register, it crashes.

    This also happens when doing the same in the BackgroundtaskSample application provided by Microsoft on Github:

    https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/BackgroundTask/cpp/

    However, it only happens for the Background Task associated with the ApplicationTrigger, not the other ones.

    Why is this behaviour occuring? How to fix it?

    Freitag, 14. September 2018 12:37

Alle Antworten

  • Hello Durrsen,

    What's your OS version and target SDK version on your dev machine? Can you reproduce the same problem if you copy and run your code on another machine? When you try and catch the exception, can you find any info about your exception?

    When I use the official demo, if I register the second time, I will only get the following exception:

    Exception thrown at 0x00007FFFF35CA388 in BackgroundTask.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x00000094A23FCAB0. HRESULT:0x800700B7 Cannot create a file when that file already exists.
    WinRT information: Cannot create a file when that file already exists.

    But it should not be the error you meet, right? Can you provide more info to us?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Montag, 17. September 2018 05:43
    Moderator
  • Hello Barry,

    i tried it using Windows 10 1803, with the 17134 SDK, as well as with the current Insider Preview with the 17749SDK. The error stays the same.

    the sample from Github throws the same error that you also get:

    Ausnahme ausgelöst bei 0x00007FF8D7135299 in BackgroundTask.exe: Microsoft C++-Ausnahme: Platform::COMException ^ bei Speicherort 0x000000EAF9CFC820. HRESULT:0x800700B7 Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.
    WinRT-Informationen: Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.

    In my own program i get the following error:

    Ausnahme ausgelöst bei 0x00007FF8D7135299 (KernelBase.dll) in Program.exe: WinRT originate error - 0x800700B7 : 'Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.'.
    Ausnahme ausgelöst bei 0x00007FF8D7135299 in Program: Microsoft C++-Ausnahme: winrt::hresult_error bei Speicherort 0x00000067C61FD4B8.

    (HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) : Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.

    Best regards!

    Dienstag, 18. September 2018 07:11
  • @Durrsen,

    Yep, that is the same error from my side. I will try consult this from my internal channel. Please wait for my update here.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Dienstag, 18. September 2018 09:24
    Moderator