CultureInfo used in CoerceValue

Topics: Bugs, Framework Services
Oct 1, 2013 at 10:56 AM
Edited Oct 1, 2013 at 10:57 AM
Hi all,
I received a bug report from a developer using CM on WP8 (but I think the issue applies to all other platform): there is an error in the type conversion used to inject parameters coming from page Url to the corresponding VM's properties.
The conversion relies on MessageBinder.CoerceValue function, which in several cases ends up using the following code:
return Convert.ChangeType(providedValue, destinationType, CultureInfo.CurrentUICulture);
Unfortunately, MessageBinder.CoerceValue is not replaceable, so the only viable workaround is to register several custom type converter.

In my opinion, that function should use CultureInfo.CurrentCulture, for type conversion, since CultureInfo.CurrentUICulture is only intended to be used to resolve localized resources.
I could fix in the code myself, but I'm not actively working on CM for quite a long time, and I'm not aware of latest development. I'm particularly afraid that fixing the conversion could break existing apps.
I would love to hear some feedback on the matter by Rob and the other folks actively working on the codebase.

Oct 1, 2013 at 1:51 PM
I think you are right.
Changed code to CultureInfo.CurrentCulture so we can do some testing with it.
Oct 1, 2013 at 8:14 PM
Unfortunately I've been doing web development lately, so I don't have a large project to test the modification against.
It will probably impact people having mixed locales: I often happen to see en-US operating system with it-IT datetime settings.
Thank you for your help.