{"action":"created","issue":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2513","repository_url":"https://api.github.com/repos/AutoMapper/AutoMapper","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2513/labels{/name}","comments_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2513/comments","events_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2513/events","html_url":"https://github.com/AutoMapper/AutoMapper/issues/2513","id":292461226,"number":2513,"title":"Open generics in combination with mapping inheritance do not work","user":{"login":"pfeigl","id":237891,"avatar_url":"https://avatars1.githubusercontent.com/u/237891?v=4","gravatar_id":"","url":"https://api.github.com/users/pfeigl","html_url":"https://github.com/pfeigl","followers_url":"https://api.github.com/users/pfeigl/followers","following_url":"https://api.github.com/users/pfeigl/following{/other_user}","gists_url":"https://api.github.com/users/pfeigl/gists{/gist_id}","starred_url":"https://api.github.com/users/pfeigl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfeigl/subscriptions","organizations_url":"https://api.github.com/users/pfeigl/orgs","repos_url":"https://api.github.com/users/pfeigl/repos","events_url":"https://api.github.com/users/pfeigl/events{/privacy}","received_events_url":"https://api.github.com/users/pfeigl/received_events","type":"User","site_admin":false},"labels":[{"id":92629393,"url":"https://api.github.com/repos/AutoMapper/AutoMapper/labels/Improvement","name":"Improvement","color":"207de5","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/milestones/31","html_url":"https://github.com/AutoMapper/AutoMapper/milestone/31","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/milestones/31/labels","id":2951509,"number":31,"title":"v.next","description":null,"creator":{"login":"jbogard","id":104498,"avatar_url":"https://avatars1.githubusercontent.com/u/104498?v=4","gravatar_id":"","url":"https://api.github.com/users/jbogard","html_url":"https://github.com/jbogard","followers_url":"https://api.github.com/users/jbogard/followers","following_url":"https://api.github.com/users/jbogard/following{/other_user}","gists_url":"https://api.github.com/users/jbogard/gists{/gist_id}","starred_url":"https://api.github.com/users/jbogard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbogard/subscriptions","organizations_url":"https://api.github.com/users/jbogard/orgs","repos_url":"https://api.github.com/users/jbogard/repos","events_url":"https://api.github.com/users/jbogard/events{/privacy}","received_events_url":"https://api.github.com/users/jbogard/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":22,"state":"open","created_at":"2017-12-01T14:37:37Z","updated_at":"2018-01-31T21:21:42Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2018-01-29T15:59:18Z","updated_at":"2018-02-19T12:13:11Z","closed_at":"2018-01-31T21:21:41Z","author_association":"NONE","body":"This is probably a very rare case but hit's us with the .net core Identity classes because they reflect just this setup.\r\n\r\nWhen trying to define mapping rules for open generics and re-use them on the concrete implementation using IncludeBase, no errors appear while setting the mapping up, but the defined rules are not applied.\r\n\r\nGiven the following example:\r\n\r\n```csharp\r\nusing AutoMapper;\r\n\r\nnamespace ConsoleApp3\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            Mapper.Initialize(cfg =>\r\n            {\r\n                cfg.CreateMap(typeof(BaseUserDto<>), typeof(BaseUserEntity<>))\r\n                    .ForMember(\"Id\", opt => opt.Ignore());\r\n\r\n                cfg.CreateMap(typeof(ConcreteUserDto), typeof(ConcreteUserEntity))\r\n                    .IncludeBase(typeof(BaseUserDto<>), typeof(BaseUserEntity<>));\r\n            });\r\n\r\n            var user = new ConcreteUserDto\r\n            {\r\n                Id = \"my-id\",\r\n                Name = \"my-User\"\r\n            };\r\n\r\n            var userEntity = Mapper.Map<ConcreteUserEntity>(user);\r\n        }\r\n    }\r\n\r\n    public abstract class BaseUserDto<TIdType>\r\n    {\r\n        public TIdType Id { get; set; }\r\n        public string Name { get; set; }\r\n    }\r\n\r\n    public class ConcreteUserDto : BaseUserDto<string>\r\n    {\r\n    }\r\n\r\n    public abstract class BaseUserEntity<TIdType>\r\n    {\r\n        public TIdType Id { get; set; }\r\n        public string Name { get; set; }\r\n    }\r\n\r\n    public class ConcreteUserEntity : BaseUserEntity<string>\r\n    {\r\n    }\r\n}\r\n```\r\n\r\nThe expectation would be, that the resulting `userEntity` object has it's `Id` property set to null, however it is copied over from the DTO.\r\n\r\nWhen changing the example to hardcode all generics to `int`, everything works as expected.\r\n"},"comment":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/comments/366674356","html_url":"https://github.com/AutoMapper/AutoMapper/issues/2513#issuecomment-366674356","issue_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/2513","id":366674356,"user":{"login":"pfeigl","id":237891,"avatar_url":"https://avatars1.githubusercontent.com/u/237891?v=4","gravatar_id":"","url":"https://api.github.com/users/pfeigl","html_url":"https://github.com/pfeigl","followers_url":"https://api.github.com/users/pfeigl/followers","following_url":"https://api.github.com/users/pfeigl/following{/other_user}","gists_url":"https://api.github.com/users/pfeigl/gists{/gist_id}","starred_url":"https://api.github.com/users/pfeigl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfeigl/subscriptions","organizations_url":"https://api.github.com/users/pfeigl/orgs","repos_url":"https://api.github.com/users/pfeigl/repos","events_url":"https://api.github.com/users/pfeigl/events{/privacy}","received_events_url":"https://api.github.com/users/pfeigl/received_events","type":"User","site_admin":false},"created_at":"2018-02-19T12:13:11Z","updated_at":"2018-02-19T12:13:11Z","author_association":"NONE","body":"Thanks for this super fast fix btw 👍 Is there any info on when the next release will happen which is going to include the fix?\r\n\r\n"}}
{"actor":{"display_login":"pfeigl"}}