Z
Zytan
I just got the strangest error. I have exception code that catches a
null reference exception:
catch (NullReferenceException ex) { ... }
The handling code does nothing but print out data from within the
object, ex. So, nothing is changed. And I've found that the
exception object, ex, ITSELF is null!
So, by accessing it to print its innards, it throws another
NullReferenceException (which is, of course, unhandled)! Printing
ex.Message actually works, it reports "Object reference not set to an
instance of an object." But, accessing ex.InnerException is what
throws the null reference, since ex is null.
Strange. I'll see if I can replicate this, and nail it down.
Zytan
null reference exception:
catch (NullReferenceException ex) { ... }
The handling code does nothing but print out data from within the
object, ex. So, nothing is changed. And I've found that the
exception object, ex, ITSELF is null!
So, by accessing it to print its innards, it throws another
NullReferenceException (which is, of course, unhandled)! Printing
ex.Message actually works, it reports "Object reference not set to an
instance of an object." But, accessing ex.InnerException is what
throws the null reference, since ex is null.
Strange. I'll see if I can replicate this, and nail it down.
Zytan