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

Money.ToString() fails for all currency with NotApplicable (-1) decimal places #80

Closed
ptjhuang opened this issue Jan 30, 2020 · 0 comments

Comments

@ptjhuang
Copy link

When currency is inferred from the invariant culture, which has XDR as the currency code, ToString() throws because it's trying to setup a NumberFormatInfo with -1 DecimalDigits.

ToString() shouldn't throw, as per: https://docs.microsoft.com/en-us/dotnet/api/system.object.tostring?view=netcore-3.1#notes-to-inheritors

Either don't allow Money to be created with XDR, or use a workable value for DecimalDigits in CurrencyRegistry.

This will likely cause a problem for developers who don't need multicurrency support, but have a CI process using dotnet core SDK docker images where the default culture is the invariant culture.

As a side note, Unicode chose to use 2dp, even though ISO publication is N/A. Practically XDR probably needs decimal places. https://www.unicode.org/cldr/charts/latest/supplemental/detailed_territory_currency_information.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant