Conversation
Member
BlaiseD
commented
Feb 24, 2026
- Consolidated all expression extension methods into ExpressionExtensions.cs; deleted VisitorExtensions.cs.
- Added ExpressionHelpers.cs for member access and parameter replacement helpers.
- Fixed resource typos ("deledate" → "delegate", "rempa" → "map").
- Added new error message for invalid type mappings.
- Updated TypeMappingsManager to throw on mismatched Expression<> types and always add type mappings for argument pairs.
- Cleaned up XpressionMapperVisitor.cs, fixed VisitParameter bug, and removed unused ConvertTypesIfNecessary.
- Updated unit tests for corrected error messages.
- Improves code organization, error clarity, and maintainability.
- Consolidated all expression extension methods into ExpressionExtensions.cs; deleted VisitorExtensions.cs.
- Added ExpressionHelpers.cs for member access and parameter replacement helpers.
- Fixed resource typos ("deledate" → "delegate", "rempa" → "map").
- Added new error message for invalid type mappings.
- Updated TypeMappingsManager to throw on mismatched Expression<> types and always add type mappings for argument pairs.
- Cleaned up XpressionMapperVisitor.cs, fixed VisitParameter bug, and removed unused ConvertTypesIfNecessary.
- Updated unit tests for corrected error messages.
- Improves code organization, error clarity, and maintainability.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the expression extension methods by consolidating VisitorExtensions.cs into ExpressionExtensions.cs and extracting non-extension helper methods into a new ExpressionHelpers.cs file. It also corrects several typos in resource strings and error messages, fixes a bug in XpressionMapperVisitor.VisitParameter, removes unused code, and adds validation logic to TypeMappingsManager to ensure Expression<> type pairs are properly matched.
Changes:
- Consolidated expression extension methods from VisitorExtensions.cs into ExpressionExtensions.cs and deleted VisitorExtensions.cs
- Created ExpressionHelpers.cs for helper methods that are not extension methods
- Fixed typos in resource files: "deledate" → "delegate", "rempa" → "map"
- Added validation in TypeMappingsManager to throw ArgumentException when source is Expression but dest is not Expression
- Fixed VisitParameter bug using correct KeyValuePair generic type
- Removed unused ConvertTypesIfNecessary method and unnecessary using directives
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/AutoMapper.Extensions.ExpressionMapping.UnitTests/TypeMappingsManagerTest.cs | Updated test assertions to match corrected error message ("delegate" instead of "deledate") |
| src/AutoMapper.Extensions.ExpressionMapping/XpressionMapperVisitor.cs | Removed unused imports, fixed VisitParameter generic type bug, and deleted unused ConvertTypesIfNecessary method |
| src/AutoMapper.Extensions.ExpressionMapping/TypeMappingsManager.cs | Added validation for Expression<> type pairs and simplified DoAddTypeMappings/DoAddTypeMappingsFromDelegates methods |
| src/AutoMapper.Extensions.ExpressionMapping/Properties/Resources.resx | Fixed typos and added new error message for invalid type mappings |
| src/AutoMapper.Extensions.ExpressionMapping/Properties/Resources.Designer.cs | Updated generated code for corrected resource strings |
| src/AutoMapper.Extensions.ExpressionMapping/MapperExtensions.cs | Updated to use corrected resource key cantMapExpression |
| src/AutoMapper.Extensions.ExpressionMapping/Extensions/VisitorExtensions.cs | Deleted file - methods moved to ExpressionExtensions.cs and ExpressionHelpers.cs |
| src/AutoMapper.Extensions.ExpressionMapping/ExpressionHelpers.cs | New file containing helper methods (MemberAccesses, ReplaceParameters, Replace) that are not extension methods |
| src/AutoMapper.Extensions.ExpressionMapping/ExpressionExtensions.cs | Consolidated all expression extension methods from VisitorExtensions.cs |
Files not reviewed (1)
- src/AutoMapper.Extensions.ExpressionMapping/Properties/Resources.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/AutoMapper.Extensions.ExpressionMapping/Properties/Resources.resx
Outdated
Show resolved
Hide resolved
src/AutoMapper.Extensions.ExpressionMapping/Properties/Resources.resx
Outdated
Show resolved
Hide resolved
src/AutoMapper.Extensions.ExpressionMapping/Properties/Resources.Designer.cs
Outdated
Show resolved
Hide resolved
Contributor
3 tasks
* Initial plan * Add test for Expression source with non-Expression destination validation Co-authored-by: BlaiseD <7595209+BlaiseD@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BlaiseD <7595209+BlaiseD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Corrected "Invalis type mappings" to "Invalid type mappings" in the assertion for AddTypeMapping_ExpressionSourceNonExpressionDest_ThrowsArgumentExcep test to ensure accurate exception message validation.
Corrected "Invalis" to "Invalid" in resource string summaries and XML comments. Also fixed "destinationTyp;" to "destinationType" in resource comments for clarity. No functional changes made.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.