I have a problem that was not present until the most recent VS2019 update (16.8.1)
public class ReproClass : IDisposable
{
private readonly Mutex _mtx = new Mutex();
public void Dispose() => _mtx?.Dispose();
}
produces:
Severity Code Description Project File Line Suppression State Error CA2213 'ReproClass' contains field 'ReproClass._mtx' that is of IDisposable type: 'Mutex'. Change the Dispose method on 'ReproClass' to call Dispose or Close on this field. ShutterModeler path_to\ReproClass.cs 10 Active
I'm using "Code Analysis" with "Microsoft Manager Miniumum Rules" set.
This seems related to Code Analysis Warning CA2213 - Call Dispose() on IDisposable backing field but I'm not using FXcop nor a property.
How to solve this ?