You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When projecting a result which have a collection property it will deadlock.
public class FooModel
{
public Guid Id { get; set; }
public string Name { get; set; }
public List<ChildModel> Childs { get; set; }
}
public static async Task<List<FooModel>> ListFooModelAsync()
{
using (var db = new AppDbContext())
{
var foo_items = await db.Foos
.Include(e => e.Childs)
.Select(e => new FooModel
{
Id = e.Id,
Name = e.Name,
Childs = e.Childs.Select(
child => new ChildModel { Id = child.Id, Name = child.Name })
.ToList() //Cause deadlock
})
.ToListAsync()
.ConfigureAwait(false);
return foo_items;
}
}
By removing ToList(), the deadlock occurs as soon as I try to use the result, in this case Childs type will be Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.EnumerableAdapter<ChildModel>.
The text was updated successfully, but these errors were encountered:
When projecting a result which have a collection property it will deadlock.
By removing ToList(), the deadlock occurs as soon as I try to use the result, in this case Childs type will be
Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.EnumerableAdapter<ChildModel>
.The text was updated successfully, but these errors were encountered: