Closed BADF00D closed 5 years ago
There are mote test required: //Creation
Interlocked.Exchange(ref _field, new MemorySream()).Dispose();
Interlocked.Exchange(ref _field, CreateStream).Dispose();
Interlocked.Exchange(ref _field, new MemorySream())?.Dispose();
Interlocked.Exchange(ref _field, CreateStream)?.Dispose();
// DestroyInterlocked.Exchange(ref _field, null))?.Dispose();
Interlocked.Exchange(ref _field, null)).Dispose();
//Assignment Will be part of release 1.5.0
Prerequisites
Description
When using Interlocked.Exchange with an IDisposable instance, my IDisposable is tracked by the referenced field. If this is a field or property, then my IDisposable is tracked by this member. So there should be no hint, that the field disposable is not disposed.
Source Code
The following code shows an example for this kind of member assignment:
Where the following code should yield a warning:
Screenshot