Releases: Pawankumar9090/TypeSync
v1.0.6 — Circular Reference Protection & ProjectTo Collection Fix Release Notes
🐛 Bug Fixes
-
Map() Circular Reference Stack Overflow — Fixed
StackOverflowExceptionwhen usingMap()on entities with circular navigation properties (e.g.,Booking → Customer → Bookings). Added thread-safe visited-object tracking to detect and break cycles. -
ProjectTo ForMember Collection Mapping — Fixed
ProjectTonot automatically mapping nested collection properties configured viaForMember/MapFromwhen source and destination property names differ (e.g.,BookingAddonPests→AddonPests). -
ProjectTo Circular Type Reference — Fixed
StackOverflowExceptionin expression builder when entity types have circular type references. Added type-pair cycle detection.
📦 Full Changelog
https://github.com/Pawankumar9090/TypeSync/blob/main/CHANGELOG.md#106---2026-02-13
v1.0.5 - Enhanced Collection Mapping & LINQ Expression Support
TypeSync v1.0.5
🎯 What's New
This release focuses on improving ForMember with MapFrom to properly handle complex LINQ expressions and edge cases.
🐛 Bug Fixes
ForMember MapFrom with LINQ Select Expressions
Fixed an issue where ForMember with MapFrom containing LINQ .Select() expressions did not map nested collection elements.
Before (broken):
csharp
CreateMap<Service, ServiceResponse>()
.ForMember(dest => dest.ServicePests, opt => opt.MapFrom(src => src.ServicePests.Select(s => s.Pest)));
// ❌ ServicePests was empty or contained unmapped objects
After (fixed):
// ✅ ServicePests now correctly contains mapped PestResponse objects
Min/Max/Sum on Empty Collections
Fixed "Nullable object must have a value" error when using aggregate LINQ methods on empty collections.
Before (broken):
.ForMember(dest => dest.MinPrice, opt => opt.MapFrom(src => src.HouseTypes.Min(x => x.Price)));
// ❌ Threw exception when HouseTypes was empty
After (fixed):
// ✅ Returns default value (0) when collection is empty
LINQ Iterator Type Detection
Enhanced element type detection for LINQ iterator types (e.g., SelectICollectionIterator<,>), ensuring proper collection mapping for deferred LINQ queries.
📦 Installation
dotnet add package TypeSync --version 1.0.5
Full Changelog: v1.0.4...v1.0.5
v1.0.4 - Runtime Property Ignore for ProjectTo
This release adds runtime property ignore support to ProjectTo(), bringing feature parity with the Map() method. You can now dynamically exclude properties during LINQ projections without modifying your mapping configuration.
✨ What's New
Runtime Property Filtering for ProjectTo
Filter out sensitive or unnecessary properties at runtime when projecting queries:
// Exclude properties dynamically during projection
var options = new MapOptions("Password", "SSN", "InternalNotes");
var users = await dbContext.Users
.Where(u => u.IsActive)
.ProjectTo<UserDto>(config, options)
.ToListAsync();
Key Features:
- 🔒 Security-friendly — Easily exclude sensitive fields from API responses
- 🔄 Consistent API — Same MapOptions class works for both Map and ProjectTo
- 🔠 Case-insensitive — Property names are matched regardless of casing
- ✅ Backward compatible — Existing code continues to work without changes
📝 Usage Examples
// Via extension method
var results = query.ProjectTo<UserDto>(config, new MapOptions("Password"));
// Via IMapper
var results = mapper.ProjectTo<UserDto>(query, new MapOptions("SecretKey"));
// Fluent builder pattern
var options = new MapOptions()
.Ignore("Email")
.Ignore("Phone")
.Ignore("InternalId");
var results = query.ProjectTo<UserDto>(config, options);
📋 Installation
dotnet add package TypeSync --version 1.0.4
Full Changelog: v1.0.3...v1.0.4
v1.0.3 - Collection Property Mapping Support
🚀 What's New in v1.0.3
This release fixes critical issues with collection property mapping, ensuring seamless mapping of ICollection<T>, List<T>, and other collection types.
🐛 Bug Fixes
- Collection Property Mapping (Map): Fixed issue where collection properties (e.g.,
ICollection<AddressDto>→ICollection<Address>) were not being mapped when usingMap<T>(). - ProjectTo ICollection Destination: Fixed
ProjectTo<T>not mapping collections when destination property isICollection<T>.
✨ Improvements
- Full support for mapping collection properties with different element types in both
Map<T>()andProjectTo<T>() - Enabled 3 previously skipped tests for nested collection mapping
- Added new test: ProjectTo_ShouldMapToICollectionDestination
📦 Supported Collection Types
All common collection types now work seamlessly:
IEnumerable<T>↔IEnumerable<T>ICollection<T>↔ICollection<T>List<T>↔List<T>T[]↔T[]- Mixed types (e.g.,
List<T>→ICollection<T>)
📖 Documentation
- Updated README with Collection Property Mapping examples
- Added ProjectTo (IQueryable Projection) section to README
Full Changelog: v1.0.2...v1.0.3
v1.0.2 - Null Safety and Nested Type Mapping Fixes
v1.0.2 (2026-01-12)
Bug Fixes
-
ProjectTo Collection Mapping: Fixed
InvalidCastExceptionwhen projecting to nullableList<T>?destination properties (e.g.,ICollection<School>→List<SchoolBasicDto>?) -
Nested Object Mapping: Added support for mapping nested complex types in ProjectTo (e.g., Class →
ClassResponse) with proper null checking -
Null-Safe MapFrom: Replaced try-catch exception handling with NullSafeEvaluator that walks expression trees and checks for null at each property access step, preventing
NullReferenceExceptionwhen using expressions likesrc.Section.Class.Name -
Type Conversion: Improved type conversion logic to properly handle assignable types and skip incompatible collection conversions
Internal Changes
- Added NullSafeEvaluator utility class for safe expression evaluation
- Added ExpressionReplacer helper for inlining nested projection expressions
- Added TryGetNestedObjectProjection method for recursive nested type mapping
- Added IsCollectionType, IsImplicitlyConvertible, and IsNumericType helper methods
v1.0.1 - Compilation Fixes & Ambiguity Resolution
Fixed
- Resolved
CS0121ambiguity error by removing theMapFrom(Func)overload. - Fixed
CS1593by implementing a new 3-argumentConditionoverload:Condition((src, dest, srcMember) => ...). - Fixed type inference issues (
CS0411) in tests by removing redundant explicit casts.
Changed
MapFromnow exclusively usesExpression-based configuration for better property inspection and validation.
v1.0.0 - Initial Release
Builds upon the solid foundation of TypeSync, introducing comprehensive mapping capabilities for .NET 8.
Added
- 🚀 Initial release of TypeSync
- ✅ Convention-based mapping - Automatically maps properties with matching names
- 🛠 Fluent configuration API - Configure mappings using
CreateMap,ForMember,ReverseMap - 📦 Profile support - Organize mappings into reusable
MappingProfileclasses - 🌳 Flattening - Map nested properties (e.g.,
Customer.Name→CustomerName) - 📚 Collection mapping - Automatic list and array mapping
- 🔧 Custom value resolvers - Implement
IValueResolverfor complex transformations - ❓ Conditional mapping - Skip properties based on conditions
- 🛡 Null substitution - Provide default values for null properties
- 💉 Dependency Injection - First-class support for
IServiceCollection - 🔍 Configuration Validation - Validate mappings with
AssertConfigurationIsValid
Security
- Nested property resolution depth limited to 10 levels
- Debug logging for troubleshooting without exposing sensitive data