Cysharp / Cysharp/MemoryPack

Optional support for opt-in public member serialization?

Open
#342 8 comments 3 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

When switching to MemoryPack from another serialization solution, it would be useful to have an option to avoid automatically serializing all public members of MemoryPackable classes, because marking them all with MemoryPackIgnore is too much work and makes code ugly. I propose to add an option to MemoryPackable attribute, or, if it's too much work for generator, maybe add a separate MemoryPack.OptIn attriubte?

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

Start by reading the MemoryPackable attribute and the source generator to understand how public members are currently selected and where ignore handling is implemented. Compare the proposed attribute option with a separate opt-in attribute, then define tests covering opt-in member selection and confirm that existing serialization behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.