Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Dns.RunAsync calls AfterResolution when canceled #104435

Merged
Merged
Changes from 2 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
3 changes: 3 additions & 0 deletions src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,9 @@ private static Task<TResult> RunAsync<TResult>(Func<object, long, TResult> func,
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!, startingTimestamp);
rokonec marked this conversation as resolved.
Show resolved Hide resolved

rokonec marked this conversation as resolved.
Show resolved Hide resolved
}
}, key, CancellationToken.None, TaskContinuationOptions.OnlyOnCanceled | TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
}
Expand Down
Loading