Code inspection: Call to a non-readonly member from a 'readonly' member results in an implicit copy of 'this'
This inspection reports a call from a readonly struct member to another instance member that is not readonly. That call forces the compiler to make an implicit copy of this. Any mutation then happens on the copy, and even when no mutation occurs the extra defensive copy can still be surprising or inefficient.
Example
struct S
{
public int Value;
public int GetValue()
{
return Value;
}
public readonly int Read()
{
return GetValue();
}
}
struct S
{
public int Value;
public readonly int GetValue()
{
return Value;
}
public readonly int Read()
{
return GetValue();
}
}
Quick-fix
Depending on the situation, the quick-fix can either make the called member readonly or remove readonly from the containing member.
21 April 2026