.Net 2.0: String.IsNullOrEmpty causes runtime exception
via Bill McCarthy.
I was sceptic at first but then I tested the sample and it is true - I got a dirty runtime exception in the release assembly. Man, this is scary.
So I compared debug vs. release assemblies via reflector and I get the following:
// VS code static void test(string x) { for (int j = 0; j < 10; j++) { if (String.IsNullOrEmpty(x)) { // TODO: } } } // DEBUG assembly private static void test(string x) { for (int num1 = 0; num1 < 10; num1++) { if (string.IsNullOrEmpty(x)) { } } } // RELEASE assembly - you get EXCEPTION here ! private static void test(string x) { for (int num1 = 0; num1 < 10; num1++) { string.IsNullOrEmpty(x); } }
Wednesday, April 5, 2006 12:37 AM