Code:
items.FirstOrDefault(x => x.Foo.Bar.BarId == snuh.BarId);
Error:
System.NullReferenceException: Object reference not set to an instance of an object.
The null object could be items
, Foo
, Bar
, or snuh
.
The debugger/runtime can tell me on which line of code the error is occurring. Why can't it also tell me which object is the problem?
Note: I know I can debug this and find out the answer. Is there a reason Visual Studio can't provide me with the name of the offending object?