Object not being mapped during Deep Clone #89

Closed
SteveWilkes opened this Issue Nov 29, 2016 · 2 comments

Projects

None yet

2 participants

@SteveWilkes

Hi,

I've written a project to test the performance of various mappers at different tasks, and it looks to have uncovered an issue in Mapster's deep-cloning.

The object being cloned has the following members (among others):

  • Foos : List
  • FooArray : Foo[]
  • Ints : IEnumerable
  • IntArray: int[]

As you can see from the screenshot, the post-mapping, cloned object has its FooArray elements and Ints properties copied, instead of mapped - that is, the values from the source object are being used directly instead of being cloned.

2016-11-29 mapster cloning

Cheers,

Steve

@chaowlert
Collaborator

for foo.FooArray[0] == foo.Adapt<Foo>().FooArray[0], this cannot reproduce in current source. But it can be reproduced from latest package. I dig into history, this had been fixed since August, but it might not yet been published. (sorry for this)

For IEnumerable<int>, I intentional reuse the same object (for enumerable of primitive) just because I think that IEnumerable is readonly by type definition. Originally, I built Mapster for mapping poco to dto only. But this test case is valid, I will fix this. Thank you.

@SteveWilkes

No problems :)

@chaowlert chaowlert closed this in 4b213d5 Nov 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment