error CS0518: Predefined type 'System.Runtime.CompilerServices.IsUnmanagedAttribute' is not defined or imported
IsExternalInit, but my test project runs on .net 6.0 and the test code above is compiled with the latest C# version. AFAIK, the unmanaged constrain came with C# 7.3 / .net core 2.0.