diff --git a/src/Foundation/NSUrlSessionHandler.cs b/src/Foundation/NSUrlSessionHandler.cs index 1cd080833288..f3b099e4872b 100644 --- a/src/Foundation/NSUrlSessionHandler.cs +++ b/src/Foundation/NSUrlSessionHandler.cs @@ -221,7 +221,6 @@ void RemoveInflightData (NSUrlSessionTask task, bool cancel = true) if (inflightRequests.TryGetValue (task, out var data)) { if (cancel) data.CancellationTokenSource.Cancel (); - data.Dispose (); inflightRequests.Remove (task); } #if !MONOMAC && !__WATCHOS__ && !NET8_0 @@ -247,7 +246,6 @@ protected override void Dispose (bool disposing) foreach (var pair in inflightRequests) { pair.Key?.Cancel (); pair.Key?.Dispose (); - pair.Value?.Dispose (); } inflightRequests.Clear (); @@ -1130,7 +1128,7 @@ static bool TryGetAuthenticationType (NSUrlProtectionSpace protectionSpace, [Not } } - class InflightData : IDisposable { + class InflightData { public readonly object Lock = new object (); public string RequestUrl { get; set; } @@ -1154,21 +1152,6 @@ public InflightData (string requestUrl, CancellationToken cancellationToken, Htt CancellationToken = cancellationToken; Request = request; } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - // The bulk of the clean-up code is implemented in Dispose(bool) - protected virtual void Dispose (bool disposing) - { - if (disposing) { - CancellationTokenSource.Dispose (); - } - } - } class NSUrlSessionDataTaskStreamContent : MonoStreamContent {