From 85830b6fc1c7dbc1e923b17909f2a0b5720aee69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Kondratiuk?= Date: Mon, 10 Mar 2025 11:27:11 -0300 Subject: [PATCH 1/2] Fix expose function in AOT --- lib/PuppeteerSharp/Binding.cs | 23 ++++++++++++++++------- lib/PuppeteerSharp/PuppeteerSharp.csproj | 8 ++++---- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/PuppeteerSharp/Binding.cs b/lib/PuppeteerSharp/Binding.cs index 56aa0e1e2..faae0e9ac 100644 --- a/lib/PuppeteerSharp/Binding.cs +++ b/lib/PuppeteerSharp/Binding.cs @@ -76,15 +76,24 @@ internal async Task RunAsync( const string taskResultPropertyName = "Result"; var result = await BindingUtils.ExecuteBindingAsync(Function, args).ConfigureAwait(false); - if (result is Task taskResult) + + switch (result) { - await taskResult.ConfigureAwait(false); + case Task taskObjectResult: + result = await taskObjectResult.ConfigureAwait(false); + break; + case Task taskResult: + { + await taskResult.ConfigureAwait(false); - if (taskResult.GetType().IsGenericType) - { - // the task is already awaited and therefore the call to property Result will not deadlock - result = taskResult.GetType().GetProperty(taskResultPropertyName)?.GetValue(taskResult); - } + if (taskResult.GetType().IsGenericType) + { + // the task is already awaited and therefore the call to property Result will not deadlock + result = taskResult.GetType().GetProperty(taskResultPropertyName)?.GetValue(taskResult); + } + + break; + } } await context.EvaluateFunctionAsync( diff --git a/lib/PuppeteerSharp/PuppeteerSharp.csproj b/lib/PuppeteerSharp/PuppeteerSharp.csproj index f3c8aca9f..4cc927c22 100644 --- a/lib/PuppeteerSharp/PuppeteerSharp.csproj +++ b/lib/PuppeteerSharp/PuppeteerSharp.csproj @@ -12,10 +12,10 @@ Headless Browser .NET API PuppeteerSharp - 20.1.3 - 20.1.3 - 20.1.3 - 20.1.3 + 20.1.4 + 20.1.4 + 20.1.4 + 20.1.4 false false embedded From 9554ffcfdeb416aa8da38fb051179ffca179fa43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Kondratiuk?= Date: Mon, 10 Mar 2025 11:56:34 -0300 Subject: [PATCH 2/2] upgrade image sharp --- lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj b/lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj index c8c954acb..965b76055 100644 --- a/lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj +++ b/lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj @@ -18,7 +18,7 @@ - +