Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

Provide more details on null reference questions

Open mhkolk opened this issue 2 years ago • 2 comments

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=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

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?

mhkolk avatar Jul 18 '23 09:07 mhkolk

I have this same situation, how did you manage to solve your problem?

uzielmercado11 avatar Dec 26 '23 17:12 uzielmercado11

I have also this situation and don't understand why is failing, it should only set null value for the destination property.

martinib77 avatar Jul 18 '24 14:07 martinib77