Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron API and backend API mismatch #11

Open
theolivenbaum opened this issue Feb 13, 2023 Discussed in #10 · 0 comments
Open

electron API and backend API mismatch #11

theolivenbaum opened this issue Feb 13, 2023 Discussed in #10 · 0 comments

Comments

@theolivenbaum
Copy link
Owner

Discussed in #10

Originally posted by r-pankevicius February 13, 2023
Hi,

there are some things that go unnoticed when upgrading electron, but API changes are not reflected in backend API.

Here is one nasty example resulting in auto-update failures.

At some point downloadUpdate method from electron-updater changed the returned value to string array:
https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/AppUpdater.ts#L460

But backend API was not changed:
https://github.com/theolivenbaum/electron-sharp/blob/main/ElectronSharp.API/AutoUpdater.cs#L433

The result is Json serialization exception (expected string, got array) and autoupdate fails to install. This is from h5.ElectronNET, but I checked this repo, it's the same.

   2023-02-13 16:53:53.6620 ERROR [ElectronNET.API.BridgeConnector.LogError] Error running handler for event autoUpdaterDownloadUpdateComplete34955f7e-c08e-442e-af0b-89a6d09cc8c9 Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path '', line 1, position 1.
   at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadAsString()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at SocketIOClient.Newtonsoft.Json.NewtonsoftJsonSerializer.Deserialize[T](String json, IList`1 bytes) in ...\h5.ElectronNET\ElectronNET.API\SocketIO\NewtonsoftJsonSerializer.cs:line 37
   at SocketIOClient.SocketIOResponse.GetValue[T](Int32 index) in ...\h5.ElectronNET\ElectronNET.API\SocketIO\SocketIOResponse.cs:line 29
   at ElectronNET.API.BridgeConnector.<>c__DisplayClass17_0`1.<On>b__0(SocketIOResponse o) in ...\h5.ElectronNET\ElectronNET.API\BridgeConnector.cs:line 250

I wonder if it's possible to avoid such errors so TS or C# compiler error will point out electron API changes?

theolivenbaum added a commit that referenced this issue Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant