The request should not return data. Run the profiler in the SQL database to see the physical query in progress and try to manually execute it on the database to see what the data looks like. You may need to tweak the query (or data) to get the results you are looking for.
A "sequence contains no elements" is basically a LINQ way of telling you that you are trying to reference an element from a list that has nothing. Therefore, calls to things like .First() or .Single() cannot find anything, therefore, an error.
When changing calls to something like .FirstOrDefault() or .SingleOrDefault() , then it will have a default value for this type, and for reference types, the default value is null . Therefore, if you set something to null , and then try calling the method on it, you will get an object reference not set to an instance of an object .
David source share