Testing C# 9.0 in VS2019 - CS0518 IsExternalInit is not defined or imported … How do I define/import it?

前端 未结 1 661
忘掉有多难
忘掉有多难 2020-12-18 17:47

EDIT [Nov 29 2020]: .NET 5.0 is out now, but the solution below is still required if you\'re targetting .NET Standard 2.1


C# 9.0 is still unde

相关标签:
1条回答
  • 2020-12-18 18:24

    This is a bug in the current preview and the latest master branch (June 27). A simple record in sharplab.io creates the same error.

    Just add the missing type somewhere in your project

    namespace System.Runtime.CompilerServices
    {
        public class IsExternalInit{}
    }
    

    Records and init will work without problem.

    Only LinqPad 6 seems to work without problems, probably because it includes that type too

    0 讨论(0)
提交回复
热议问题