locked
BackgroundDownloader.GetCurrentDownloadsAsync returns completed downloads

    Question

  • In my windows store app I am using BackgroundDownloader class to handle multiple background downloads. After all my 3 downloads are 100% complete, I close and open application, then when I run BackgroundDownloader.GetCurrentDownloadsAsync, it returns all downloads with 100% completed state.

    IReadOnlyList<DownloadOperation> readOnlyList = await BackgroundDownloader.GetCurrentDownloadsAsync();

    My expectation is completed downloads will be removed from list or somehow I need to force-remove them. But could not find any function for it.

    How can I remove completed downloads from CurrentDownloads list?

    Or will those completed downloads will be cleared from list? if yes how and when?

    Monday, January 12, 2015 3:47 AM

Answers

  • From the documentation:

    When using Background Transfer during development, you may get into a situation where the internal caches of active and completed transfer operations can get  out of sync. This may result in the inability to start new transfer operations or interact with existing operations and BackgroundTransferGroup                  objects. In some cases, attempting to interact with existing operations may trigger a crash. This result can occur if the TransferBehavior           property is set to Parallel. This issue occurs only in certain scenarios during development and is not applicable to end users of your app.

    Four scenarios using Visual Studio can cause this issue.

    • You create a new project with the same app name as an existing project, but a different language (from C++ to C#, for example).
    • You change the target architecture (from x86 to x64, for example) in an existing  project.
    • You change the culture (from neutral to en-US, for example) in an existing project.
    • You add or remove a capability in the package manifest (adding Enterprise Authentication, for example) in an existing project.

    Do any of these apply to you?

    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, January 12, 2015 12:54 PM
    Moderator