Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="2.2.0" />
</ItemGroup>
<Import Project="../Common/CommonProps.props" />
Expand Down
23 changes: 16 additions & 7 deletions lib/PuppeteerSharp/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<object> 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(
Expand Down
8 changes: 4 additions & 4 deletions lib/PuppeteerSharp/PuppeteerSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<Description>Headless Browser .NET API</Description>
<PackageId>PuppeteerSharp</PackageId>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageVersion>20.1.3</PackageVersion>
<ReleaseVersion>20.1.3</ReleaseVersion>
<AssemblyVersion>20.1.3</AssemblyVersion>
<FileVersion>20.1.3</FileVersion>
<PackageVersion>20.1.4</PackageVersion>
<ReleaseVersion>20.1.4</ReleaseVersion>
<AssemblyVersion>20.1.4</AssemblyVersion>
<FileVersion>20.1.4</FileVersion>
<SynchReleaseVersion>false</SynchReleaseVersion>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
<DebugType>embedded</DebugType>
Expand Down
Loading