There are certain types that track instances of IDisposables themself. If these instances are disposed, they automatically dispose the instance they keep track of.
E.g the following code should not yield an diagnostics, because StreamReader disposed the given MemoryStream:
using System.IO;
namespace DisFixerTest.Tracking {
internal class Tracking {
public static void Do() {
var mem = new MemoryStream();
using (var tracking = new StreamReader(mem)) { }
}
}
}
On the other hand, in the folling code mem should be marked as not disposed.
using System;
using System.IO;
namespace DisFixerTest.Tracking {
class NoneTracking : IDisposable {
public static void Do() {
var mem = new MemoryStream();
using(var tracking = new NoneTracking(mem)) { }
}
public NoneTracking(IDisposable disp) {}
public void Dispose() {
throw new NotImplementedException();
}
}
}
Basically this bug got fixed by recent commits. But due to the fact that there is no configuration (all tracking types are hard-coded), this feature is pretty much useless. So next will be issue #15
There are certain types that track instances of IDisposables themself. If these instances are disposed, they automatically dispose the instance they keep track of. E.g the following code should not yield an diagnostics, because StreamReader disposed the given MemoryStream:
On the other hand, in the folling code
mem
should be marked as not disposed.