NetSparkle
NetSparkle copied to clipboard
Netsparkle download the files synchronously and freezes the UI
I used the same code as the netsparkle.sample.avalonia then used a bigger update file (45 megabytes) but the UI hangs until the download finishes
Hi @AMohamedFawzy,
Thank you for the report; however, it would be very helpful if you could create an example and/or say how you are creating your SparkleUpdater
instance as well as your .NET version, version of Avalonia, etc., since any of those might help the rest of us replicate and fix any problems that exist.
Please let us know:
- Which library you are using (sounds like
NetSparkleUpdater.UI.Avalonia
) and which version of the library you are using (e.g.2.1.2
) - Your version of Avalonia
- Your .NET version
- Your exact setup for creating the
SparkleUpdater
instance, not including any private URLs or keys or things like that
Hi @AMohamedFawzy,
Thank you for the report; however, it would be very helpful if you could create an example and/or say how you are creating your
SparkleUpdater
instance as well as your .NET version, version of Avalonia, etc., since any of those might help the rest of us replicate and fix any problems that exist.Please let us know:
- Which library you are using (sounds like
NetSparkleUpdater.UI.Avalonia
) and which version of the library you are using (e.g.2.1.2
)- Your version of Avalonia
- Your .NET version
- Your exact setup for creating the
SparkleUpdater
instance, not including any private URLs or keys or things like that
- library:
NetSparkleUpdater.UI.Avalonia
, version: 2.1.2 - Avalonia version: 0.10.17
- .Net version: 6.0.302
- Sparkle setup:
var uiFactory = new NetSparkleUpdater.UI.Avalonia.UIFactory(new WindowIcon(icon))
{
HideSkipButton = true
};
var sparkle = new SparkleUpdater(
"https://example.com/appcast.xml",
new Ed25519Checker(SecurityMode.Unsafe, "public key"))
{
UIFactory = uiFactory,
RelaunchAfterUpdate = false,
ShowsUIOnMainThread = true,
CustomInstallerArguments = ""
};
sparkle.StartLoop(true);
I found a workaround (although not elegant), I copied the netsparkle WebClientFileDownloader and modified it like this+
Before:
public void StartFileDownload(Uri uri, string downloadFilePath)
{
_logger?.PrintMessage("IUpdateDownloader: Starting file download from {0} to {1}", uri, downloadFilePath);
AsyncHelper.RunSync(async () =>
{
await StartFileDownloadAsync(uri, downloadFilePath);
});
}
After:
public void StartFileDownload(Uri uri, string downloadFilePath)
{
_logger?.PrintMessage("IUpdateDownloader: Starting file download from {0} to {1}", uri, downloadFilePath);
await StartFileDownloadAsync(uri, downloadFilePath);
}
for some reason the function was made to run synchronous intentionally freezing the UI, I think this has something to do with avaloniaui being slightly differenet from winforms and WPF
Experiencing the same issue. When I click on the "Download/Install" button, the window disappears, and the progress window doesn't show until the download is completed. Removing the AsyncHelper.RunSync
call fixed the issue.
Hi @david-szabo97, thanks for the confirmation. I am extremely busy right now and don't know when I will get to this, so if anyone wants to send in a PR or figure this one out, I'd be very grateful. At least there is a workaround for the moment. :)
Hi,
Sorry for the wait. Could you try 2.1.3-preview20220927001
(rolling out to NuGet through CI/CD now) and let me know if it works better for you all? Make sure to use the default (built-in) classes rather than anything you've created when testing.
2.1.3-preview20220927001
works for me, using the default classes. Thank you! Can't wait for the release 😄
Rolling out now in CI/CD in version 2.1.3. Thanks again!