-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in Client vs. Server Evaluation with async/await in EF Core 2.0.0 #9570
Comments
…async/await in EF Core 2.0.0 Two issues: 1) CollectionNavigationSetOperatorSubqueryInjector would incorrectly introduce MaterializeCollectionNavigation calls around subqueries. Fix is to reset the ShouldInject flag when visiting subqueries. 2) After fixing 1, we would deadlock due to blocking on the subquery call. Extended task lifting to deal with this case.
…async/await in EF Core 2.0.0 Two issues: 1) CollectionNavigationSetOperatorSubqueryInjector would incorrectly introduce MaterializeCollectionNavigation calls around subqueries. Fix is to reset the ShouldInject flag when visiting subqueries. 2) After fixing 1, we would deadlock due to blocking on the subquery call. Extended task lifting to deal with this case.
@anpete Can you write risk/justification for this one? |
@ajcvickers Here you go: Risk: Low: Adds a small amount of new code to the query compiler that detects the offending query patterns and performs a transformation from sync to async operators. |
This patch bug is approved for the 2.0.x patch. Please send a PR to the |
Hi, we have a public test feed that you can use to try out the ASP.NET/EF Core 2.0.3 patch! To try out the pre-release patch, please refer to the following guide:
We are looking for feedback on this patch. We'd like to know if you have any issues with this patch by updating your apps and libraries to the latest packages and seeing if it fixes the issues you've had, or if it introduces any new issues. If you have any issues or questions, please reply on this issue to let us know as soon as possible. Thanks, |
I've come across this bug today. I was running this code: public class Request
{
public Guid Id { get; set; }
public List<Data> Data { get; set; }
}
public class Data
{
public Guid Id { get; set; }
public string Key { get; set; }
public string ValueAsString { get; set; }
public DateTime? ValueAsDateTime { get; set; }
public int? ValueAsInt { get; set; }
public decimal? ValueAsDecimal { get; set; }
} int count = await dbContext.Set<Request>.Include(x => x.Data)
.Where(x => (x.Data.FirstOrDefault(y => y.Key == "supplier").ValueAsString ?? "").StartsWith("an"))
.CountAsync() When I use Is there a known workaround? How long until the fix is publicly released? (I've seen this is set for 2.0.3, yet I can't see 2.0.1 on the nuget feed?) |
@chris31389 we skipped over 2.0.1 and 2.0.2 so the first patch will officially by called 2.0.3. The patch is nearly ready for release - it's scheduled for November. |
I upgraded my application to version EF Core 2.0.0 and I have problems running some of my queries with async - throw an exception. This query worked in EF Core 1.1.0.
I have narrowed the problem down to areas that use Client vs. Server Evaluation that involve a collection navigation property. I have two parts - one which produces an exception and one that hangs.
I will describe the one that throws an exception - If you need the information on the one that hangs I can provide that as well.
Stack trace
Steps to reproduce
I have a
Book
entity class with a Many-to-Many relationship to anAuthor
entity class, via a BookAuthor entity class linking table. I am simply trying to get a comma separated list of all the authors of a book. (see my issue #9519, as this is using the same code).My entity classes are:
Linking Table is
The unit test contains just the element of the query that causes the exception.
Note: The method
SeedDatabaseFourBooks
adds four books, each with oneAuthor
linked via oneBookAuthor
table.Further technical details
EF Core version: 2.0.0 (worked in 1.1.0)
Database Provider: Microsoft.EntityFrameworkCore.Sqlite
Operating system: Windows 10
IDE: VS2017 15.3
The text was updated successfully, but these errors were encountered: