Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes parsing bug for floats with non english culture #794

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,13 @@ private static object CastInteger(ulong number, TypeCode typeCode)
}
else if (Regex.IsMatch(v, @"[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?")) //regular number
{
if (TryAndSwallow(() => byte.Parse(v), out result)) { }
else if (TryAndSwallow(() => short.Parse(v), out result)) { }
else if (TryAndSwallow(() => int.Parse(v), out result)) { }
else if (TryAndSwallow(() => long.Parse(v), out result)) { }
else if (TryAndSwallow(() => ulong.Parse(v), out result)) { }
else if (TryAndSwallow(() => float.Parse(v), out result)) { }
else if (TryAndSwallow(() => double.Parse(v), out result)) { }
if (TryAndSwallow(() => byte.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else if (TryAndSwallow(() => short.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else if (TryAndSwallow(() => int.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else if (TryAndSwallow(() => long.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else if (TryAndSwallow(() => ulong.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else if (TryAndSwallow(() => float.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else if (TryAndSwallow(() => double.Parse(v, YamlFormatter.NumberFormat), out result)) { }
else
{
//we couldn't parse it, default to string, It's probably too big
Expand Down