How did I get this NullReferenceException error here right after the constructor?

后端 未结 6 1616
难免孤独
难免孤独 2020-12-04 21:22

I\'ve had an asp.net website running live on our intranet for a couple of weeks now. I just got an email from my application_error emailer method with an unhandled exception

6条回答
  •  难免孤独
    2020-12-04 22:11

    As others have said, the comparison could be causing the problem.
    Is any of the criteria for comparison contain null value? specifically, the string properties?

    i.e. If firstname or lastname or emailId is null and if it is used in comparison, things could fail when used inside the dictionary for comparison.

    EDIT: How is Supervisor and StaffMember and AdminStaff class related?
    In the code, you are casting both the instances to StaffMember. My guess is that it could be a problem if the Supervisor and StaffMember class are not related.

    EDIT2: What is the scrope of the dictionary instance? Is it shared at application level/session level? Is it possible that multiple threads could try to read/write from it?

提交回复
热议问题