Input code
using System.Collections.Immutable;
using System.Linq;
public sealed class Box
{
public ImmutableArray<int> Values { get; init; }
}
public static class C
{
public static string? FirstPositive(Box? box) =>
box?.Values
.Where(value => value > 0)
.Select(value => value.ToString())
.FirstOrDefault();
}
Erroneous output
public static string? FirstPositive(Box? box)
{
return (from value in box?.Values
where value > 0
select value.ToString()).FirstOrDefault();
}
This does not compile:
error CS1936: Could not find an implementation of the query pattern for source type 'ImmutableArray<int>?'
The null-conditional access lifts Values to ImmutableArray<int>?. The method chain must remain inside the conditional access.
Details
Product: ICSharpCode.Decompiler / ilspycmd.
Version: master 9ea8d7c.
The input was compiled in Release for net10.0.
I can submit a small fix and regression test.
Input code
Erroneous output
This does not compile:
The null-conditional access lifts
ValuestoImmutableArray<int>?. The method chain must remain inside the conditional access.Details
Product: ICSharpCode.Decompiler / ilspycmd.
Version: master
9ea8d7c.The input was compiled in Release for
net10.0.I can submit a small fix and regression test.