From 6001a3c481ceb81dde40a9bb8178bc4448a6963b Mon Sep 17 00:00:00 2001 From: NimbusFox Date: Thu, 6 Nov 2025 18:04:06 +0000 Subject: [PATCH] Removed ownjsonSerializer from WindowManager Removed the unneeded serializer and applied the settings to the global this._jsonSerializer as when the X and Y values are -1 in the options it would lead to some settings not being applied. E.g. ContextIsolation with it now applying the default values when serializing, settings mentioned before are correctly assigned on Electron's end --- src/ElectronNET.API/API/WindowManager.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/ElectronNET.API/API/WindowManager.cs b/src/ElectronNET.API/API/WindowManager.cs index f5e714d4..205dcb3a 100644 --- a/src/ElectronNET.API/API/WindowManager.cs +++ b/src/ElectronNET.API/API/WindowManager.cs @@ -153,12 +153,7 @@ public async Task CreateWindowAsync(BrowserWindowOptions options, options.X -= 7; } - var ownjsonSerializer = new JsonSerializer() - { - ContractResolver = new CamelCasePropertyNamesContractResolver(), - NullValueHandling = NullValueHandling.Ignore - }; - await BridgeConnector.Socket.Emit("createBrowserWindow", JObject.FromObject(options, ownjsonSerializer), loadUrl).ConfigureAwait(false); + await BridgeConnector.Socket.Emit("createBrowserWindow", JObject.FromObject(options, this._jsonSerializer), loadUrl).ConfigureAwait(false); } return await taskCompletionSource.Task.ConfigureAwait(false); @@ -216,8 +211,7 @@ public async Task CreateBrowserViewAsync(BrowserViewConstructorOpti private readonly JsonSerializer _jsonSerializer = new() { ContractResolver = new CamelCasePropertyNamesContractResolver(), - NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore + NullValueHandling = NullValueHandling.Ignore }; } }