Skip to content
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

Asynchronous projecting entities with child collection properties #9350

Closed
erbatista opened this issue Aug 7, 2017 · 1 comment
Closed

Comments

@erbatista
Copy link

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>.

@smitpatel
Copy link
Contributor

smitpatel commented Aug 7, 2017

duplicate of #9128

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants