In my test I have assertion that contains p.Contains(".Tests") but it makes error
Error CA1307 The behavior of 'string.Contains(string)' could vary based on the current user's locale settings. Replace this call in 'Solution.Tests.PackageTests._bowerEnabledProjects' with a call to 'string.Contains(string, System.StringComparison)'.
So I wanted to fix it by: p.Contains(".Tests", System.StringComparison) but it makes error:
Error CS0119 'StringComparison' is a type, which is not valid in the given context
StringComparison is an enum - the warning suggests that you're meant to specify one of the values within that enum, e.g. StringComparison.Ordinal.
However, this warning is wrong on two counts:
string.Contains(string, StringComparison) method as far as I can see. The documentation for string.Contains even gives an example of how you would implement such a method.string.Contains states: "This method performs an ordinal (case-sensitive and culture-insensitive) comparison."I would suggest disabling the warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With