Version Used: 15.6 Preview 2
Steps to Reproduce:
-
Add a reference to System.Collections.Immutable
-
Add the following code:
var array = ImmutableArray.CreateRange(Enumerable.Range(0, 1), x => x);
-
Navigate to ImmutableArray.CreateRange
Expected Behavior:
-
The signature of CreateRange is the following:
public static ImmutableArray<TResult> CreateRange<TSource, TResult>(ImmutableArray<TSource> items, Func<TSource, TResult> selector)
-
The decompiled method body does not have comments regarding invalid IL
-
The use of selector is proper C# code
Actual Behavior:
-
The signature of CreateRange is incorrect. Specifically, the generic arguments for the type of selector are omitted:
public static ImmutableArray<TResult> CreateRange<TSource, TResult>(ImmutableArray<TSource> items, Func selector)
-
The decompiled method body has comments regarding invalid IL:
//IL_0000: Unknown result type (might be due to invalid IL)
//IL_0029: Unknown result type (might be due to invalid IL)
//IL_0032: Expected Ref, but got Unknown
-
When selector is used to assign values to array[i], the types and syntax are incorrect (both (?) and (!0) are incorrect):
array[i] = (TResult)((Func)(?)selector).Invoke((!0)items[i]);
📝 For reference, here is the complete decompiled method:
public static ImmutableArray<TResult> CreateRange<TSource, TResult>(ImmutableArray<TSource> items, Func selector)
{
//IL_0000: Unknown result type (might be due to invalid IL)
//IL_0029: Unknown result type (might be due to invalid IL)
//IL_0032: Expected Ref, but got Unknown
Requires.NotNull<Func>(selector, "selector");
int length = items.Length;
if (length == 0)
{
return ImmutableArray.Create<TResult>();
}
TResult[] array = new TResult[length];
for (int i = 0; i < array.Length; i++)
{
array[i] = (TResult)((Func)(?)selector).Invoke((!0)items[i]);
}
return new ImmutableArray<TResult>(array);
}
Version Used: 15.6 Preview 2
Steps to Reproduce:
Add a reference to System.Collections.Immutable
Add the following code:
Navigate to
ImmutableArray.CreateRangeExpected Behavior:
The signature of
CreateRangeis the following:The decompiled method body does not have comments regarding invalid IL
The use of
selectoris proper C# codeActual Behavior:
The signature of
CreateRangeis incorrect. Specifically, the generic arguments for the type ofselectorare omitted:The decompiled method body has comments regarding invalid IL:
When
selectoris used to assign values toarray[i], the types and syntax are incorrect (both(?)and(!0)are incorrect):📝 For reference, here is the complete decompiled method: