A number or date is parsed with the culture of the current thread, so the same text parses differently on other machines

tx0/csharp:culture-dependent-parsestrictwarningreliability/time-and-localedepth fastbug

What it finds

double.Parse("1.5") gives 1.5 under an English culture and 15 under a German one, where the comma is the decimal separator. Text from files, protocols and configuration needs CultureInfo.InvariantCulture; text typed by the user needs the user's culture, given explicitly. The rule reports Parse of double, float, decimal and DateTime, and of DateTimeOffset, with a single argument.

From the rule's source, culture_dependent_parse.rs.

Example from the rule's tests
using System.Globalization; class Settings{    double Ratio(string text) => double.Parse(text);tx0 reports: double.Parse uses the culture of the current thread     double Fixed(string text) => double.Parse(text, CultureInfo.InvariantCulture);}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:culture-dependent-parse" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:culture-dependent-parse] reason="..."

tx0 explain tx0/csharp:culture-dependent-parse shows the same in the terminal. Found a false positive? Report it.