JetBrains Rider 2023.3 Help

Code Inspection: String formatting method problems

This inspection verifies that format items in the format argument of the String.Format and similar methods are used correctly.

If you have a custom formatting method that behaves like String.Format, you can mark it with the [StringFormatMethodAttribute] from JetBrains.Annotations to enable the corresponding checks. Here is an example:

[StringFormatMethod("message")] void ShowError( string message, params object[] args) { // Show error } void Test() { // Warning: Non-existing argument in format string ShowError("Failed: {0}"); }
Last modified: 20 December 2023