Code inspection: Cannot resolve symbol in text argument
This code inspection validates identifier names used in string literals according to various .NET Framework contracts — for example, constructor parameters of System.Diagnostics.DebuggerDisplayAttribute or of System.ArgumentException and its inheritors.
Let's take a look at the way it works with System.ArgumentException
and its inheritors. The paramName
parameter in constructors of System.ArgumentException
and its derivatives (for example System.ArgumentNullException
, System.ArgumentOutOfRangeException
, and so on) expects the name of the parameter that caused the exception as it will appear in stack traces to help you quickly find the source of the problem. Therefore, ReSharper issues a warning if the literal in the argument corresponds to none of the parameters of the method where the exception is thrown. Moreover, ReSharper is aware of the position of the paramName
parameter in different signatures as shown in the example below.