Skip to content

Commit

Permalink
Set TaskCompletionSource result to 'null' for instances where no valu…
Browse files Browse the repository at this point in the history
…e is returned.
  • Loading branch information
Steven Rasmussen committed Jun 15, 2020
1 parent defef94 commit ca19908
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ internal void EndInvokeJS(long taskId, bool succeeded, ref Utf8JsonReader jsonRe
if (succeeded)
{
var resultType = TaskGenericsUtil.GetTaskCompletionSourceResultType(tcs);
if (resultType != typeof(VoidReturn))
{
var result = JsonSerializer.Deserialize(ref jsonReader, resultType, JsonSerializerOptions);
TaskGenericsUtil.SetTaskCompletionSourceResult(tcs, result);
}
var result = resultType != typeof(VoidReturn) ? JsonSerializer.Deserialize(ref jsonReader, resultType, JsonSerializerOptions) : null;
TaskGenericsUtil.SetTaskCompletionSourceResult(tcs, result);
}
else
{
Expand Down

0 comments on commit ca19908

Please sign in to comment.