在C#7.2中,我可以在委托,接口或抽象类中使用`in`参数吗?

mrd*_*bob 6 c# .net-core c#-7.2

我注意到在构建接口,委托或带in参数的抽象方法时,我收到编译器错误(CS0518:未定义或导入预定义类型'System.Runtime.InteropServices.InAttribute').错误信息对我来说不是很有启发性.我做错了什么,还是不支持?除非我误读它,否则文档建议应该工作:

in修饰符可以应用于任何带参数的成员:方法,委托,lambda,本地函数,索引器,运算符.

请参阅下面的示例:

public class Parser
{
    // Works
    public bool Parse(in ReadOnlySpan<char> span) => false;
}

public interface IParser
{
    // CS0518: Predefined type 'System.Runtime.InteropServices.InAttribute' is not defined or imported
    bool Parse(in ReadOnlySpan<char> span);
}

public abstract class AbstractParser
{
    // CS0518: Predefined type 'System.Runtime.InteropServices.InAttribute' is not defined or imported
    public abstract bool Parse(in ReadOnlySpan<char> span);
}

// CS0518: Predefined type 'System.Runtime.InteropServices.InAttribute' is not defined or imported
public delegate bool ParseDelegate(in ReadOnlySpan<char> span);
Run Code Online (Sandbox Code Playgroud)

这是在Visual Studio 2017(15.7.3)中的.NET Core 2应用程序中,我<LangVersion>7.2</LangVersion>在项目文件中有.


更新:

这似乎与项目中的Nuget包相关联.如果我删除包引用Sigil 4.7.0,则构建工作.

此外,如果我重新安装Sigil AND安装System.Runtime.InteropServices 4.3.0包,那么构建也可以.

我很高兴这可行,但是这里发生了什么?