{"action":"created","issue":{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/408","labels_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/408/labels{/name}","comments_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/408/comments","events_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/408/events","html_url":"https://github.com/michaeledgar/protobuf-net/issues/408","id":58234391,"number":408,"title":"TypeModel. CanSerialize(Type type, bool allowBasic, bool allowContract, bool allowLists) wrong result for complex dictionary type ","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":1,"created_at":"2015-02-19T16:46:48Z","updated_at":"2015-02-19T16:46:48Z","closed_at":null,"body":"```\nPlease include an e-mail address if this might need a dialogue!\n==============\n\nWhat steps will reproduce the problem?\n1. I have class with [Serializable] attribute named CarBase\n\n    [Serializable]\n    public class CarBase\n    {\n        public int Id { get; set; }\n\n        public string Name { get; set; }\n\n    }\n\n\n2. I have method return a dictionary type with Dictionary<string,List<CarBase>>\n\n3. Normally the generic type Dictionary<string,List<CarBase>> call with \nTypeModel. CanSerialize it should return false.\n\n4.ProtoBuf.Caching.Enyim.NetTranscoder line 119 use this method to judge \nwhether use default transcoder or protobuff, but is return true, then go to \nLine 125  model.Serialize(ms, o) to serialize the object ,it return a error \nwith the detailed stack trace :\n\n2013-09-24 13:51:49,832 [7] ERROR Enyim.Caching.MemcachedClient [(null)] - \nSystem.InvalidOperationException: No serializer defined for type: \nBitAuto.Reviews.Models.CarBase\n   在 ProtoBuf.Serializers.TupleSerializer..ctor(RuntimeTypeModel model, ConstructorInfo ctor, MemberInfo[] members) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Serializers\\TupleSerializer.cs:行号 50\n   在 ProtoBuf.Meta.MetaType.BuildSerializer() 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\MetaType.cs:行号 439\n   在 ProtoBuf.Meta.MetaType.get_Serializer() 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\MetaType.cs:行号 384\n   在 ProtoBuf.Meta.RuntimeTypeModel.Serialize(Int32 key, Object value, ProtoWriter dest) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\RuntimeTypeModel.cs:行号 752\n   在 ProtoBuf.Meta.TypeModel.TrySerializeAuxiliaryType(ProtoWriter writer, Type type, DataFormat format, Int32 tag, Object value, Boolean isInsideList) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:行号 124\n   在 ProtoBuf.Meta.TypeModel.TrySerializeAuxiliaryType(ProtoWriter writer, Type type, DataFormat format, Int32 tag, Object value, Boolean isInsideList) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:行号 170\n   在 ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:行号 188\n   在 ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:行号 217\n   在 ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\plugins\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:行号 201\n   在 ProtoBuf.Caching.Enyim.NetTranscoder.Enyim.Caching.Memcached.ITranscoder.Serialize(Object o) 位置 E:\\tfs-source\\bitauto\\A3车型产品研发\\点评\\Src\\BitAutoReviews.V4\\protobuf-net.Enyim\\ProtoTranscoder.cs:行号 125\n\n\nWhat is the expected output? What do you see instead?\nI think there is something wrong with generice type of complex dictionary type \n, it should use the inner Transcoder .\n\n\nWhat version of the product are you using? On what operating system?\n\n\nPlease provide any additional information below.\n\n```\n\n-----\nOriginal issue reported on code.google.com by `liurongw...@gmail.com` on 24 Sep 2013 at 6:21"},"comment":{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/comments/75088353","html_url":"https://github.com/michaeledgar/protobuf-net/issues/408#issuecomment-75088353","issue_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/408","id":75088353,"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:46:48Z","updated_at":"2015-02-19T16:46:48Z","body":"```\n        NetTranscoder.cs I fixed it use this method ,now it can work correctly.\n\n        private bool CanSerializeContractType(Type type)\n        {\n            if (type.IsGenericType)\n            {\n                var paraTypes = type.GetGenericArguments();\n\n                if (paraTypes.Count() > 0)\n                {\n                    var canTypesSerialized = paraTypes.Select(x => CanSerializeContractType(x));\n\n                    return canTypesSerialized.All(x => x);\n                }\n                else\n                {\n                    return model.CanSerializeContractType(type);\n                }\n            }\n\n            return model.CanSerialize(type);\n        }\n```\n\n-----\nOriginal comment by `liurongw...@gmail.com` on 27 Sep 2013 at 3:53"}}