Code inspection: Meaningless [HandlesResourceDisposal] annotation for an output parameter
This inspection reports [HandlesResourceDisposal] on an out parameter. That annotation is meaningless for an output parameter, because the method is producing the value instead of receiving a resource to dispose.
Example
using JetBrains.Annotations;
void Create([HandlesResourceDisposal] out IDisposable resource)
{
resource = new MemoryStream();
}
void Create(out IDisposable resource)
{
resource = new MemoryStream();
}
Quick-fix
There is no dedicated quick-fix for this inspection. A typical correction is to remove the annotation from the out parameter.
01 April 2026