{"action":"created","issue":{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/184","labels_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/184/comments","events_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/184/events","html_url":"https://github.com/michaeledgar/protobuf-net/issues/184","id":58233723,"number":184,"title":"Incorrect results produced with AutoCompile == true.","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-02-19T16:43:39Z","updated_at":"2015-02-19T16:43:42Z","closed_at":null,"body":"```\nObserve the attached program. \nBasically it runs the following code:\n\n[DataContract]\npublic class I\n{\n  [DataMember(Order = 1)]\n  public Dictionary<string, TBase> Data { get; set; }\n}\n\npublic static bool Test(bool autoCompile, bool isDefault)\n{\n  var m = isDefault ? RuntimeTypeModel.Default : TypeModel.Create();\n  m.AutoCompile = autoCompile;\n  m.Add(typeof(TBase), false).AddSubType(1, typeof(T));\n\n  var o = new I { Data = new Dictionary<string, TBase> { { \"C\", new T { 7 } } } };\n  using (var ms = new MemoryStream())\n  {\n    Serializer.Serialize(ms, o);\n    ms.Position = 0;\n    var o2 = Serializer.Deserialize<I>(ms);\n    return ((T)o.Data[\"C\"]).Count == ((T)o2.Data[\"C\"]).Count;\n  }\n}\n\nThe code is run for all the permutations of:\nTBase : { IList<int>, ICollection<int>, IEnumerable<int> }\nautoCompile : { true, false }\nisDefault : { true, false }\n\nWhat is the expected output? What do you see instead?\n\nThe expected output is that all the 12 lines of output print True.\nHowever, the actual output is not always True! The problems occur when TBase is \n IEnumerable<int>:\n * autoCompile = true AND isDefault = true yield False\n * isDefault = false yield InvalidOperationException\n\nSee the attached file output.txt for the complete output.\n\nWhat version of the product are you using? On what operating system?\n\nv2, the most recent trunk revision (407)\n\nPlease provide any additional information below.\n\nThe most strange result is for the default model. Seems like the compiled \ndefault model produces different results than the same non compiled model.\n\n```\n\n-----\nOriginal issue reported on code.google.com by `mark.kha...@gmail.com` on 12 Jun 2011 at 9:09\n\nAttachments:\n* [program.cs](https://storage.googleapis.com/google-code-attachments/protobuf-net/issue-184/comment-0/program.cs)\n* [output.txt](https://storage.googleapis.com/google-code-attachments/protobuf-net/issue-184/comment-0/output.txt)\n"},"comment":{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/comments/75087178","html_url":"https://github.com/michaeledgar/protobuf-net/issues/184#issuecomment-75087178","issue_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/184","id":75087178,"user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T16:43:42Z","updated_at":"2015-02-19T16:43:42Z","body":"```\nI have changed a couple of things (just emailed you the svn diff output). It is \npossible that one of my changes produces the following side effect - the code \nfrom http://code.google.com/p/protobuf-net/issues/detail?id=184#c16 succeeds \nwhen AutoCompile == false and fails when AutoCompile == true.\n\nAgain, the scenario implemented in the code sample is currently legal (it \npasses your recent changes). So, the question should it be legal?\n```\n\n-----\nOriginal comment by `mark.kha...@gmail.com` on 20 Jun 2011 at 8:28"}}