OpenSource – take, then give…

At work (@ SDX) we are currently working on a Windows 8 App using Callisto as a component (actually we are using NuGet to include the library to be able to update it easily and use it with a CI build process via TFS 2012). Today just before lunch I updated the package and got an “OverflowException” from a “ColorBrightnessConverter”. We don’t use that class in our markup, so I tracked the usage down to the SettingsFlyout class from Callisto that we do use in an auto-generated settings page (more on that in a later post). Unfortunately the markup is also directly from Callisto, so we cannot fix it directly. The issue was a conversion from string to int using the code line

var factor = System.Convert.ToDouble(parameter);

You might realize the issue that we ran into when I show you the fixed line:

The only little problem was a missing hint for the conversion method what culture to use. Because the original code does not provide a culture, Convert.ToDouble() assumes we want to use the current app’s language. And because I was running that code on a German language Windows 8 installation with a manifest allowing German and English language, it was simply assuming that I want to use the German number format, which interprets the “.” character as a thousands separator (to allow additional languages you might simply open the manifest using the “XML (Text) Editor” of visual studio and add more entries to the “<Resources>” tag – I added “<Resource Language=”en” />” and “<Resource Language=”de” />”).

To fix it, I had to download the code, fix the code and compile it – but I also did drop a bug report with the line of code that did cause the issue and the line of code that solved the issue. So I first took the Open Source library to have an advantage, but then – when I was able to – I gave something back: a bug fix … and that’s something that I think you should do, too. If you find some useful code that’s Open Source, you should use it. And when you find a way to contribute to that project, simply try to be constructive in the things you give to the project. There’s no honor in shouting at the project owner that she/he did miss one thing in a project – offer them a way to improve the project with minimal impact; just like telling them how changing a single line of code did help you with fixing an issue.

By the way: Tim Heuer did respond really fast to that issue report and included the fix in less that 6h. Thinking about the project to be provided for free and maintained in free time, this is amazingly fast – thanks a lot Tim!