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 @@ - + 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