Test with local de-CH is failing
Hello,
I have a build running on appveyor which fails constantly when doing tests with locale de-CH. On my local system (de-DE the test runs fine).
I've enhanced the exception output and I receive a weird response for decimal formats:
System.FormatException : Huh: Formatting '1.0' with de-CH failed (delimiter: ',', separator: '�')\r\n---- System.FormatException : Input string was not in a correct format.
The input string is 1.0 which is valid for de-CH.
Is there any limitation on localizations within the build server environment?
Best regards
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

Support Staff 1 Posted by Feodor Fitsner on 27 Jul, 2015 05:08 PM
Hi Stephen,
Take a look at this thread for the solution: http://help.appveyor.com/discussions/problems/2491-period-instead-o...
2 Posted by stephen on 27 Jul, 2015 06:23 PM
This won't help. I'm doing tests in the source code with different locales. It this problem related to specific locales?
Support Staff 3 Posted by Feodor Fitsner on 27 Jul, 2015 06:26 PM
Can you please drop an example of such test?
- Feodor
4 Posted by stephen on 27 Jul, 2015 06:34 PM
[Fact]
public void DecimalDeCh()
{
CultureInfo info = new CultureInfo("de-CH");
Assert.Equal("de-CH", info.Name);
info.TextInfo.ListSeparator = ";";
string data = "Test1;Test3;\"Test\";\nData1;Data2;1.0\nData1;Data2;2.0\nData1;Data2\nData1;Data2;2.43\n";
CsvStreamImporter streamImporter = new CsvStreamImporter(GenerateStreamFromString(data), info);
streamImporter.SetHeader(true);
streamImporter.SetupColumns();
streamImporter.SetDataType("Test", typeof(DecimalColumnDefinition));
Assert.True(streamImporter.Read());
Assert.Equal(1M, streamImporter.GetValue(2));
Assert.True(streamImporter.Read());
Assert.Equal(2M, streamImporter.GetValue(2));
Assert.True(streamImporter.Read());
Assert.Equal(0M, streamImporter.GetValue(2));
Assert.True(streamImporter.Read());
Assert.Equal(2.43M, streamImporter.GetValue(2));
}
The internal routine is doing the following conversion:
try
{
return System.Convert.ToDecimal(value, cultureInfo);
}
catch (FormatException fe)
{
throw new FormatException(string.Format("Huh: Formatting {0} with {1} failed (delimiter: '{2}', separator: '{3}'", value, cultureInfo.Name, cultureInfo.NumberFormat.NumberDecimalSeparator, cultureInfo.NumberFormat.NumberGroupSeparator), fe);
}
5 Posted by stephen on 27 Jul, 2015 07:35 PM
At least for de-DE it's working fine. If added the following workaround for de-CH to get things running:
#if FIX_APVOYER
info.NumberFormat.NumberDecimalSeparator = ".";
info.NumberFormat.NumberGroupSeparator = "'";
#endif
Anyhow I would like to see this fixed if possible.
Regards
Stephen
Support Staff 6 Posted by Feodor Fitsner on 27 Jul, 2015 08:58 PM
Indeed, the problem exists. This fails on AppVeyor but works locally.
Will take a look into that.
Support Staff 7 Posted by Feodor Fitsner on 27 Jul, 2015 08:58 PM
What framework version do you use?
8 Posted by stephen on 27 Jul, 2015 09:07 PM
4.5.1
Support Staff 9 Posted by Feodor Fitsner on 28 Jul, 2015 07:24 PM
OK, this issue has been fixed on all servers.
10 Posted by stephen on 28 Jul, 2015 07:50 PM
Thx, works like a charm now
stephen closed this discussion on 28 Jul, 2015 07:51 PM.