Code inspection: 'void' method is annotated with the [MustUseReturnValue] attribute
This inspection reports void methods annotated with [MustUseReturnValue]. That attribute only makes sense for methods that return a value. A void method has nothing for the caller to use, so the annotation does not describe any real behavior.
Example
using JetBrains.Annotations;
class C
{
[MustUseReturnValue]
public void DoWork()
{
}
}
class C
{
[MustUseReturnValue]
public bool DoWork()
{
return true;
}
}
Quick-fix
Remove the attribute, or change the method to return a meaningful value.
01 April 2026