Home NumberFormatInfo.CurrentInfo doesn't match Microsoft Docs
Reply: 0

NumberFormatInfo.CurrentInfo doesn't match Microsoft Docs

user1076 Published in May 25, 2018, 11:12 am

Using C# in Visual Studio 2017 15.5.3...

We have some unit tests that are expecting values of "0.01" (for example). The formatting method returns $"{value:F}%". These tests are failing on both of my dev VM's because $"{value:F}%" is returning "0.010". The tests pass for the other 4 developers working on the project.

Based on the documentation here for en-US, $"{value:F}%" should be returning two decimals.

Upon further inspection, the NumberFormatInfo.CurrentInfo on my development environments have NumberDecimalDigits = 3. Why would my VM's be different than the other 4 developers that have passing tests? I just completely reset the settings to General in Visual Studio 2017 and the NumberFormatInfo has the same (wrong) values.

Additional details: One of my VM's is VirtualBox with Windows 10 on a Windows 10 host. The other VM is Parallels with Windows 10 on a Mac High Sierra host. All OS versions are updated/patched to current.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.32547 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO