Cysharp / Cysharp/MemoryPack

NullReferenceException on parallel Deserialize

Open Beginner friendly
#458 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://github.com/Cysharp/MemoryPack/blob/85ab9ad76c380aca48c09ff3a0ad955ee5a2902b/src/MemoryPack.Core/MemoryPackFormatterProvider.cs#L47-L52

Check<T>.registered = true; is set before Cache<T>.formatter = formatter; and cause Cache<T>.formatter to be null on parallel access

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 at src/MemoryPack.Core/MemoryPackFormatterProvider.cs lines 47-52 and inspect the parallel Deserialize path around the registration and formatter cache assignments. Reproduce concurrent access and verify that deserialization no longer raises NullReferenceException under parallel access, adding regression coverage where the existing tests for this component belong.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.