Electron.AutoUpdater.CheckForUpdatesAsync() not returning #455

Closed
opened 2026-01-29 16:40:00 +00:00 by claunia · 6 comments
Owner

Originally created by @ipax77 on GitHub (Feb 24, 2020).

Originally assigned to: @GregorBiswanger on GitHub.

I am trying to check for an update (GitHub Release) and let the user decide whether to download and/or install (and maybe show the download progress in my dotnet core app).

var result = await Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();
Is working as expected and installs the new Version after closing the app.
but

Console.WriteLine("Checking for update ...");
Electron.AutoUpdater.AutoDownload = false;
var result = await Electron.AutoUpdater.CheckForUpdatesAsync();
Console.WriteLine("Update Check running?!");

never returns

Console output is:

stdout: Checking for update ...

Checking for update
Found version 2.0.0 (url: sc2dsstats.desktop-Setup-2.0.0.exe)

Expected behavior would be to return a result.

electron-builder version=22.3.2
packaging platform=win32 arch=x64 electron=7.1.13
building target=nsis

ElectronNET.API 7.30.2
.NET Core 3.1
npm 6.13.7
GitHub

Originally created by @ipax77 on GitHub (Feb 24, 2020). Originally assigned to: @GregorBiswanger on GitHub. I am trying to check for an update (GitHub Release) and let the user decide whether to download and/or install (and maybe show the download progress in my dotnet core app). `var result = await Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();` Is working as expected and installs the new Version after closing the app. but ``` Console.WriteLine("Checking for update ..."); Electron.AutoUpdater.AutoDownload = false; var result = await Electron.AutoUpdater.CheckForUpdatesAsync(); Console.WriteLine("Update Check running?!"); ``` never returns Console output is: > stdout: Checking for update ... > > Checking for update > Found version 2.0.0 (url: sc2dsstats.desktop-Setup-2.0.0.exe) Expected behavior would be to return a result. electron-builder version=22.3.2 packaging platform=win32 arch=x64 electron=7.1.13 building target=nsis ElectronNET.API 7.30.2 .NET Core 3.1 npm 6.13.7 [GitHub](https://github.com/ipax77/sc2dsstats/blob/master/sc2dsstats.desktop/Service/ElectronService.cs)
claunia added the bug label 2026-01-29 16:40:00 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (May 10, 2020):

The problem here is that the app must first be packed with electron-builder so that the API works correctly. For this a dev-app-update.yml file is created. For example with the following command: electronize build /target win /electron-params --publish=always

In addition, the settings have to fit in the electron.manifest.json file under "build".
https://www.electron.build/auto-update

Alternatively, you only get a null object or the following exception at debug time:
image

That doesn't make debugging easy, of course. Definitely try our latest version. I will soon record a YouTube video and show how it works.

@GregorBiswanger commented on GitHub (May 10, 2020): The problem here is that the app must first be packed with electron-builder so that the API works correctly. For this a `dev-app-update.yml` file is created. For example with the following command: `electronize build /target win /electron-params --publish=always` In addition, the settings have to fit in the `electron.manifest.json` file under "build". https://www.electron.build/auto-update Alternatively, you only get a null object or the following exception at debug time: ![image](https://user-images.githubusercontent.com/7336300/81498571-ff708c00-92c5-11ea-83a7-cd358a5eff09.png) That doesn't make debugging easy, of course. Definitely try our latest version. I will soon record a YouTube video and show how it works.
Author
Owner

@ipax77 commented on GitHub (May 10, 2020):

var result = await Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();
is working as expected (published on GitHub)
but

Electron.AutoUpdater.AutoDownload = false;
var result = await Electron.AutoUpdater.CheckForUpdatesAsync(); 

triggers the Java-Part ("Found version 2.0.0 (url: sc2dsstats.desktop-Setup-2.0.0.exe)") but I don't get a result back in C# (no error, just waiting for ever)

@ipax77 commented on GitHub (May 10, 2020): `var result = await Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();` is working as expected (published on GitHub) but ``` Electron.AutoUpdater.AutoDownload = false; var result = await Electron.AutoUpdater.CheckForUpdatesAsync(); ``` triggers the Java-Part ("Found version 2.0.0 (url: sc2dsstats.desktop-Setup-2.0.0.exe)") but I don't get a result back in C# (no error, just waiting for ever)
Author
Owner

@GregorBiswanger commented on GitHub (May 10, 2020):

Okay, I see.. it must be because the Json serializer is causing problems..
is difficult for me to fix now...

Can you pull the repository here and directly reference the CLI assembly? Manual packages that you need can be found in the WebApp project... then start your app and attach to the running process with visual studio... I think you will be able to see exactly what the problem is with an exception..

@GregorBiswanger commented on GitHub (May 10, 2020): Okay, I see.. it must be because the Json serializer is causing problems.. is difficult for me to fix now... Can you pull the repository here and directly reference the CLI assembly? Manual packages that you need can be found in the WebApp project... then start your app and attach to the running process with visual studio... I think you will be able to see exactly what the problem is with an exception..
Author
Owner

@GregorBiswanger commented on GitHub (May 15, 2020):

In this video I show, how you can work with the repository:
https://youtu.be/Po-saU_Z6Ws

@GregorBiswanger commented on GitHub (May 15, 2020): In this video I show, how you can work with the repository: https://youtu.be/Po-saU_Z6Ws
Author
Owner

@ipax77 commented on GitHub (May 16, 2020):

cool video, ty! <3

You were right I do get an Error in the Json serializer:

Exception thrown: 'System.ArgumentException' in Newtonsoft.Json.dll
Exception thrown: 'Newtonsoft.Json.JsonSerializationException' in Newtonsoft.Json.dll

in ElectronNET.API/AutoUpdater.cs line 426
return taskCompletionSource.Task;

I wasn‘t able to dig deeper because of missing source files for that ..

@ipax77 commented on GitHub (May 16, 2020): cool video, ty! <3 You were right I do get an Error in the Json serializer: ``` Exception thrown: 'System.ArgumentException' in Newtonsoft.Json.dll Exception thrown: 'Newtonsoft.Json.JsonSerializationException' in Newtonsoft.Json.dll ``` in ElectronNET.API/AutoUpdater.cs line 426 `return taskCompletionSource.Task;` I wasn‘t able to dig deeper because of missing source files for that ..
Author
Owner

@ipax77 commented on GitHub (Aug 15, 2021):

I was able to retest it with v13.5.1 and dotnet 6 preview 7 and everything is working, now. Maybe because I am wiser, now.

if (HybridSupport.IsElectronActive)
{
    Electron.AutoUpdater.OnError += (message) => Electron.Dialog.ShowErrorBox("Error", message);
    CurrentVersion = new Version(await Electron.App.GetVersionAsync());
    Electron.AutoUpdater.AutoDownload = false;
    var updateResult = await Electron.AutoUpdater.CheckForUpdatesAsync();
    AvailableVersion = new Version(updateResult.UpdateInfo.Version);
    OnDownloadProgress(new DownloadEventArgs());
    if (AvailableVersion > CurrentVersion)
        return true;
    else
        return false;
}
@ipax77 commented on GitHub (Aug 15, 2021): I was able to retest it with v13.5.1 and dotnet 6 preview 7 and everything is working, now. Maybe because I am wiser, now. ``` if (HybridSupport.IsElectronActive) { Electron.AutoUpdater.OnError += (message) => Electron.Dialog.ShowErrorBox("Error", message); CurrentVersion = new Version(await Electron.App.GetVersionAsync()); Electron.AutoUpdater.AutoDownload = false; var updateResult = await Electron.AutoUpdater.CheckForUpdatesAsync(); AvailableVersion = new Version(updateResult.UpdateInfo.Version); OnDownloadProgress(new DownloadEventArgs()); if (AvailableVersion > CurrentVersion) return true; else return false; } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#455