Closed universorum closed 8 months ago
@universorum I haven't fully looked into the above, but are you able to provide a repro without using your extension method, i.e. only using the standard LINQ operators (GroupJoin, SelectMany...)? If so, that would probably indeed be an EF bug which we should fix. Otherwise, if the problem isn't reproducible via the standard operators, then that would be a bug in your extension nor producing the correct tree.
I created a new instance of parameter that are not rewrite by mistake.
I'm writing the extension method for Left Join Linq. In normal GroupJoin-DefaultIfEmpty-SelectMany case, we need to pass the Expression<Func<TRight, TLeft, TTemp>> and Expression<Func<(TRight, TLeft), TLeft, TResult?>> to make Left Join query. I want to wrap it so caller who can pass the single argument Expression<Func<TRight, TLeft>> to do same functional.
I'm noticed that the translate will fail if I pass the Expression that created by ExpressionVisitor.
If I compile query that using the Expression that maked with same parameter name directly before using the Expression that created by ExpressionVisitor, It will compiled. Change the name of parameter will get failed again.
Stack traces
Expression
All 4 expression have same structure
Provider and version information
EF Core version: 7.0.14/8.0.0 Database provider: Find in SqlServer(EF7.0.14), Repro in SQLite(EF7.0.14/8.0.0) Target framework: Find .NET6.0(EF7.0.14), Repro in .NET6.0(EF7.0.14) / .NET8.0(EF7.0.14/8.0.0) Operating system: Windows 11 IDE: Rider 2023.3.2