diff --git a/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs b/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs index b592f0ce44857f..c8a526ccc4b3cc 100644 --- a/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs +++ b/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs @@ -703,9 +703,9 @@ private static Task RunAsync(Func>)s_tasks).Remove(new KeyValuePair(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); }