Code inspection: Explicit argument passed to parameter with caller info attribute
This inspection reports an explicit argument passed to a parameter that uses a caller info attribute such as CallerMemberName, CallerFilePath, or CallerLineNumber. These parameters are usually meant to be filled in automatically by the compiler.
Example
using System.Runtime.CompilerServices;
void Log([CallerMemberName] string memberName = "")
{
}
void Save()
{
Log("Save");
}
using System.Runtime.CompilerServices;
void Log([CallerMemberName] string memberName = "")
{
}
void Save()
{
Log();
}
Quick-fix
There is no dedicated quick-fix for this inspection. A typical correction is to remove the explicit argument and let the compiler provide the caller info value.
01 April 2026