I am using Visual Studio 2017 with the ASP.NET Core 2.1 Framework. When I try and loop through a static object I have in my controller, the iterator seems to be null.
The static object I am calling definitely has a collection seen below:
However When I try and see what the details are of the iterator I get a null reference exception even through the iterator should have a value:
What would be the cause of this null reference?
EDIT: Thanks to the answer I was able to debug what the issue was.
In the code where I am setting the bool wasFound
I am doing a where query against a list of objects where the name of the incoming connection is in the list. In this case, the connection name was null and so it would fail.
Obviously the null reference error was a bit vague as to what was causing the error.