A System.TypeLoadException is incorrectly thrown on dotnet 6 when mocking a record with a base record. See simple repro below.
using System;
using Moq;
namespace Testing
{
public record First : Base
{
public virtual string Something { get; init; }
}
public record Base {}
class Program
{
static void Main(string[] args)
{
Mock<First> mockFirst = new();
mockFirst.SetupGet(f => f.Something).Returns("string");
Console.WriteLine(mockFirst.Object.Something);
}
}
}