ReSharper Web Help

Code Analysis features are available in: ReSharper Full Edition and ReSharper C# Edition

ReSharper is able to validate string formatting methods, but in order to do that, it needs to know that a particular method takes a format string as a parameter. With standard methods, such as String.Format, Text.StringBuilder.AppendFormat, or Console.WriteLine, it's fairly obvious, but when a custom string formatting method appears, you have to tell ReSharper to interpret it as such - otherwise, here's what happens:

Apparently, in this case ReSharper wasn't able to make sure that all required arguments were passed and didn't warn about a missing argument.

To make ReSharper aware of a custom string formatting method
  1. Reference ReSharper code annotation attributes using either of two methods described in External Annotations .
  2. Annotate your custom string formatting method with the StringFormatMethodAttribute attribute, which takes a single argument - name of format parameter as a string:

ReSharper will now be able to warn you about missing arguments when this custom formatting method is invoked. Even more, the Add argument quick-fix will make it easier for you to insert them:

See Also

Procedures

Reference

External Links