Repository navigation
Fixes for the 2 critical and 3 high issues of the 7.0.1 review. No public API is removed.
🐛 Fixes
- A disk error never ended the download. When writing to the disk failed (disk full, USB drive removed, network folder lost), the download stayed Running for ever and asked the server again and again;
CancelTaskAsync()then waited for ever too. Now a storage error is a newStorageException(anIOException). It is not retried: the download fails at once. - The end of a download could be lost. If the last flush, the close or the rename of the file failed,
DownloadFileCompletedwas never raised, and a memory download with missing bytes said Completed. Now the work is done first and the status is set last: if it fails, the status is Failed and the event comes once with the error. The file is always closed. - A setup error made
Dispose()and the next download hang for ever. For example aContent-Typeheader inRequestConfiguration.Headers, or aCustomHttpClientFactorythat throws. The caller still gets the exception, but the status is Failed now (not Created), so the service can be disposed and used again. - A resume from a
DownloadPackagecould give a broken file that said Completed. If the.downloadfile was deleted or cut, or the file on the server changed (size,ETagorLast-Modified), the old chunk positions were used. Now the download starts from zero in these cases. - Two downloads to the same file at the same time lost the file. Both wrote the same
.downloadfile, and in the end no file was left. Now only one download in the process can write a temp file: withFileExistPolicy.Renamethe second one gets another name, otherwise it fails at once with anIOException. A download that was just stopped is not counted: Stop and then Start on the same file works, and a retry started fromDownloadFileCompletedgets the file. A resume from aDownloadPackageholds its temp file in the same way. - A failed rename at the end deleted the whole download. With
ClearPackageOnCompletionWithFailure = true, the finished.downloadfile was deleted when only the rename to the final name failed. Now it is kept. - A refused block could mix the bytes of two downloads. When the storage refused a block (for example after a stop), its read buffer went back to the shared pool twice. Two later reads then got the same array, and one download could write the bytes of another one into its file. Now the buffer goes back once.
🔄 Changed
ConcurrentStream.FlushAsync()throws aStorageExceptionafter a write error (it threw anAggregateException).
What's Changed
Full Changelog: v7.0.2...v7.1.0