bezzad / Downloader

Fast, cross-platform and reliable multipart downloader with asynchronous progress events for .NET applications.
MIT License
1.25k stars 193 forks source link

DownloadStatus is Failed but no exception is thrown #161

Open milkywayfarer opened 5 months ago

milkywayfarer commented 5 months ago

Steps to reproduce:

  1. Create a configuration and a client:
    DownloadConfiguration configuration = new DownloadConfiguration()
    {
        MaxTryAgainOnFailover = int.MaxValue,
        Timeout = int.MaxValue,
        MaximumBytesPerSecond = (Variables.limiter * 1024 * 1024) / 8,
        ParallelDownload = true,
        ChunkCount = 1,
        MaximumMemoryBufferBytes = 1024 * 1024 * 1024 / Variables.threadLimiter,
        ReserveStorageSpaceBeforeStartingDownload = true,
    };
    var client = new DownloadService(configuration);
    try
    {
        await client.DownloadFileTaskAsync(item.From.ToString(), new DirectoryInfo(Path.GetDirectoryName(path)!), ct);
    }
    catch (Exception e)
    {
        ...
    }
  2. Download a file from this URL. Scheme does not matters, link works for http and https both (we prefer http).
  3. After some amount of time (around 5 secs), function returns with no output and client.Status == DownloadStatus.Failed.
aravindk777 commented 5 months ago

I also have the same issue.

ZCOREP commented 3 months ago

same issue! this is my code my file is create but nothing download, iam using 3.0.6 version!

    public async void dlimage(string videoname, string imageuri)
    {
        var folder = await KnownFolders.VideosLibrary.CreateFolderAsync("testfolder", CreationCollisionOption.OpenIfExists);
        var editShode = Regex.Replace(videoname, "[\\/:*?\"<>|]", string.Empty);
        var file = await folder.CreateFileAsync(editShode, CreationCollisionOption.GenerateUniqueName); 
        var downloadOpt = new DownloadConfiguration()
        {
            ChunkCount = 2, // file parts to download, default value is 1 
            ParallelDownload = true // download parts of file as parallel or not. Default value is false
        };
        var downloader = new DownloadService(downloadOpt);            
        Stream destinationStream = await downloader.DownloadFileTaskAsync(imageuri);
        if (destinationStream != null)
        {
            var bytesstream = await GetBytes(destinationStream);
            await FileIO.WriteBytesAsync(file, bytesstream);
            new ShowNotif(file, videoname, imageuri); 
        }
    }