{"action":"created","issue":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/397","labels_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/397/labels{/name}","comments_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/397/comments","events_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/397/events","html_url":"https://github.com/AutoFixture/AutoFixture/pull/397","id":69717228,"number":397,"title":"Handles OmitSpecimen in AutoConfiguredNSubstituteCustomization","user":{"login":"mrinaldi","id":1226112,"avatar_url":"https://avatars.githubusercontent.com/u/1226112?v=3","gravatar_id":"","url":"https://api.github.com/users/mrinaldi","html_url":"https://github.com/mrinaldi","followers_url":"https://api.github.com/users/mrinaldi/followers","following_url":"https://api.github.com/users/mrinaldi/following{/other_user}","gists_url":"https://api.github.com/users/mrinaldi/gists{/gist_id}","starred_url":"https://api.github.com/users/mrinaldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrinaldi/subscriptions","organizations_url":"https://api.github.com/users/mrinaldi/orgs","repos_url":"https://api.github.com/users/mrinaldi/repos","events_url":"https://api.github.com/users/mrinaldi/events{/privacy}","received_events_url":"https://api.github.com/users/mrinaldi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-21T01:25:37Z","updated_at":"2015-04-26T08:59:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/397","html_url":"https://github.com/AutoFixture/AutoFixture/pull/397","diff_url":"https://github.com/AutoFixture/AutoFixture/pull/397.diff","patch_url":"https://github.com/AutoFixture/AutoFixture/pull/397.patch"},"body":"This PR fixes #395"},"comment":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/comments/96346896","html_url":"https://github.com/AutoFixture/AutoFixture/pull/397#issuecomment-96346896","issue_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/397","id":96346896,"user":{"login":"ploeh","id":242165,"avatar_url":"https://avatars.githubusercontent.com/u/242165?v=3","gravatar_id":"","url":"https://api.github.com/users/ploeh","html_url":"https://github.com/ploeh","followers_url":"https://api.github.com/users/ploeh/followers","following_url":"https://api.github.com/users/ploeh/following{/other_user}","gists_url":"https://api.github.com/users/ploeh/gists{/gist_id}","starred_url":"https://api.github.com/users/ploeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ploeh/subscriptions","organizations_url":"https://api.github.com/users/ploeh/orgs","repos_url":"https://api.github.com/users/ploeh/repos","events_url":"https://api.github.com/users/ploeh/events{/privacy}","received_events_url":"https://api.github.com/users/ploeh/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T08:59:45Z","updated_at":"2015-04-26T08:59:45Z","body":"> Don't set it up, at all. Instead, let the mocking framework decide what to do. The framework might then decide to either return null, 0, a mock (e.g., in Moq if DefaultValue is set to DefaultValue.Mock), or maybe even throw an exception.\r\n\r\nI like that specification :+1: \r\n\r\nConverting `OmitSpecimen` to `default(T)` is wrong. The entire reason `OmitSpecimen` exists is exactly to enable downstream clients to make an informed decision about what it means. Converting to `default(T)` removes this information.\r\n\r\nOriginally, AutoFixture handled recursion issues by either throwing exceptions on detected recursions (to this day, this is the default, built-in behaviour), or alternatively, as an opt-in customization, by *assigning* `null`.\r\n\r\nThe problem with *assigning* `null` is that a writeable property may have a Guard Clause that protects against `null` values.\r\n\r\nTherefore, the *motivation* for introducing `OmitSpecimen` was to signal that the request in question should be aborted.\r\n\r\nThis is clearly explained in the commit message for 4ffec5ea53f409406819aa97870891c8aa501fc0, which explains:\r\n\r\n> Added the OmitSpecimen class, which is a pure marker object that can be used to indicate that a particular request should be omitted. The primary purpose is to notify the AutoPropertiesCommand that a property or field should be omitted."}}