none
KinectExplorer crashes in some countries because of bug in WpfViewers.DoubleScaleConverter RRS feed

  • Question

  • Just found a globalization bug in the KinectExplorer because I have an English UK display (UICulture) on a German region (Culture) development PC. Basically any culture which doesn't have a dot as the decimal separator fails, including Germany.

    Looking at the code it was caused by a common mistake (which would trigger VS Code Analysis / FxCop warnings normally) of not specifying the intention regarding culture when converting a string value to a double in WpfViewers.DoubleScaleConverter.ObjectToDouble(). In my case it wanted to convert "-1.5" to a double using the default (German) culture, which is wrong because then it should be "-1,5". So I guess the value should always be converted from invariant.

    The fix is to change this line in "Converters.cs"...

    retVal = (double)TypeDescriptor.GetConverter(typeof(double)).ConvertFrom(value);

    ...to...

    retVal = (double)TypeDescriptor.GetConverter(typeof(double)).ConvertFrom(null, CultureInfo.InvariantCulture, value);

    Then it runs fine. Well to start with at least. I think a full FxCop / Code Analysis should be run quickly across the samples. I know it's not meant to be perfect but at least this should be fixed to make sure it works on all developer PCs.

    Didn't find a MS Connect product for Kinect SDK. Can someone here from MSFT please address this or tell me where to log it?



    • Edited by Code Chief Tuesday, June 12, 2012 11:19 PM
    Tuesday, June 12, 2012 10:46 PM

Answers

  • Known issue. THanks for reporting. Our next update of the Toolkit will have this fixed.

    We do use FxCop (and stylecop) on samples...we've not gone back to figure out how this bug still shipped without us catching first.

    Thanks, Rob Relyea | @rrelyea
    Kinect for Windows team

    Wednesday, June 13, 2012 11:49 PM