roslyn: Using System.Linq Select w/ Named ValueTuple Variables causes .Net Native Compilation Errors
After Hours on Hours of combing through my over 50,000 lines of code and trying different conditions after days on days of confusion, I discovered an issue with the ValueTuple that caused my app to fail to compile in .Net Native.
I managed to replicate it in the solution below.
Version Used: System.ValueTuple 4.3.0 Microsoft.NETCore.UniversalWindowsPlatform 5.3.2
Steps to Reproduce:
public static void TupleTest(IEnumerable<(int name1, int name2)> testSubjects)
{
var result = testSubjects.Select(item => (item.name1, item.name2, 3));
}
//comment out the first method, and this one will compile just fine
public static void WorkingTupleTest(IEnumerable<(int, int)> testSubjects)
{
var result = testSubjects.Select(item => (item.Item1, item.Item2, 3));
}
Expected Behavior: Produces a list of new Tuples with 3 Int Values out of a list of 2.
Actual Behavior:
C:\Program Files (x86)\MSBuild\15.0\.Net\.NetNative\15.0.24211\x86\ilc\IlcInternals.targets(936,5): error : Internal compiler error: Object reference not set to an instance of an object.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (19 by maintainers)
@jcouv Perhaps a more Verbose Error message next time 😃 I originally thought it was an issue with EFCore, and after copying my code into a new project, and then disabling and re-enabling parts of the project all over for hours on end, I finally stumbled upon it.