beeradmoore/dlss-swapper · error · Exception
DownloadFileToStreamAsync returned false.
Error message
DownloadFileToStreamAsync returned false.
What it means
During DownloadAndInstallAsync the updater starts a task that downloads the new installer file into a stream (DownloadFileToStreamAsync). That helper reports success/failure as a bool; when it returns false the download did not complete, so the update cannot proceed and the code throws.
Solutions
- Retry the download; transient network failures are the most common cause. Add automatic retry with backoff around the download task.
- Check network connectivity and any proxy/firewall blocking github.com/objects.githubusercontent.com.
- Verify free disk space in the temp download location.
- Download the installer manually from the GitHub releases page and install it if automatic download keeps failing.
Example fix
// before
var didDownload = await downloaderTask;
if (didDownload == false)
throw new Exception("DownloadFileToStreamAsync returned false.");
// after
var didDownload = await downloaderTask;
if (didDownload == false)
{
downloadingDialog.Hide();
throw new Exception("Update download failed. Check your network connection and try again.");
} Defensive patterns
Strategy: retry
Validate before calling
// Pre-check network and disk space before starting the download
if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == false)
return; // don't attempt download
var drive = new DriveInfo(Path.GetTempPath());
if (drive.AvailableFreeSpace < requiredInstallerSize)
return; // not enough space Try / catch
try
{
await updater.DownloadAndInstallAsync();
}
catch (Exception ex) when (ex.Message.Contains("DownloadFileToStreamAsync"))
{
logger.LogWarning(ex, "Update download failed; prompt user to retry");
// show retry dialog instead of crashing
} Prevention
- Wrap the download in a retry loop with exponential backoff for transient failures
- Check network availability and free disk space before downloading
- Clean up partially downloaded temp files so a retry starts fresh
- Offer a manual download link when automatic download fails
When it happens
Trigger: DownloadFileToStreamAsync returns false: network interruption mid-download, GitHub returning a non-success status, the download stream failing to write, or the HTTP response being empty.
Common situations: Unstable Wi-Fi or VPN dropping mid-download, corporate proxy blocking the GitHub release download URL, insufficient disk space on the temp drive, or GitHub CDN (objects.githubusercontent.com) errors.
Related errors
- Could not download file.
- Could not find dll in zip.
- Downloaded file was invalid.
- Could not load GitHub release data.
- Could not launch installer
AI-assisted analysis of beeradmoore/dlss-swapper@ab9b1e2d4b (2026-09-15).
Data as JSON: /api/errors/a7f979ce684730a6.
Report an issue: GitHub.
Appendix: source
Thrown at src/Data/GitHub/GitHubUpdater.cs:365
var fileDownloader = new FileDownloader(gitHubAsset.BrowserDownloadUrl);
try
{
using (var fileStream = File.Create(tempDownloadFile))
{
var downloaderTask = fileDownloader.DownloadFileToStreamAsync(fileStream, cancellationTokenSource.Token, progressCallback: (downloadedBytes, totalBytes, percent) =>
{
var displayPercent = percent * 100;
progressRun.Text = $"{ByteSize.FromBytes(downloadedBytes).MegaBytes.ToString("F2", CultureInfo.CurrentCulture)} / {totalSizeString} ({percent:F1}%)";
filesProgressBar.IsIndeterminate = false;
filesProgressBar.Value = percent;
});
var didDownload = await downloaderTask;
if (didDownload == false)
{
throw new Exception("DownloadFileToStreamAsync returned false.");
}
downloadingDialog.Hide();
}
}
catch (TaskCanceledException) when (cancellationTokenSource.IsCancellationRequested)
{
// User cancelled.
downloadingDialog.Hide();
return;
}
catch (Exception ex)
{
Logger.Error(ex);
downloadingDialog.Hide();
var downloadErrorDialog = new EasyContentDialog(xamlRoot)View on GitHub (pinned to ab9b1e2d4b)