Pattern: Malformed arguments for formatting method
Issue: -
The format
string argument passed to a method such as WriteLine
, Write
, or System.String.Format
does not contain a format item that corresponds to each object argument, or vice versa.
By default, this rule only analyzes calls to the three methods mentioned previously, but this is configurable.
Example of incorrect code:
Console.WriteLine(string.Format("{0}", file, errors));
Example of correct code:
Console.WriteLine(string.Format("{0}", file));