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

Conversion of string to parameter/property value doesn't specify culture #26

Closed
tillig opened this issue Apr 8, 2019 · 4 comments
Closed
Assignees

Comments

@tillig
Copy link
Member

tillig commented Apr 8, 2019

From this StackOverflow question: The TypeManipulation code doesn't specify a culture when converting string values to other types so behavior may change based on the local machine's current culture.

The quickest fix would be to use CultureInfo.InvariantCulture everywhere - this is how ASP.NET handles parsing querystrings to ensure it's agnostic to local machine culture.

@jirigargas
Copy link

Hi, is there any estimate when this could be fixed? I can't be the only one who encountered this issue as there are 150 different cultures. And not all of them uses dots as decimal separator ...

@tillig
Copy link
Member Author

tillig commented Apr 17, 2019

No estimate. There are only two project maintainers for core Autofac and 20+ integration libraries and we are entirely unpaid doing this in our spare time. If you'd like it fixed faster, send a PR. The fix should be to specify invariant culture where a culture is required.

@bcisnero
Copy link

bcisnero commented Jul 9, 2019

I'll take care of it

@bcisnero bcisnero self-assigned this Jul 16, 2019
bcisnero pushed a commit to bcisnero/Autofac.Configuration that referenced this issue Jul 31, 2019
…ssue autofac#26. It turned out that the invariant culture won't fix this error because is related of the implementation of the double.parse in the DoubleConverter because in the numberformatinfo the decimal separator is always a dot and they validate that is always like that. I also added some functionality as a workaround.
@tillig tillig closed this as completed in 1635b86 Jan 30, 2020
@tillig
Copy link
Member Author

tillig commented Jan 30, 2020

I believe I have a fix for this that will be coming out in Autofac.Configuration 5.0 along with Autofac 5.0 compatibility. If it still doesn't fix the issue, open a new issue and please provide a failing test that we can use to verify the fix later.

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

No branches or pull requests

3 participants