Closed alexyakunin closed 4 months ago
Which renders v1.20 unusable :)
For the note, changing type definition to this fixes the issue:
[DataContract, MemoryPackable(GenerateType.VersionTolerant)]
[method: JsonConstructor, Newtonsoft.Json.JsonConstructor, MemoryPackConstructor]
// ReSharper disable once InconsistentNaming
public partial record AuthBackend_SetupSession(
[property: DataMember, MemoryPackOrder(0)] Session Session,
[property: DataMember, MemoryPackOrder(1)] string IPAddress,
[property: DataMember, MemoryPackOrder(2)] string UserAgent,
[property: DataMember, MemoryPackOrder(3)] ImmutableOptionSet Options
) : ISessionCommand<SessionInfo>, IBackendCommand, INotLogged
{
public AuthBackend_SetupSession(Session session, string ipAddress = "", string userAgent = "")
: this(session, ipAddress, userAgent, default) { }
}
I.e. it seems it doesn't deal well with default
values for [MemoryPackConstructor]
arguments.
Hello, Thanks for the detailed report. We have released the fixed version. I hope you will check it out. Thanks. https://github.com/Cysharp/MemoryPack/releases/tag/1.20.4
We have the following type:
And when it's used in this type:
the following code is generated for deserialization, which triggers compile-time error: