Cysharp / Cysharp/MemoryPack

Init properties aren't deserialized

Open
#438 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
C#
Stars
4.7k
Forks
313
PR merge metrics
No merged PRs in 30d

Description

Hi, if I have a class with init properties:

[MemoryPackable(GenerateType.CircularReference, SerializeLayout.Sequential)]
public partial class MyClass
{
    public string? Data { get; init; }
}

then Data property is not deserialized. Although original object has real value in this property, also serialized object has, but during deserialization is not assigned at proper time and it's just lost.

Also MemoryPack constructor cannot be used, because it expects a parameterless constructor in CircularReference generation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown MyClass example using CircularReference and Sequential serialization, then inspect the generated deserialization path and MemoryPack constructor handling. Confirm that Data is assigned during deserialization and that the constructor limitation is addressed without losing circular-reference behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.