I have a very minimal .NET 6 program:
using System.Numerics;
var transform = new Transform2(default);
public readonly record struct Transform2(Vector2 Position, float Rotation)
{
public Transform2(Vector2 position) : this()
{
Position = position;
}
}
When I run it, I get an exception:
System.InvalidProgramException: Common Language Runtime detected an invalid program.
at Transform2..ctor(Vector2 position)
Why does this happen? Is it a bug in the C# compiler?