.NET Oddities #1

Every now and then I come across something slightly bizarre in .NET, so I’ve decided to write about it, as much as anything else because I’m aware of having come across quite a few things like this, but find myself unable to remember what half of them are, so it might prove to be a useful reference.

Over recent months we’ve been dealing with the issue of internationalization, and yesterday it became apparent that there is a weakness in one of our processes. Namely, if a string changes between different versions of a product, we currently have no way of verifying the the foreign language translations of this string have also been updated. At the moment we just trust our translators to get this right, and probably most of the time they do, but I think it’s fair to say that many of us here would sleep a lot better if we just knew that the string had been changed in the foreign language versions. Note that I’m not saying we’d know the translated strings were correct, just that they had been updated to reflect changes in the US English strings that are the default in our products.

So I’ve started work on a solution to this problem, and was reading the documentation for the System.Resources.ResXResourceSet class, which fits the bill nicely for a chunk of what I need to do. The thing is that this class is not present in any of the references that are imported into a VS.NET 2003 project by default, which is OK, but what struck me as odd is that to use this class you need to add System.Windows.Forms.dll as a reference. What?!? System.Windows.Forms?!? For a ResourceSet implementation? Why?

I can understand it not being in mscorlib.dll since many people will never use it, but to put something that clearly wraps a chunk of XML data, and is basically very similar to a Hashtable, into a UI library is just insane. I mean, who’s idea was that? I’m writing a command-line tool, so what do I want Windows Forms for? And even if I were writing something with a GUI I’d separate the business logic into a separate back-end library, so the question still stands.

Like I said, bizarre. And there will probably be many other things as time goes on.