{"action":"created","issue":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/949","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/949/labels{/name}","comments_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/949/comments","events_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/949/events","html_url":"https://github.com/AutoMapper/AutoMapper/issues/949","id":113013246,"number":949,"title":"Breaking Change in 4.1.0 ProjectTo(IMappingEngine) overload","user":{"login":"richardlawley","id":1608083,"avatar_url":"https://avatars.githubusercontent.com/u/1608083?v=3","gravatar_id":"","url":"https://api.github.com/users/richardlawley","html_url":"https://github.com/richardlawley","followers_url":"https://api.github.com/users/richardlawley/followers","following_url":"https://api.github.com/users/richardlawley/following{/other_user}","gists_url":"https://api.github.com/users/richardlawley/gists{/gist_id}","starred_url":"https://api.github.com/users/richardlawley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardlawley/subscriptions","organizations_url":"https://api.github.com/users/richardlawley/orgs","repos_url":"https://api.github.com/users/richardlawley/repos","events_url":"https://api.github.com/users/richardlawley/events{/privacy}","received_events_url":"https://api.github.com/users/richardlawley/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/labels/Bug","name":"Bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/milestones/17","html_url":"https://github.com/AutoMapper/AutoMapper/milestones/4.1.1","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/milestones/17/labels","id":1372453,"number":17,"title":"4.1.1","description":"","creator":{"login":"jbogard","id":104498,"avatar_url":"https://avatars.githubusercontent.com/u/104498?v=3","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":8,"state":"closed","created_at":"2015-10-23T14:06:03Z","updated_at":"2015-11-12T14:59:26Z","due_on":"2015-10-30T05:00:00Z","closed_at":"2015-11-12T14:59:26Z"},"comments":4,"created_at":"2015-10-23T12:53:39Z","updated_at":"2016-02-01T10:04:50Z","closed_at":"2015-10-23T22:02:01Z","body":"At 4.0.4, there were two overloads for .ProjectTo:\r\n* `.ProjectTo<TDest>()`\r\n* `.ProjectTo<TDest>(mappingEngine)`\r\n\r\n4.1.0 introduced `.ProjectTo<TDest>(object parameters, membersToExpand)`.  This breaks code written using the 4.0.4 overload, and it does so in a way which will not introduce any compile errors - the code will silently fail, trying to use the default mapper instead, as the new overload takes precedence.\r\n\r\nThe following code works fine in 4.0.4:\r\n\r\n\t[TestClass]\r\n\tpublic class UnitTest1\r\n\t{\r\n\t\t[TestMethod]\r\n\t\tpublic void TestMethod1()\r\n\t\t{\r\n\t\t\tvar mapperConfig = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers);\r\n\t\t\tmapperConfig.CreateMap<Foo, Bar>();\r\n\t\t\tvar mapper = new MappingEngine(mapperConfig);\r\n\r\n\t\t\tIList<Foo> source = new List<Foo>();\r\n\r\n\t\t\tvar result = source.AsQueryable().ProjectTo<Bar>(mapper).ToList();\r\n\t\t}\r\n\r\n\t\tpublic class Foo { }\r\n\r\n\t\tpublic class Bar { }\r\n\t}\r\n\r\nIn 4.1.0 it will fail because it falls back to using the default mapper.  The code has to be changed to work, from:\r\n\r\n    var result = source.AsQueryable().ProjectTo<Bar>(mapper).ToList();\r\n\r\nto\r\n\r\n    var result = source.AsQueryable().ProjectTo<Bar>(null, mapper).ToList();\r\n\r\nI appreciate it's a bit late to do anything about this change as people will already have begun upgrading - fortunately my unit tests caught this behaviour and I was able to spot it.  I think the release notes could do with mentioning this change however."},"comment":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/comments/177887481","html_url":"https://github.com/AutoMapper/AutoMapper/issues/949#issuecomment-177887481","issue_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/949","id":177887481,"user":{"login":"lbargaoanu","id":4517428,"avatar_url":"https://avatars.githubusercontent.com/u/4517428?v=3","gravatar_id":"","url":"https://api.github.com/users/lbargaoanu","html_url":"https://github.com/lbargaoanu","followers_url":"https://api.github.com/users/lbargaoanu/followers","following_url":"https://api.github.com/users/lbargaoanu/following{/other_user}","gists_url":"https://api.github.com/users/lbargaoanu/gists{/gist_id}","starred_url":"https://api.github.com/users/lbargaoanu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbargaoanu/subscriptions","organizations_url":"https://api.github.com/users/lbargaoanu/orgs","repos_url":"https://api.github.com/users/lbargaoanu/repos","events_url":"https://api.github.com/users/lbargaoanu/events{/privacy}","received_events_url":"https://api.github.com/users/lbargaoanu/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T10:04:50Z","updated_at":"2016-02-01T10:04:50Z","body":"This should be fixed in 5.0"}}