Why doesn't NullReferenceException contain information about what is null?

前端 未结 6 741
情书的邮戳
情书的邮戳 2020-12-04 16:38

What was the design decision behind NullReferenceException not containing any runtime specific information except base class data (like a stacktrace)? And is there an extens

6条回答
  •  庸人自扰
    2020-12-04 17:01

    You can setup Visual Studio to break on Throw for NullReferenceException immediately and not first at the catch block.

    • Debug
    • Exceptions
    • Common Language
    • Runtime Exceptions System
    • System.NullReferenceException (Check the box)

    Then you will have a break in the line which caused the NullReferenceException.

提交回复
热议问题