Build/Test Issues

InvalidOperationException with init properties

Started by MihaMarkic on 1,496 views

Hi guys,

I'm seeing an InvalidProgramException being thrown when assigning a init property to a record or a class.
Both test project and testee are .Net 5.


public record ApsProperty
{
public string Name { get; init; }
}


And code in test project is like this:


var expected2 = new ApsProperty
{
Name = "ClientFormId",
};


It happens at ApsProperty.set_Name(String value) according to call stack;

Post a reply

Log in to reply.