{"action":"created","issue":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1428","repository_url":"https://api.github.com/repos/AutoMapper/AutoMapper","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1428/labels{/name}","comments_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1428/comments","events_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1428/events","html_url":"https://github.com/AutoMapper/AutoMapper/issues/1428","id":163413708,"number":1428,"title":"Bug: conventional mapping of nullable source to non-nullable destination","user":{"login":"dmccaffery","id":1803684,"avatar_url":"https://avatars.githubusercontent.com/u/1803684?v=3","gravatar_id":"","url":"https://api.github.com/users/dmccaffery","html_url":"https://github.com/dmccaffery","followers_url":"https://api.github.com/users/dmccaffery/followers","following_url":"https://api.github.com/users/dmccaffery/following{/other_user}","gists_url":"https://api.github.com/users/dmccaffery/gists{/gist_id}","starred_url":"https://api.github.com/users/dmccaffery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmccaffery/subscriptions","organizations_url":"https://api.github.com/users/dmccaffery/orgs","repos_url":"https://api.github.com/users/dmccaffery/repos","events_url":"https://api.github.com/users/dmccaffery/events{/privacy}","received_events_url":"https://api.github.com/users/dmccaffery/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-07-01T14:59:17Z","updated_at":"2016-08-17T08:29:28Z","closed_at":"2016-07-11T23:38:27Z","body":"The following code behaves differently between AutoMapper 4.2.1 and AutoMapper 5.0:\r\n\r\n```csharp\r\n// source class\r\n    public class Source\r\n    {\r\n        public Guid? Value { get; set; }\r\n    }\r\n\r\n    // destination\r\n    public class Destination\r\n    {\r\n        public Destination()\r\n        {\r\n            this.Value = Guid.NewGuid();\r\n        }\r\n\r\n        public Guid Value { get; set; }\r\n    }\r\n\r\n    // configuration (from a profile)\r\n    this.CreateMap<Source, Destination>(MemberList.Source);\r\n\r\n    // execute the mapping\r\n    var source = new Source();\r\n\r\n    // get the result\r\n    var result = mapper.Map<Destination>(source);\r\n```\r\n\r\nIn AutoMapper 4.2.1, the value of result is determined by the value created in the constructor. The source value of NULL is ignored during mapping, since it cannot be mapped successfully to the destination type (which is NOT nullable).\r\n\r\nIn AutoMapper 5.0, the value of result is the default value of a GUID. It would appear that GetValueOrDefault() is being mapped to the destination.\r\n\r\nIs this intended? If so, is their a conventional approach that resolves the issue, or must it be managed through conditionals or some explicit alternative?"},"comment":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/comments/240347259","html_url":"https://github.com/AutoMapper/AutoMapper/issues/1428#issuecomment-240347259","issue_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/1428","id":240347259,"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-08-17T08:29:28Z","updated_at":"2016-08-17T08:29:28Z","body":"@hoofa That works for me. A repro would help. Make a gist that we can execute and see fail."}}
{"actor":{"display_login":"lbargaoanu"}}