Open andysturrock opened 8 years ago
List should not be supported as it's mutable. Use IReadOnlyList instead. However there is a bug here: it should throw on creating the serialiser.
I just forked the repo to look at this. It is now more graceful as it throws System.Exception : Unable to serialise type System.Collections.Generic.List
1[System.Int32]`. Your NuGet release is behind the latest code in GibHub I guess.
I agree with the point about mutability but that's not checked everywhere. Eg this still works:
public sealed class UserScore
{
public UserScore(string name, int score)
{
Name = name;
Score = score;
}
public string Name { get; set; }
public int Score { get; set; }
}
So it's a bit inconsistent isn't it?
Yes that is inconsistent. Will have a think. I like immutability and it's important to make it possible, but maybe Dasher shouldn't force it on users. Will have a think.
Just pushed 0.3.0 to NuGet.
The following code throws a
System.Security.VerificationException : Operation could destabilize the runtime.
:I'll take a look but you might get there quicker :-)