ToListAsync() fails on ASP NET CORE but ToList() works - Error "Sequence contains no elements."

c# entity-framework-core linq

Question

I get a list like:

var test = await list.ToListAsync();

this function works fine with ASP.NET MVC but with the migration to .NET CORE I have the error

Sequence contains no elements.

The list object is an IOrderedQueryable.

When I execute the sentence:

var test = list.ToList();

works correctly but I need a Async method...

EntityFrameworkCore Version: 2.1.1

Any idea of the problem?

1
0
7/17/2018 6:59:14 PM

Popular Answer

I found the issue. I get the list with a select that fails because a MAX() inside the select fails.

Max() issue (Only happends with EntityFrameworkCore ): -> Stackoverflow: Max return value if empty query

0
7/12/2018 7:57:24 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow