Xenko

XenkoLogoTM

An error in the formatting string

V3025 Incorrect format. A different number of format items is expected while calling ‘Format’ function. Expected: 4. Present: 3. SiliconStudio.Core.Mathematics Color3.cs 765

public string ToString(string format, IFormatProvider formatProvider)
{
  if (format == null)
    return ToString(formatProvider);

  return string.Format(formatProvider,
                       "Red:{1} Green:{2} Blue:{3}",
                       R.ToString(format, formatProvider),
                       G.ToString(format, formatProvider), 
                       B.ToString(format, formatProvider));
}

Format-string parameters are normally indexed starting with {0}, but here indexing starts with {1}. In this code, the format string is expecting 4 arguments but gets only 3, which issue will result in a FormatException. To fix this error, indices in the format string must be numbered correctly.

"Red:{0} Green:{1} Blue:{2}"

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s