Skip to content

Commit 55a7a99

Browse files
github-actions[bot]liveansjkotas
authored
[release/9.0-staging] [DNS] Ignore ObjectDisposedException on CancellationToken Callback (#115840)
* Ignore ObjectDisposedException on CancellationToken Callback * Update src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs Co-authored-by: Jan Kotas <[email protected]> * Change wording in comment * Update src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs --------- Co-authored-by: Ahmet Ibrahim Aksoy <[email protected]> Co-authored-by: Jan Kotas <[email protected]>
1 parent fee2cf8 commit 55a7a99

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ public void RegisterForCancellation(CancellationToken cancellationToken)
437437
NetEventSource.Info(@this, $"GetAddrInfoExCancel returned error {cancelResult}");
438438
}
439439
}
440+
catch (ObjectDisposedException)
441+
{
442+
// There is a race between checking @this._completed and @this.DangerousAddRef and disposing from another thread.
443+
// We lost the race. No further action needed.
444+
}
440445
finally
441446
{
442447
if (needRelease)

0 commit comments

Comments
 (0)