Skip to content

Commit

Permalink
Move telemetry out of lock scope (dotnet#105140)
Browse files Browse the repository at this point in the history
  • Loading branch information
rokonec authored Jul 19, 2024
1 parent 3648b56 commit 9c220c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@ private static Task<TResult> RunAsync<TResult>(Func<object, NameResolutionActivi
lock (s_tasks)
{
((ICollection<KeyValuePair<object, Task>>)s_tasks).Remove(new KeyValuePair<object, Task>(key!, task));
// Since it was canceled, func(..) had not executed and call AfterResolution it needs to be called here.
NameResolutionTelemetry.Log.AfterResolution(key!, activity, new OperationCanceledException());
}
// Since it was canceled, func(..) had not executed and call AfterResolution it needs to be called here.
NameResolutionTelemetry.Log.AfterResolution(key!, activity, new OperationCanceledException());
}, key, CancellationToken.None, TaskContinuationOptions.OnlyOnCanceled | TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
}

Expand Down

0 comments on commit 9c220c4

Please sign in to comment.