ReSharper 2017.1 Help

Code Inspection: Cannot resolve symbol in text argument

This code inspection validates the argument that you pass to the paramName parameter in constructors of System.ArgumentException and its derivatives (e.g. System.ArgumentNullException, System.ArgumentOutOfRangeException, etc.).

The paramName parameter 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 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.

publicvoidFoo(objectvalue){if(value==null)// Warning for the first argumentthrownewArgumentNullException("bad value","value is null");if(!(valueisstring))// Warning for the second argumentthrownewArgumentException("bad value","value is not string");// do something}