locked
BackgroundTransfer.BackgroundDownloader.getCurrentDownloadsAsync() results in "The system cannot find the file specified." exception

    Question

  • I am currently using the WinJS BackgroundDownloader in a Windows 8.1 app to manage the downloading of large files. Whenever I try to call the getCurrentDownloadsAsync() method (whether it's on app start/resume or after I've started a BackgroundOperation) to get the list of download operations, it results in an exception with the error message "The system cannot find the file specified." This error message doesn't seem to make sense to me. What would cause this error?

    The code I'm using is below, which is essentially copied and pasted from the BackgroundTransfer sample (Note: the sample app runs fine on my machine and does not raise an error when this code is run). I tried moving the below snippet to different parts of the app, and it results in an error every time. Is there a gotcha with this method that I'm missing?

    Windows.Networking.BackgroundTransfer.BackgroundDownloader.getCurrentDownloadsAsync().done(function (downloads) {
                for (var i = 0; i < downloads.size; i++) {
                    console.log(downloads[i].toString());
                }
            }, function (error) {
                console.log(error.message);
            });

    Tuesday, November 19, 2013 10:18 PM

Answers

  • After some investigation, I found that uninstalling the application from the start screen and re-deploying through VS solved whatever was causing the exception, as now  etCurrentDownloadsAsync() works as expected. 
    Thursday, November 21, 2013 7:44 PM

All replies

  • When the error is thrown, how many jobs are present in the downloads.size value or does the getCurrentDownloadsAsync() function itself throws the exception?

    Maybe you can try collecting a Process Monitor trace and share it via SkyDrive if it is okay with you.


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog


    Wednesday, November 20, 2013 12:50 AM
    Moderator
  • Hi Prashant,

    getCurrentDownloadsAsync() itself is throwing the exception (caught by the error handler shown in the snippet above). Any idea what file the error message could be referring to?

    I'll continue investigating and post some code if I can't figure it out.

    Thanks,

    Wednesday, November 20, 2013 1:03 AM
  • Hi nuttertag,

    Since this is a static method, it is hard to tell where exactly the error is returned from. It sounds like some type of file/registry access is required, but the file/registry does not exist. If you collect a Process Monitor trace of your own, I would recommend putting a breakpoint right before and after the error is seen and then try to look for events in between that time. If you see any "Name not found" error in the Process Monitor that looks suspicious during the time of interest, please post it here or maybe that will give you some clues...

    Thanks,

    Prashant.


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Wednesday, November 20, 2013 1:15 AM
    Moderator
  • Sounds good, thanks for the help! I'll try that and post back with what I find.
    Wednesday, November 20, 2013 1:17 AM
  • After some investigation, I found that uninstalling the application from the start screen and re-deploying through VS solved whatever was causing the exception, as now  etCurrentDownloadsAsync() works as expected. 
    Thursday, November 21, 2013 7:44 PM
  • Hello,

    I'd like to re-open discussion on this as we are having the same issue (GetCurrentDownloadsAsync throwing an exception) and since it is happening so frequently, forcing users to uninstall the app is not really an option.

    Here is a link to a process monitor log I took while attempting to call the method.

    https://www.dropbox.com/l/wbVhlYYBSIx4cwoDGW4rkt

    Tuesday, August 26, 2014 7:21 PM