CS9236 reported even when lambda parameters/return types are explicitly specified
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
Following up on https://github.com/dotnet/efcore/pull/36454, see below for a minimal repro in which CS9236 (Compiling requires binding the lambda expression at least 200 times) is reported). Note that all lambdas have their parameter and return types explicitly determined, but CS9236 is still reported.
This reproed for me with dotnet SDK 10.0.100-preview.6.25358.103.
```c#
void Produces_a_diagnostic()
{
AssertQuery(
IQueryable>>> (ISetSource ss) => ss.Set()
.Select(IQueryable>> (Customer outer) => ss.Set()
.Select(IQueryable> (Customer c) => ss.Set()
// CS9236 just below
.Select(IQueryable (Customer cc) => ss.Set().OrderBy(string (Customer inner) => inner.CustomerID)))));
void AssertQuery(Func> query)
=> throw new NotImplementedException();
}
// Interestingly, if I switch to a regular array with IEnumerable instead of IQueryable,
// the diagnostic goes away (possibly because of the removal of the extra Set() call?):
void Does_not_produce_a_diagnostic()
{
AssertQuery(
IEnumerable>>> (Customer[] ss) => ss
.Select(IEnumerable>> (Customer outer) => ss
.Select(IEnumerable> (Customer c) => ss
.Select(IEnumerable (Customer cc) => ss.OrderBy(string (Customer inner) => inner.CustomerID)))));
void AssertQuery(Func> query)
=> throw new NotImplementedException();
}
public interface ISetSource
{
IQueryable Set()
where TEntity : class;
}
public class Customer
{
public string CustomerID { get; set; }
}
```
/cc @jaredpar @CyrusNajmabadi
Contributor guide
Assessment
This issue has not been assessed yet.