{"action":"created","issue":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/407","labels_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/407/labels{/name}","comments_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/407/comments","events_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/407/events","html_url":"https://github.com/AutoFixture/AutoFixture/issues/407","id":84183535,"number":407,"title":"Creating dictionaries with relatively small key type fails ocasionally","user":{"login":"dzendras","id":7687934,"avatar_url":"https://avatars.githubusercontent.com/u/7687934?v=3","gravatar_id":"","url":"https://api.github.com/users/dzendras","html_url":"https://github.com/dzendras","followers_url":"https://api.github.com/users/dzendras/followers","following_url":"https://api.github.com/users/dzendras/following{/other_user}","gists_url":"https://api.github.com/users/dzendras/gists{/gist_id}","starred_url":"https://api.github.com/users/dzendras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzendras/subscriptions","organizations_url":"https://api.github.com/users/dzendras/orgs","repos_url":"https://api.github.com/users/dzendras/repos","events_url":"https://api.github.com/users/dzendras/events{/privacy}","received_events_url":"https://api.github.com/users/dzendras/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/labels/jump%20in","name":"jump in","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-06-02T19:54:49Z","updated_at":"2015-09-10T20:19:34Z","closed_at":null,"body":"There is a problem with generating dictionaries that have a relatively small key type (like System.Byte).\r\nSometimes unit tests fail because of duplicate keys:\r\n\r\n*System.ArgumentException : An item with the same key has already been added.*\r\n\r\nSo even though AutoFixture creates dictionaries that have only 3 elements (well at least that's what I can observe), it doesn't check whether the generated keys are unique.\r\n\r\nIn order to reproduce it, please run the following test:\r\n\r\n        [Fact]\r\n        public void Duplicate_entries()\r\n        {\r\n            var fixture = new Fixture();\r\n            for (int i = 0; i < 1000; ++i)\r\n            {\r\n                fixture.Create<IDictionary<byte, string>>();\r\n            }\r\n        }\r\n\r\nThe question is: is it a bug that can be fixed, or is it a corner case where AutoFixture is not supposed to be used?"},"comment":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/comments/139368163","html_url":"https://github.com/AutoFixture/AutoFixture/issues/407#issuecomment-139368163","issue_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/407","id":139368163,"user":{"login":"moodmosaic","id":287532,"avatar_url":"https://avatars.githubusercontent.com/u/287532?v=3","gravatar_id":"","url":"https://api.github.com/users/moodmosaic","html_url":"https://github.com/moodmosaic","followers_url":"https://api.github.com/users/moodmosaic/followers","following_url":"https://api.github.com/users/moodmosaic/following{/other_user}","gists_url":"https://api.github.com/users/moodmosaic/gists{/gist_id}","starred_url":"https://api.github.com/users/moodmosaic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moodmosaic/subscriptions","organizations_url":"https://api.github.com/users/moodmosaic/orgs","repos_url":"https://api.github.com/users/moodmosaic/repos","events_url":"https://api.github.com/users/moodmosaic/events{/privacy}","received_events_url":"https://api.github.com/users/moodmosaic/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T20:19:34Z","updated_at":"2015-09-10T20:19:34Z","body":">The only _issue_ is that we don't get [that behavior](https://github.com/AutoFixture/AutoFixture/issues/407#issuecomment-113052668) with the current implementation.\r\n\r\nThat's true..."}}