(I'm back from a trip to Dublin, Ireland.) If you read any book on .NET, you'll notice that one of the core ideas behind Microsoft's abstraction layer is security, safety, and so on. This makes me wonder why they didn't consider the robustness of the programs developers write an equally important element of the equation.

Consider this case I effectively stumbled into (in a slightly different situation, part of a CF application) last week:

DateTime.Now.ToString.Substring (5, 50);

The code should extract a portion of a string of the current date. However, as the number of characters is larger than the length of the string, the .NET library raises an exception. Even worse, if you don't handle the exception explicitly in code, the program will end. If you compare this with Delphi's equivalent (the Copy function), it will copy the available characters up to the maximum length indicated as parameter, without raising any such exception. And if this code is based on the VCL, the library will trigger its global exception error, display a message, and keep working. Which one is safer (despite the fact you can use pointers in Win32)? Placing a similar burden (try-except block, more accurate range checking) on the developer with no safety net seems a bad idea to me. That's why I cannot wait for a VCL.NET for the Compact Framework plaftorm.

Speaking of which, I recently found another gem. I had a application trying to make an HTTP call. In case of connection problems, an exception is raised. Now before you have a chance to trap it, the exception loads its own description. But to save space the assembly with the error messages is not deployed on the CF platform. Therefore, you get an error message saying that a resource assembly cannot be found. After that, you'll get to your except block. It ends up that you're not even allowed to distribute the error messages library, but have to build your own. Unbelievable!