Yesterday I discovered a great addition to Visual Studio 2017. When a NullReferenceException is thrown you not only get the familiar‘Object reference not set to an instance of an object’ error message, but you also get some information about which object exactly is null. Finally!
Note: Null reference analysis in managed code requires .NET version 4.6.2. Null analysis is currently not supported for Universal Windows Platform (UWP) and any other .NET Core applications. It is only available while debugging code that does not have any Just-In-Time (JIT) code optimizations.