Skip to content

Private members in other compilation units are not mapped with IncludedMembers = MemberVisibility.All #1458

Description

@cs-clarence

Describe the bug
Pubic property with private setter are not mapped even with IncludedMembers = MemberVisibility.All applied

Declaration code
https://dotnetfiddle.net/E4iGqY - reproduction

using System;
using Riok.Mapperly.Abstractions;

public class User(string emailAddress) 
{
	public string EmailAddress { get; private set; } = emailAddress;
}

public record UserUpdateDto(string EmailAddress);

[Mapper(IncludedMembers = MemberVisibility.All)]
public static partial class UserMapper 
{
	static partial void ApplyTo(this UserUpdateDto input, User user);
	
	public static void ApplyUpdates(this UserUpdateDto input, User user) 
	{
		UserMapper.ApplyTo(input, user);
	}
}
					
public class Program
{
	public static void Main()
	{
		var user = new User("[email protected]");
		var updates = new UserUpdateDto("[email protected]");
		
		updates.ApplyUpdates(user);
		
		Console.WriteLine(user.EmailAddress); // still shows [email protected]
	}
}

Environment (please complete the following information):

  • Mapperly Version: 3.6.0
  • Nullable reference types: enabled
  • .NET Version: .NET 8.0
  • Target Framework: .NET 8.0
  • Compiler Version: 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions