I am developing on Mac with the last xojo release.
When I run on Window 10 my application I got a:
“Invalidargumentexception bad format”
runtime error on this line:
Var CalcArea_item_area As String = Areacmq_item.ToString(Locale.Current,“###.###,##”)
This line is running on Mac without any errors, but crash on Windows.
Any idea, I am the first sw who will run also on windows.
Alberto pointed the correct universal format string where “.” is always at the decimal separator position while the results vary obeying the locale rules.
Probably due to some bug it is silently failing on the Mac and generating a wrong “formatted” value, and avoiding it while pointing the error on Windows. Is Areacmq_item a Double?
I have exactly the same apps on Mac and Windows. On Windows, I had to work extra to remove exceptions. Apparently, the platform is less tolerant than Mac.
In the means time I have found the solution:
On Mac was working in this way: “###.###,##” (European way to write double numbers)
But the formatted string need to be write in US way: “###,###.##”
Is not clear way on Mac do not raise an exception like on windows
And that’s is a wrong behavior. The mask does not follow the locale, the mask follows the Number Format Patterns, the result string follows the provided locale.
That’s a bug, not a feature. Windows is correct, Mac is wrong. Please open an Issue Report