Closed
Description
Query above uses a client method in projection
Client method is instance method, hence the object of enclosing class would end up in EF Core query cache.
https://github.com/aspnet/AspNetCore/blob/3dee6782c3f8d611b3cda871b97778a34121df83/src/DataProtection/EntityFrameworkCore/src/EntityFrameworkCoreXmlRepository.cs#L68-L79
The repository contains IServiceProvider & ILogger which will cause memory leak.
In 3.0, EF Core started throwing exception for potential code which can cause such leak. Which generated dotnet/efcore#17623 (comment) from customer.
So currently, this code path is unusable and there is no way for customers to work-around it.