evgenekov / protobuf-csharp-port

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

How can I use csharp-port 2.4 with mono in IOS? It always got a Jit error message. #98

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Just compile a ipa that using proto by mono
2. Put it to iphone
3.

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

It seem aof problem, but I don't know how to fix it.

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

2.4.1.521

Please provide any additional information below.

Could you give me a solution for that? 

Thank you very much.

Original issue reported on code.google.com by mail2f...@gmail.com on 10 Feb 2015 at 7:27

GoogleCodeExporter commented 9 years ago
ExecutionEngineException: Attempting to JIT compile method 
'System.Collections.Generic.GenericEqualityComparer`1<Google.ProtocolBuffers.Ext
ensionRegistry/ExtensionIntPair>:.ctor ()' while running with --aot-only.

  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
Rethrow as TargetInvocationException: Exception has been thrown by the target 
of an invocation.
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.EqualityComparer`1[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair]..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type 
initializer for System.Collections.Generic.EqualityComparer`1
  at System.Collections.Generic.Dictionary`2[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair,Google.ProtocolBuffers.IGeneratedExtensionLite].Init (Int32 capacity, IEqualityComparer`1 hcp) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.Dictionary`2[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair,Google.ProtocolBuffers.IGeneratedExtensionLite]..ctor () [0x00000] in <filename unknown>:0 
  at Google.ProtocolBuffers.ExtensionRegistry..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type 
initializer for Google.ProtocolBuffers.ExtensionRegistry
  at Google.ProtocolBuffers.AbstractBuilderLite`2[TMessage,TBuilder].MergeFrom (System.Byte[] data) [0x00000] in <filename unknown>:0 
  at Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.ParseFrom (System.Byte[] data) [0x00000] in <filename unknown>:0 
  at Google.ProtocolBuffers.Descriptors.FileDescriptor.InternalBuildGeneratedFileFrom (System.Byte[] descriptorData, Google.ProtocolBuffers.Descriptors.FileDescriptor[] dependencies, Google.ProtocolBuffers.Descriptors.InternalDescriptorAssigner descriptorAssigner) [0x00000] in <filename unknown>:0 
  at Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type 
initializer for Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile
  at Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type 
initializer for Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto
  at Google.ProtocolBuffers.Descriptors.FileDescriptor.InternalBuildGeneratedFileFrom (System.Byte[] descriptorData, Google.ProtocolBuffers.Descriptors.FileDescriptor[] dependencies, Google.ProtocolBuffers.Descriptors.InternalDescriptorAssigner descriptorAssigner) [0x00000] in <filename unknown>:0 
  at proto_structs.Proto.RqData..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type 
initializer for proto_structs.Proto.RqData
  at proto_structs.RqData..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type 
initializer for proto_structs.RqData
  at TestProto.Start () [0x00000] in <filename unknown>:0 

Original comment by mail2f...@gmail.com on 10 Feb 2015 at 7:51

GoogleCodeExporter commented 9 years ago
Thanks for the detail. I don't think we do anything particularly exotic - I'd 
expect this to work, to be honest. It looks like it's fairly deep within BCL 
code at that point. Hmm.

It looks like this was also brought up on Stack Overflow:
http://stackoverflow.com/questions/24368929

I don't know much about the details of the AOT here, but it's *possible* that 
adding a more explicit reference to 
`EqualityComparer<ExtensionIntPair>.Default` would help.

When I get the chance, I'll try to reproduce the problem with my personal copy 
of Xamarin - I assume that's what you're using?

Original comment by jonathan.skeet on 10 Feb 2015 at 5:33

GoogleCodeExporter commented 9 years ago
Thank you. 

Actually,  I am working in Unity that developed by the mono. I belive it's same 
thing.

I just got an old version protogen. That works fine. I don't know what's 
difference between the old and the newest.  If I can figure it out, I will fix 
it.

Original comment by mail2f...@gmail.com on 11 Feb 2015 at 4:58

GoogleCodeExporter commented 9 years ago
Ah, no, Unity and Xamarin are pretty different, I believe - not least in terms 
of which version of Mono they use under the hood.

Thanks for investigating - it may well be simplest to try a really small 
protobuf example (just a single message with a single extension, if extensions 
are the issue) so that it's easy to diff the generated code.

Original comment by jonathan.skeet on 11 Feb 2015 at 7:32