When interpolating objects into strings (mainly for logging purposes), it needs to be explicitly serialized otherwise what you get is:
.
Change your serialization code to (assuming you are using System.Text.Json
):
public abstract class BaseModel
{
public override string ToString()
{
return JsonSerializer.Serialize(this, this.GetType());
}
}
You are using generic JsonSerializer.SerializeTValue
is subsitued with your BaseModel
class, which has no properties, basically ending in JsonSerializer.Serialize
call being performed.