{"action":"created","issue":{"url":"https://api.github.com/repos/SimonCropp/ObjectApproval/issues/76","repository_url":"https://api.github.com/repos/SimonCropp/ObjectApproval","labels_url":"https://api.github.com/repos/SimonCropp/ObjectApproval/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/SimonCropp/ObjectApproval/issues/76/comments","events_url":"https://api.github.com/repos/SimonCropp/ObjectApproval/issues/76/events","html_url":"https://github.com/SimonCropp/ObjectApproval/pull/76","id":473022499,"node_id":"MDExOlB1bGxSZXF1ZXN0MzAxMjcxMzQ0","number":76,"title":"Allow SerializerBuilder.Reset() to be Used in Multi-Threaded Test Frameworks","user":{"login":"paulsavides","id":12375924,"node_id":"MDQ6VXNlcjEyMzc1OTI0","avatar_url":"https://avatars0.githubusercontent.com/u/12375924?v=4","gravatar_id":"","url":"https://api.github.com/users/paulsavides","html_url":"https://github.com/paulsavides","followers_url":"https://api.github.com/users/paulsavides/followers","following_url":"https://api.github.com/users/paulsavides/following{/other_user}","gists_url":"https://api.github.com/users/paulsavides/gists{/gist_id}","starred_url":"https://api.github.com/users/paulsavides/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulsavides/subscriptions","organizations_url":"https://api.github.com/users/paulsavides/orgs","repos_url":"https://api.github.com/users/paulsavides/repos","events_url":"https://api.github.com/users/paulsavides/events{/privacy}","received_events_url":"https://api.github.com/users/paulsavides/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-07-25T19:02:07Z","updated_at":"2019-07-30T18:03:25Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/SimonCropp/ObjectApproval/pulls/76","html_url":"https://github.com/SimonCropp/ObjectApproval/pull/76","diff_url":"https://github.com/SimonCropp/ObjectApproval/pull/76.diff","patch_url":"https://github.com/SimonCropp/ObjectApproval/pull/76.patch"},"body":"Hello Simon,\r\n\r\nI was attempting to upgrade an integration test project to use parallel execution and realized that my usage of the Reset() functionality that I added prevented that from happening.\r\n\r\nLooking through the commits around the time it was introduced, I realize you also ran into this issue >> https://github.com/SimonCropp/ObjectApproval/commit/b8acb0bd14603d6ca511570b467b8dad27242bc5\r\n\r\nPerhaps the most appropriate way of fixing it would be to remove the \"Reset()\" functionality and convert to solely using data scrubbers and/or scoped serializers.\r\n\r\nRegardless, these changes fix the problem while preserving the existing functionality & interface of the SerializerBuilder.\r\n\r\nIf you'd rather not have these changes I am okay with that, there are other paths to fix the problems I am running into. \r\n\r\n## The Fix\r\nThe core of the fix is moving all storage of settings into some implementation of the `ISerializerSettingsStore` interface. There are two implementations of this interface, `SingleThreadedSerializerSettingsStore` and `MultiThreadedSerializerSettingsStore`.\r\n\r\nAll the multithreaded serializer settings store does is store the actual settings in a `private ThreadLocal<SingleThreadedSerializerSettingsStore> _innerStore` and all implementations of the `ISerializerSettingsStore` interface just refer to `_innerStore.Value`.\r\n\r\nIn the static constructor for SerializerBuilder, we just read an assembly level `ObjectApprovalBehavior` attribute to know whether or not we need to use the single or multi threaded implementation.\r\n\r\nAs far as I could tell, the test projects (XUnit & MSTestV2) were using proper threads when running tests in parallel so I believe this fix will work.\r\n\r\n## Unit Test Updates\r\n\r\nFor the XUnit tests I just reenabled test parallelization. I also created an MSTest project to verify. I'm not certain it is sufficient, but I couldn't get the tests to pass when I set the serializer threading mode to single threaded so I believe they are testing the right thing.\r\n"},"comment":{"url":"https://api.github.com/repos/SimonCropp/ObjectApproval/issues/comments/516528777","html_url":"https://github.com/SimonCropp/ObjectApproval/pull/76#issuecomment-516528777","issue_url":"https://api.github.com/repos/SimonCropp/ObjectApproval/issues/76","id":516528777,"node_id":"MDEyOklzc3VlQ29tbWVudDUxNjUyODc3Nw==","user":{"login":"paulsavides","id":12375924,"node_id":"MDQ6VXNlcjEyMzc1OTI0","avatar_url":"https://avatars0.githubusercontent.com/u/12375924?v=4","gravatar_id":"","url":"https://api.github.com/users/paulsavides","html_url":"https://github.com/paulsavides","followers_url":"https://api.github.com/users/paulsavides/followers","following_url":"https://api.github.com/users/paulsavides/following{/other_user}","gists_url":"https://api.github.com/users/paulsavides/gists{/gist_id}","starred_url":"https://api.github.com/users/paulsavides/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulsavides/subscriptions","organizations_url":"https://api.github.com/users/paulsavides/orgs","repos_url":"https://api.github.com/users/paulsavides/repos","events_url":"https://api.github.com/users/paulsavides/events{/privacy}","received_events_url":"https://api.github.com/users/paulsavides/received_events","type":"User","site_admin":false},"created_at":"2019-07-30T18:03:25Z","updated_at":"2019-07-30T18:03:25Z","author_association":"CONTRIBUTOR","body":"@SimonCropp I will rebuild the parallel tests in xunit."}}
{"actor":{"display_login":"paulsavides"}}