-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Private members in other compilation units are not mapped with IncludedMembers = MemberVisibility.All #1458
Comments
I cannot reproduce this locally and I'm not sure if .NET fiddle runs source generators correctly. # in a new empty directory
dotnet new console
dotnet add package Riok.Mapperly -v 3.6.0
# replace content of Program.cs with provided content
dotnet run
# prints new-user@gmail.com as expected... Do these steps work for you? Can you reproduce the issue in Rider? in VS Code? in VS? on the terminal? |
Can confirm this worked, however the minimal reproduction is not complete, my bad. Here is a better one. I experienced it when the object mapped is in a different project. The generated code in Rider is: // <auto-generated />
#nullable enable
public static partial class UserMapper
{
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "3.6.0.0")]
static partial void ApplyTo(this global::UserUpdateDto input, global::User user)
{
user.SetEmailAddress(input.EmailAddress);
}
}
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "3.6.0.0")]
static file class UnsafeAccessor
{
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "3.6.0.0")]
[global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_EmailAddress")]
public static extern void SetEmailAddress(this global::User target, string value);
} The generated code seems correct and is the exact same as when the class is contained in the same project. However, when running it, the changes are not applied. cc @latonz |
Thanks for the update, I can reproduce it now. |
Pretty sure
|
We may need to access the backing field directly in this case, instead of going through the setter... |
Describe the bug
Pubic property with private setter are not mapped even with
IncludedMembers = MemberVisibility.All
appliedDeclaration code
https://dotnetfiddle.net/E4iGqY - reproduction
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: