Q: OrderBy deletes object property I have the following code:
var test = _fitDbContext.MvLatestTestResult
        .Include(r => r.LastTest)
        .Include(r => r.LastTest.Testrun)
        .Include(r => r.LastTest.Testrunconfig)
        .Where(r => r.LastTest.Testrunconfig.Started.Value.Hour >= 0 && r.LastTest.Testrunconfig.Started.Value.Hour < 6)
        .Where(r => r.LastTest.Testrun.Userc == "build")
        .Where(r => r.ProductId == productId)
        .GroupBy(r => r.LastTest.Testrunconfig.Started.Value.Date)
        .OrderByDescending(r => r.Key.Date)
        .Take(3)
        .ToDictionary(group => group.Key, group => group.GroupBy(r => r.Configfilename));

Variable test looks like this:

You can see that LastTest is null. If I remove .OrderByDescending(r => r.Key.Date), it contains value.
Why does OrderByDescending remove LastTest value?

EDIT
Interesting thing I just found out. If I change order of GroupBy and OrderBy, everything works as expected. The problem is that OrderBy is executed with all records and takes a long time.
var test = _fitDbContext.MvLatestTestResult
        .Include(r => r.LastTest)
        .Include(r => r.LastTest.Testrun)
        .Include(r => r.LastTest.Testrunconfig)
        .Where(r => r.LastTest.Testrunconfig.Started.Value.Hour >= 0 && r.LastTest.Testrunconfig.Started.Value.Hour < 6)
        .Where(r => r.LastTest.Testrun.Userc == "build")
        .Where(r => r.ProductId == productId)
        .OrderByDescending(r => r.Key.Date)
        .GroupBy(r => r.LastTest.Testrunconfig.Started.Value.Date)
        .Take(3)
        .ToDictionary(group => group.Key, group => group.GroupBy(r => r.Configfilename));

