CA1303, DoNotPassLiteralsAsLocalizedParameters, but I'm not really

My code receives a warningCA1303 Microsoft.Globalization , "Do not pass literals as localized parameters" , but my code does not actually pass literals :

private void MyForm_Load(object sender, EventArgs e)
{
    UpdateTitle();
}

private void UpdateTitle()
{
    Version version = Assembly.GetExecutingAssembly().GetName().Version;
    CultureInfo culture = CultureInfo.CurrentUICulture;
    this.Text = String.Format(culture, "{0} v{1}.{2} Alpha r{3}", this.Text, version.Major, version.Minor, version.Build);
}

This code sets the title of the form like this: every time it loads:

MyFormNameAsSetInTheDesigner v0.1 Alpha r123

( version.buildactually contains an SVN revision, which is automatically updated with every commit, I do not use revision, because my version control scheme uses only 3 numbers, major.minor.revision)

, , . , Localizable = True , .

, ( - -) , .

, , (, , , FxCop, ).

+5
1

CA1303, , String.Format, , , LocalizableAttribute.

, , "{0} v{1}.{2} Alpha r{3}" . , , , .

FxCop, UpdateTitle :

[SuppressMessage("Microsoft.Globalization",
                 "CA1303:DoNotPassLiteralsAsLocalizedParameters" )]
private void UpdateTitle() { /* ... */ }
+7

All Articles