-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite time to map highly bound classes #111
Comments
Mapster will recursively traverse to all members and create new objects. And if there is circular relationship, mapping will take forever until you got stack overflow exception. To prevent object to be recursively mapped, pls use |
@chaowlert it doesn't help. I've set this option and it still get stuck. I can provide an example project. |
... or even PR with unit test if needed |
PR is always welcome! Do you have any clue what causes the problem? |
@chaowlert I think it is somehow connected to the way mapster caches already mapped classes, I added a counter in the code and it showed me that most of my classes are scanned thousands of times. May be am just setting up things incorrectly, so you may correct me after looking over #112 . Let me know if issue cannot be resolved easy, so I will start my attempts to improve mapster. |
Thank you for test case, now I know the problem. For performance optimization, Mapster tried to inline class mapping for example if there is only Parent and Child, class generation will be like
But if class relationship is a lot, it ends up Mapster will create a very large method. And this process takes a lot of time. I'm just have time to work on Mapster again, I just add a lot of features in https://github.com/chaowlert/Mapster (develop branch). For this issue, I think I can fix this. But if you would like to join, you can pull my repo. Thank you, |
Thank you for explanation and fix! Hope it will appear in the nuget package soon. For issues with easily found and fixed cause I'm interested in creating a PR with fix done by me in future. |
@chaowlert Hi! Could you please tell me is there any estimate we could see the fix for this issue available in nuget? |
There is few things I would like to add, plus some documentation. If you need the fix, I can make prerelease this weekend. |
Hi, I just released the prerelease package (https://www.nuget.org/packages/Mapster/3.0.0-pre). Before using this package, please keep in mind that.
|
Thanks a lot for releasing the preprelease version! P.S. we can let you know if we meet some regression issue during testing the update so you're aware about some corner case that's not covered by UT :) |
Hi, this issue should be solved in Mapster 3.0. Thx for test case, I already added in unit test. In normal cases, this problem should be fixed automatically, but if problem persists, try add |
I have several highly-connected classes in my project. At this picture you may see types(vertexes) and properties(edges) of it:
Looks like due to some caching problems mapster maps any class of this diagram almost infinitely long. I can provide these classes if you need in.
The text was updated successfully, but these errors were encountered: