AntonioEspinosa / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

generice type serialize error #407

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1 I have a class with qualified name 
"System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, 
Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089],[BitAuto.Reviews.Models.SerialForum, 
BitAuto.Reviews.Models, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089",when use ProtoBuf.Caching.Enyim.NetTranscoder 
to serialize the Dictionary<int,SerialForum> generice object ,the type name 
extract error in the code begin line :155 like below:

string typeName = type.AssemblyQualifiedName;
            int i = typeName.IndexOf(','); // first split
            if (i >= 0) { i = typeName.IndexOf(',', i + 1); } // second split
            if (i >= 0) { typeName = typeName.Substring(0, i); } // extract type/assembly only
            byte[] buffer = enc.GetBytes(typeName);
            var key = new ArraySegment<byte>(buffer, 0, buffer.Length);

when get the cache name from typeCache object , I didn't container the full 
name ,so serialize operation failed .

What is the expected output? What do you see instead?

I think it would store the full qualified name of the object in typeCache 
object.

What version of the product are you using? On what operating system?

Original issue reported on code.google.com by liurongw...@gmail.com on 23 Sep 2013 at 3:06

Attachments:

GoogleCodeExporter commented 9 years ago
Odd - I thought we'd looked at that once. Let me check I haven't lost a patch 
somewhere...

Original comment by marc.gravell on 23 Sep 2013 at 7:35