Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

[.NET Native] ILT0005 build error with ref T returning delegate #8273

@Sergio0694

Description

@Sergio0694

Opening this issue in here for public tracking. The original comment was here in the PR where I stumbled upon this bug. I've also already sent an email to the .NET Native team with a repro and a sample project that reproduces the issue.

Overview

Using a custom ref T returning delegate seems to trigger a build error on UWP. Consider this snippet:

public delegate ref T FieldAccessor<T>();

private int n;

private void Button_OnClick(object sender, RoutedEventArgs e)
{
    FieldAccessor<int> accessor = () => ref n;

    accessor() = default;
}

Creating a blank app and just adding that code results in the following error:

ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\x64\ilc\Tools\nutc_driver.exe @"C:\Users\Sergio\source\repos\FieldAccessorRepro\FieldAccessorRepro\obj\x64\Release\ilc\intermediate\MDIL\FieldAccessorRepro.rsp"' returned exit code 2

You can find a full repro project to download here.

This bug is currently blocking one of the follow up PRs for the Microsoft.Toolkit.Mvvm package (here), as it causes the build to just fail on UWP. I'm hoping this could be solved with some trick/workaround on the UWP side, as I'd really, really like not to be forced to alter the API surface on the .NET Standard side for a specific issue with the .NET Native compiler.

Thanks in advance! 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions