MapsterMapper / MapsterMapper/Mapster

Adapt(source, destination) does not work when destination is a C# record

Open
#832 45 comments 0 reactions 0 assignees View on GitHub

@DocSvartz is already working on this.

Since Dec 12, 2025.

  • #835 by @DocSvartz — open
improvement need Docs modify
Dominant language
C#
Stars
5.2k
Forks
410
Avg merge
2d 12h
Merged PRs (30d)
6

Description

When using Mapster to map data into an existing object, the mapping works correctly if the destination is a class, but does nothing when the destination is a C# record.

This appears to be caused by record immutability, but the current behavior is not clearly documented and can be misleading.

Contributor guide

Open the contributing guide

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 with the Adapt(source, destination) entry point and reproduce the difference between mapping into a class and into a C# record. Review open pull request #835 for the work already under way. Done should mean the record behavior is corrected or the limitation is clearly documented, with the misleading behavior addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.