{"action":"created","issue":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1801","repository_url":"https://api.github.com/repos/AutoMapper/AutoMapper","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1801/labels{/name}","comments_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1801/comments","events_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1801/events","html_url":"https://github.com/AutoMapper/AutoMapper/issues/1801","id":190464414,"number":1801,"title":"Custom Mapping Collection Produces Empty Result","user":{"login":"nyditot","id":5779565,"avatar_url":"https://avatars.githubusercontent.com/u/5779565?v=3","gravatar_id":"","url":"https://api.github.com/users/nyditot","html_url":"https://github.com/nyditot","followers_url":"https://api.github.com/users/nyditot/followers","following_url":"https://api.github.com/users/nyditot/following{/other_user}","gists_url":"https://api.github.com/users/nyditot/gists{/gist_id}","starred_url":"https://api.github.com/users/nyditot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyditot/subscriptions","organizations_url":"https://api.github.com/users/nyditot/orgs","repos_url":"https://api.github.com/users/nyditot/repos","events_url":"https://api.github.com/users/nyditot/events{/privacy}","received_events_url":"https://api.github.com/users/nyditot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2016-11-19T01:39:07Z","updated_at":"2016-11-30T22:18:43Z","closed_at":null,"body":"In attempting to create a custom IValueResolver that merges source and destination Collections, I'm getting an empty collection result in the destination.  Here is code that demonstrates the issue;\r\n\r\n```\r\nusing AutoMapper;\r\nusing System.Collections.Generic;\r\nnamespace AutoMapperTests\r\n{\r\n    public class AutoMapperTester\r\n    {\r\n        public class Source\r\n        {\r\n            public ICollection<string> Collection { get; set; }\r\n        }\r\n        public class Destination\r\n        {\r\n            public ICollection<string> Collection { get; set; }\r\n        }\r\n        public class MergeCollectionResolver : IValueResolver<Source, Destination, ICollection<string>>\r\n        {\r\n            public ICollection<string> Resolve(Source source, Destination destination, ICollection<string> destMember, ResolutionContext context)\r\n            {\r\n                foreach (string sourceItem in source.Collection)\r\n                {\r\n                    destMember.Add(sourceItem);\r\n                }\r\n                return destMember;\r\n            }\r\n        }\r\n        public void Test()\r\n        {\r\n            Mapper.Initialize(cfg =>\r\n            {\r\n                cfg.CreateMap<Source, Destination>()\r\n                    .ForMember(s => s.Collection, opt => opt.ResolveUsing(new MergeCollectionResolver()));\r\n            });\r\n            var source = new Source()\r\n            {\r\n                Collection = new List<string>() { \"a\", \"b\", \"c\" }\r\n            };\r\n            var destination = new Destination()\r\n            {\r\n                Collection = new List<string>() { \"d\", \"e\", \"f\" }\r\n            };\r\n\r\n            Mapper.Map<Source, Destination>(source, destination);\r\n\r\n            // After mapping the destination collection has 0 items.\r\n            // It should have 6.\r\n            System.Diagnostics.Debug.Assert(destination.Collection.Count == 6);\r\n        }\r\n    }\r\n}\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/comments/264014478","html_url":"https://github.com/AutoMapper/AutoMapper/issues/1801#issuecomment-264014478","issue_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1801","id":264014478,"user":{"login":"TylerCarlson1","id":6801536,"avatar_url":"https://avatars.githubusercontent.com/u/6801536?v=3","gravatar_id":"","url":"https://api.github.com/users/TylerCarlson1","html_url":"https://github.com/TylerCarlson1","followers_url":"https://api.github.com/users/TylerCarlson1/followers","following_url":"https://api.github.com/users/TylerCarlson1/following{/other_user}","gists_url":"https://api.github.com/users/TylerCarlson1/gists{/gist_id}","starred_url":"https://api.github.com/users/TylerCarlson1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TylerCarlson1/subscriptions","organizations_url":"https://api.github.com/users/TylerCarlson1/orgs","repos_url":"https://api.github.com/users/TylerCarlson1/repos","events_url":"https://api.github.com/users/TylerCarlson1/events{/privacy}","received_events_url":"https://api.github.com/users/TylerCarlson1/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T22:18:43Z","updated_at":"2016-11-30T22:18:43Z","body":"Maybe have the main markdown page or the wiki have extension section saying this is available, with full disclosure that you don't approve but some people think it's important.  Also you could include AutoMapper.EF6, AutoMapper.Data (if it ever gets fixed that is), AutoMapper.DependencyInjection, ect in there as well.\r\n"}}
{"actor":{"display_login":"TylerCarlson1"}}