Normalize strings to uppercase
Normalize strings to uppercase
Microsoft docsDescription
Strings should be normalized to uppercase. A small group of characters, when they are converted to lowercase, cannot make a round trip. To make a round trip means to convert the characters from one locale to another locale that represents character data differently, and then to accurately retrieve the original characters from the converted characters.
Cause
An operation normalizes a string to lowercase.
How to fix violations
Change operations that convert strings to lowercase so that the strings are converted to uppercase instead. For example, change String.ToLower(CultureInfo.InvariantCulture) to String.ToUpper(CultureInfo.InvariantCulture).
Example
#pragma warning disable CA1308
// The code that's violating the rule is on this line.
#pragma warning restore CA1308When to suppress
It's safe to suppress a warning when you're not making security decisions based on the result of the normalization (for example, when you're displaying the result in the UI).