Skip to main content

CRR0007 - String format item/argument mismatch

This analyzer detects formatted strings whose format does not correspond to arguments.

string s = string.Format("{0} {2}", arg1, arg2); // CRR0007

In the example above, you can fix the mistake by adding the third parameter, which will be referred by the “{2}“ placeholder, or changing the code as follows.

string s = string.Format("{0} {1}", arg1, arg2);