Skip to content
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

Fix crash when object to object mapping #340

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

TimothyMakkison
Copy link
Collaborator

Resolves #313

Resolve ide hanging/crash when object to object mapping when deep clone is enabled. I mentioned my concerns in the issue, is it correct for a simple copy to be used when deep cloning is enabled? Should I instead make this a diagnostic errror or would updating the docs and adding a note to the UseDeepCloning attribute be enough?

  • Added another branch to SpecialTypeMappingBuilder for object->object edge case
  • Added object->object and object?->object? tests

@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2023

Codecov Report

Merging #340 (7e3cecc) into main (dce4b42) will increase coverage by 0.25%.
The diff coverage is 93.98%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #340      +/-   ##
==========================================
+ Coverage   91.71%   91.96%   +0.25%     
==========================================
  Files         109      118       +9     
  Lines        3379     3723     +344     
  Branches      438      502      +64     
==========================================
+ Hits         3099     3424     +325     
- Misses        189      205      +16     
- Partials       91       94       +3     
Impacted Files Coverage Δ
src/Riok.Mapperly.Abstractions/MapEnumAttribute.cs 100.00% <ø> (ø)
...appings/NewInstanceObjectFactoryPropertyMapping.cs 100.00% <ø> (ø)
...escriptors/Mappings/ObjectPropertyMethodMapping.cs 90.00% <ø> (ø)
...riptors/MappingBuilders/QueryableMappingBuilder.cs 68.42% <68.42%> (ø)
...Descriptors/Mappings/EnumFromStringParseMapping.cs 73.68% <73.68%> (ø)
...criptors/Mappings/PropertyMappings/PropertyPath.cs 89.06% <80.00%> (-3.60%) ⬇️
src/Riok.Mapperly/Helpers/SymbolExtensions.cs 86.56% <81.81%> (+0.85%) ⬆️
...iptors/MappingBuilders/DictionaryMappingBuilder.cs 79.51% <83.33%> (+0.50%) ⬆️
src/Riok.Mapperly/Descriptors/WellKnownTypes.cs 87.23% <83.87%> (-8.92%) ⬇️
...ers/NewInstanceObjectPropertyMappingBodyBuilder.cs 80.43% <91.66%> (+2.83%) ⬆️
... and 43 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, as you already considered, I'd introduce a diagnostic for this case object mapped to another object without deep clone with a default severity of Info.

The commit message indicates that this is a feature. I'd say this is more of a bug fix and therefore the commit message should start with fix:

@TimothyMakkison TimothyMakkison force-pushed the object_cloning branch 2 times, most recently from ddc7de1 to 8997138 Compare April 15, 2023 14:04
@TimothyMakkison
Copy link
Collaborator Author

Keep getting RS2007, where should I put the new rule?

@latonz
Copy link
Contributor

latonz commented Apr 16, 2023

Keep getting RS2007, where should I put the new rule?

I don't know the exact format of the unshipped file format. However, you can add it to the shipped file directly anyway. Just re-use the format of the last line in that file. We don't do the manual transition from Unshipped to Shipped.

@TimothyMakkison
Copy link
Collaborator Author

I was eventually able to add it to the unshipped file 😅
I'll move the rule to shipped under the new release 2.9

@latonz
Copy link
Contributor

latonz commented Apr 16, 2023

The upcoming release is 2.8.0 not 2.9.0. You can add it to 2.8.0

@latonz latonz merged commit b5f4559 into riok:main Apr 17, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.8.0-next.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source generator hangs (and Visual Studio crashes) when mapping property type Object
3 participants