rongfengliang / protobuf-net

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

Cannot serialize System.Type #321

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

using (var file = File.Create("person.bin"))
{
   ProtoBuf.Serializer.Serialize<Type>(file, typeof(int));
} 

This throws an InvalidOperationException "Type is not expected, and no contract 
can be inferred: System.RuntimeType"

What version of the product are you using? On what operating system?
r580\full\net30
Windows 7

Please provide any additional information below.
Curiously, it can serialize Type if it is a member of a class (it can serialize 
the object including the Type type member).

Original issue reported on code.google.com by brianwil...@gmail.com on 20 Sep 2012 at 2:24