I have a very simple check at the beginning of one of my methods:
public void MyMethod(MyClass thing) { if(thing == null) throw new ArgumentNullException("thing");
But I get stacktraces (from Elmah in the production environment) which seems to indicate that the if line (thing == null) throws a NullReferenceException. The first two lines of the stack trace look something like this:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at MyLibrary.BL.AnotherClass.MyMethod(MyClass thing) in C:\Development\MyProject\trunk\MyLibrary.BL\AnotherClass.cs:line 100
MyClass is a pretty simple class without operator overloads or something like that, so I'm a little fixated on throwing a NullReferenceException!
Can anyone suggest scripts that might trigger this?
EDIT: I suspect the βthingβ may be null, but I would really expect ArgumentNullException to be a NullReferenceException - this is basically what this question is about. Maybe something that the wireframe or Elmah is changing or is reporting the exception incorrectly - or is this the only explanation that the binaries are somehow out of date?
mutex source share