MapsterMapper / MapsterMapper/Mapster

Provide more details on null reference questions

Open
#609 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

improvement
Dominant language
C#
Stars
5.2k
Forks
410
Avg merge
2d 12h
Merged PRs (30d)
6

Description

When mapping nested objects Mapster sometimes fails with

`System.NullReferenceException: 'Object reference not set to an instance of an object.'`

```
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=
StackTrace:

```

It does not provide details what property it actually failed on. Most of times it's impossible to evaluate manually where the point of failure is.

Could Mapster provide that information by catching the exception or some other means?

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

No file, test, or entry point is named. Start by reproducing a nested-object mapping that triggers the NullReferenceException and inspect how Mapster-generated mapping reports failures. Done means the resulting exception identifies the property or mapping path that failed, with regression coverage for the reported scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.