【问题标题】:JIT compile error with protobuf-net on MonoTouch/iOS device (iPhone/iPad)MonoTouch/iOS 设备 (iPhone/iPad) 上的 protobuf-net 的 JIT 编译错误
【发布时间】:2011-10-29 18:31:40
【问题描述】:

我正在使用 protobuf-net v2 beta r450(二进制分发)并使用此处描述的技术提前构建序列化程序集:

http://www.frictionpointstudios.com/blog/2011/3/31/using-protobuf-net-serialization-in-unity-iphone.html

我在 Windows 上创建我的序列化程序集并在我的 MonoTouch 项目中使用它。它在模拟器下工作。但是当在仅强制执行 AOT 编译的设备上运行时,我收到此错误:

attempting to JIT compile method 'ProtoBuf.BufferPool.GetBuffer()' 
while running with --aot-only 

调用Serialize()时出现异常:

using (var stream = File.Create(out_file))
{
    serializer.Serialize(stream, settings);
}

感谢您的帮助。

【问题讨论】:

  • 嗯...很奇怪!我还没有看到 - 看起来 AOT 没有发现需要该方法。我将不得不调查让 AOT 相信这是被使用的方法。
  • 谢谢马克。如果您没有弹出任何内容,我可以使用 Xamarin 创建票证。
  • 有时像这样我希望我仍然可以方便地访问 mac
  • @t9mike 请打开错误报告并包含一个小的、独立的测试用例,以便我们可以复制问题。有时我们可以避免这个异常(通过修改类库)而无需更改用户代码。谢谢!
  • @poupou 我提交了错误,bugzilla.xamarin.com/show_bug.cgi?id=1788。票证中引用了示例,但对于其他人,直接链接是github.com/t9mike/ProtoBuf1

标签: c# ios xamarin.ios protobuf-net aot


【解决方案1】:

我获取了 protobuf-net 源代码 (v2 r470)。 [ImmutableObject] 的使用确实是问题之一。我通过 protobuf-net 问题列表向@MarcGravell 提交了一些小补丁。我已经用这个新程序集更新了我在http://github.com/t9mike/ProtoBuf1 的示例。感谢大家的回复。

【讨论】:

  • 现在一切正常吗?包括“不再有 JIT 错误”?后面的可能与 MonoTouch 5.0.1 中的一个错误(回归)有关,该错误已在 5.0.2 中修复。
  • 是的@poupou,我的示例现在在设备上运行良好。我在 MT 5.0.2。再次感谢!
【解决方案2】:

在使用 unity(使用 protobuf-net 和 iOS)时,我遇到了几乎类似的问题,这对我有帮助:

Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes");

信用:https://github.com/antonholmquist/easy-serializer-unity

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-01
    • 2012-03-24
    • 1970-01-01
    • 2012-08-15
    • 2012-03-25
    • 2014-11-27
    相关资源
    最近更新 更多