NullReferenceException on instantiated object?

前端 未结 4 463
无人及你
无人及你 2021-01-26 08:24

This is a segment of code from an app I\'ve inherited, a user got a Yellow screen of death:

Object reference not set to an instance of an object

相关标签:
4条回答
  • 2021-01-26 08:31

    You sure that one of the properties trying to be accessed on the l_Monitor instance isn't null?

    0 讨论(0)
  • 2021-01-26 08:39

    Sprinkle in a few variables for all the property-queries on that (loooooongg) line temporarily. Run the debugger, Check values and Corner the little bug.

    0 讨论(0)
  • 2021-01-26 08:51

    The NullReferenceException was actually thrown within a catch block so the stack trace couldn't display that line of code so instead it stopped at the caller.

    It was indeed one of the properties of the l_Monitor instance.

    0 讨论(0)
  • 2021-01-26 08:53

    I'm inclined to agree with the others; it sounds like one of the parameters you are passing SE.UI.Utilities.GetPermissionList is null which is causing the exception. Your best bet is to fire up the debugger and check was the variables are before that code is called.

    0 讨论(0)
提交回复
热议问题