{"action":"created","issue":{"url":"https://api.github.com/repos/mbdavid/LiteDB/issues/82","labels_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/82/comments","events_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/82/events","html_url":"https://github.com/mbdavid/LiteDB/issues/82","id":117845389,"number":82,"title":"Generics with the same name as non-generics sometimes fail to deserialize.","user":{"login":"Dessix","id":434942,"avatar_url":"https://avatars.githubusercontent.com/u/434942?v=3","gravatar_id":"","url":"https://api.github.com/users/Dessix","html_url":"https://github.com/Dessix","followers_url":"https://api.github.com/users/Dessix/followers","following_url":"https://api.github.com/users/Dessix/following{/other_user}","gists_url":"https://api.github.com/users/Dessix/gists{/gist_id}","starred_url":"https://api.github.com/users/Dessix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dessix/subscriptions","organizations_url":"https://api.github.com/users/Dessix/orgs","repos_url":"https://api.github.com/users/Dessix/repos","events_url":"https://api.github.com/users/Dessix/events{/privacy}","received_events_url":"https://api.github.com/users/Dessix/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mbdavid/LiteDB/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-19T16:02:57Z","updated_at":"2015-11-23T12:26:10Z","closed_at":null,"body":"Sometimes, when dealing with classes named similarly to a generic class, the deserializer will choose to unpack to the non-generic variant. When I was using these definitions in my tests, I ran into this issue once in every ~15 or so executions:\r\n\r\n```\r\n\t\tprivate class TestPair {\r\n\t\t\tpublic static TestPair<TK, TV> Create<TK, TV>(TK key, TV value) => new TestPair<TK, TV>(key, value);\r\n\t\t}\r\n\r\n\t\tpublic class TestPair<TK, TV> {\r\n\t\t\tpublic TK Key { get; set; }\r\n\t\t\tpublic TV Value { get; set; }\r\n\t\t\tpublic TestPair() { }\r\n\t\t\tpublic TestPair(TK key, TV value) {\r\n\t\t\t\tthis.Key = key;\r\n\t\t\t\tthis.Value = value;\r\n\t\t\t}\r\n\t\t\tpublic static implicit operator KeyValuePair<TK, TV>(TestPair<TK, TV> pair) => new KeyValuePair<TK, TV>(pair.Key, pair.Value);\r\n\t\t\tpublic static implicit operator TestPair<TK, TV>(KeyValuePair<TK, TV> pair) => new TestPair<TK, TV>(pair.Key, pair.Value);\r\n\t\t}\r\n```\r\n\r\nSelect operations upon a collection of these items would sometimes fail with the issue that TestPair doesn't have a 0-parameter constructor, despite the fact that TestPair is not the class that was serialized, nor being worked with, but TestPair&lt;string, string&gt; was."},"comment":{"url":"https://api.github.com/repos/mbdavid/LiteDB/issues/comments/158918788","html_url":"https://github.com/mbdavid/LiteDB/issues/82#issuecomment-158918788","issue_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/82","id":158918788,"user":{"login":"mbdavid","id":1137197,"avatar_url":"https://avatars.githubusercontent.com/u/1137197?v=3","gravatar_id":"","url":"https://api.github.com/users/mbdavid","html_url":"https://github.com/mbdavid","followers_url":"https://api.github.com/users/mbdavid/followers","following_url":"https://api.github.com/users/mbdavid/following{/other_user}","gists_url":"https://api.github.com/users/mbdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/mbdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbdavid/subscriptions","organizations_url":"https://api.github.com/users/mbdavid/orgs","repos_url":"https://api.github.com/users/mbdavid/repos","events_url":"https://api.github.com/users/mbdavid/events{/privacy}","received_events_url":"https://api.github.com/users/mbdavid/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T12:26:10Z","updated_at":"2015-11-23T12:26:10Z","body":"BsonMapper has a static instance for cache type maps. In v2, I add a `lock` statment when getting type for first time, so I think this problem gone."}}