Code inspection: Meaningless [MustDisposeResource] annotation for an input parameter
This inspection reports [MustDisposeResource] on an input parameter such as a regular, in, or ref readonly parameter. That annotation is meaningless for an input parameter because the method is receiving an existing value instead of returning a resource that the caller must dispose.
Example
using JetBrains.Annotations;
void Use([MustDisposeResource] IDisposable resource)
{
resource.Dispose();
}
void Use(IDisposable resource)
{
resource.Dispose();
}
Quick-fix
There is no dedicated quick-fix for this inspection. A typical correction is to remove the annotation from the input parameter.
01 April 2026