Описание тега ca2202

Visual studio code analysis for managed code: Do not dispose objects multiple times. Use this tag when asking questions related to this warning.

This warning is caused when some code paths of a method might lead to attempting to dispose the same object more than once.

Official documentation states:

Cause
A method implementation contains code paths that could cause multiple calls to System.IDisposable.Dispose or a Dispose equivalent, such as a Close() method on some types, on the same object.

Rule description
A correctly implemented Dispose method can be called multiple times without throwing an exception. However, this is not guaranteed and to avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.