Skip to content

Analyzer for culture-sensitive operations #4

@hamarb123

Description

@hamarb123

The built-in ones are useless & miss basic things like $"{x}", "" + x, so I should write my own ones that catch additional obvious cases. Existing ones are CA1304, CA1305. Also: if any argument is [StringSyntax(StringSyntaxAttribute.CompositeFormat)] (e.g., Console.WriteLine) or takes a CompositeFormat instance, then we may want to consider that one (but not string.Format, since that should be caught by CA1305). Also, string.Concat and string.Join. We want to exclude APIs that take string interpolation handler potentially. We want to recognise the special APIs FormattableString.Invariant, FormattableString.ToString(IFormatProvider), the string.Create(...) overload. We may want to implement https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1305#exclude-specific-symbols, but it might be hard - we should at least exclude the ones specified by https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1305#cause.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions