denghongcai / protobuf-net

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

Invalid type owner for DynamicMethod. #398

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please provide a better error message.

I create the metatypes on runtime by iterating all types (return and parameter 
types) of all my service contracts.

I don't get the clue why this error happen or which type/member produces this 
error.

Full error message.

System.ArgumentException: Invalid type owner for DynamicMethod.
   at System.Reflection.Emit.DynamicMethod.Init(String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] signature, Type owner, Module m, Boolean skipVisibility, Boolean transparentMethod, StackCrawlMark& stackMark)
   at System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility)
   at ProtoBuf.Compiler.CompilerContext..ctor(Type associatedType, Boolean isWriter, Boolean isStatic, TypeModel model, Type inputType) in c:\Dev\protobuf-net\protobuf-net\Compiler\CompilerContext.cs:line 300
   at ProtoBuf.Compiler.CompilerContext.BuildSerializer(IProtoSerializer head, TypeModel model) in c:\Dev\protobuf-net\protobuf-net\Compiler\CompilerContext.cs:line 56
   at ProtoBuf.Serializers.CompiledSerializer..ctor(IProtoTypeSerializer head, TypeModel model) in c:\Dev\protobuf-net\protobuf-net\Serializers\CompiledSerializer.cs:line 43
   at ProtoBuf.Serializers.CompiledSerializer.Wrap(IProtoTypeSerializer head, TypeModel model) in c:\Dev\protobuf-net\protobuf-net\Serializers\CompiledSerializer.cs:line 32
   at ProtoBuf.Meta.MetaType.CompileInPlace() in c:\Dev\protobuf-net\protobuf-net\Meta\MetaType.cs:line 1573
   at ProtoBuf.Meta.MetaType.get_Serializer() in c:\Dev\protobuf-net\protobuf-net\Meta\MetaType.cs:line 386
   at ProtoBuf.Meta.MetaType.CompileInPlace() in c:\Dev\protobuf-net\protobuf-net\Meta\MetaType.cs:line 1573
   at ProtoBuf.Meta.RuntimeTypeModel.CompileInPlace() in c:\Dev\protobuf-net\protobuf-net\Meta\RuntimeTypeModel.cs:line 814
   at CHG.iCLASSFW.Base.ServiceHelper.CreateProtobufTypeModelForKnownTypes(RuntimeTypeModel typeModel) in C:\Daten\SVN\CHG\iCLASSFW\trunk\CHG.iCLASSFW.Base\Connector\WebService\ServiceHelper.vb:line 270

Original issue reported on code.google.com by toni.wen...@googlemail.com on 11 Jul 2013 at 7:51

GoogleCodeExporter commented 9 years ago
I have added a clearer exception message if BuildSerializer fails, reporting 
the type-name of the failing type. This should be available in the next build. 
However, is there anything you can do to narrow it down simply by trying 
different types in your model?

Original comment by marc.gravell on 11 Jul 2013 at 8:14

GoogleCodeExporter commented 9 years ago
I have tried to narrow it down but could not get it right.
So I hope the next release will help me.
Thanks.

Original comment by toni.wen...@googlemail.com on 11 Jul 2013 at 10:51