{"action":"closed","issue":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2871","repository_url":"https://api.github.com/repos/AutoMapper/AutoMapper","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2871/labels{/name}","comments_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2871/comments","events_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2871/events","html_url":"https://github.com/AutoMapper/AutoMapper/issues/2871","id":381227026,"node_id":"MDU6SXNzdWUzODEyMjcwMjY=","number":2871,"title":"Read only properties","user":{"login":"rheone","id":1584973,"node_id":"MDQ6VXNlcjE1ODQ5NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/1584973?v=4","gravatar_id":"","url":"https://api.github.com/users/rheone","html_url":"https://github.com/rheone","followers_url":"https://api.github.com/users/rheone/followers","following_url":"https://api.github.com/users/rheone/following{/other_user}","gists_url":"https://api.github.com/users/rheone/gists{/gist_id}","starred_url":"https://api.github.com/users/rheone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rheone/subscriptions","organizations_url":"https://api.github.com/users/rheone/orgs","repos_url":"https://api.github.com/users/rheone/repos","events_url":"https://api.github.com/users/rheone/events{/privacy}","received_events_url":"https://api.github.com/users/rheone/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-11-15T15:59:46Z","updated_at":"2018-11-15T16:40:19Z","closed_at":"2018-11-15T16:40:19Z","author_association":"NONE","body":"Automapper silently fails to set property via `ValueResolver` on a destination Interface, when said property on the interface is readonly, but its AutoMapper known concrete implementation’s property is writable.\r\n\r\nSee the reproduction example within the following [gist](https://gist.github.com/rheone/c0f51753881bdf43b82fc7309576d5fb) for entire source file with xUnit test.\r\n\r\n### Source/destination types\r\n\r\n```csharp\r\npublic class Source\r\n{\r\n    public int Id { get; set; }\r\n}\r\n\r\npublic interface IDestination\r\n{\r\n    string ValueFromValueResolver { get; }\r\n}\r\n\r\npublic class Destination : IDestination\r\n{\r\n    public string ValueFromValueResolver { get; set; }\r\n}\r\n```\r\n\r\n### Mapping configuration\r\n\r\n```csharp\r\nnew MapperConfiguration(_ =>\r\n {\r\n     _.CreateMap<Source, IDestination>()\r\n      .ForMember(d => d.ValueFromValueResolver, o => o.ResolveUsing<DestinationValueResolver>());\r\n\r\n     _.CreateMap<Source, IDestination>()\r\n      .As<Destination>();\r\n }).CreateMapper();\r\n```\r\n### Value Resolver\r\n\r\n```csharp\r\npublic class DestinationValueResolver : IValueResolver<Source, IDestination, string>\r\n{\r\n    public string Resolve(Source source,\r\n                          IDestination destination,\r\n                          string destMember,\r\n                          ResolutionContext context)\r\n    {\r\n        return $\"Value from source \\\"{source.Id}\\\".\";\r\n    }\r\n}\r\n```\r\n\r\n### Version: 7.0.1\r\n\r\n### Expected behavior\r\n\r\nAutomapper should either \r\n - throw an exception / fail non-silently\r\n - recognize, as it is aware it is treating `IDestination` as a `Destination`, and set the value of `Destination.ValueFromValueResolver`\r\n\r\n### Actual behavior\r\n\r\nThe resulting value returned from the mad does not have its `ValueFromValueResolver` value set, and AutoMapper raises no issues\r\n\r\n### Steps to reproduce\r\n\r\n```csharp\r\nmapper.Map<IDestination>(source)\r\n```\r\n\r\nSee [gist](https://gist.github.com/rheone/c0f51753881bdf43b82fc7309576d5fb)\r\n"}}
{"actor":{"display_login":"lbargaoanu"}}