Android 在 Unity 2018.1 中使用 ICE .netcore 2.0 时出现空异常

Null Exception when using ICE .netcore 2.0 inside Unity 2018.1 on Android

当我在 运行 Android 上的 Unity2018.1 项目中使用来自 NuGet (https://www.nuget.org/packages/zeroc.ice.net) 的 ice .netcore 2.0 dll 时出现以下错误。 在Unity2018或Unity2017中使用.Net 4.5 .dll变体时也会出现同样的错误。

在桌面编辑器中运行正常,但在 Android:

上运行失败

NullReferenceException: Object reference not set to an instance of an object at IceInternal.ByteBuffer.putFloat (System.Single val) [0x00032] in <0ec35a220aea490187b153a1b6df7823>:0 at Ice.OutputStream.writeFloat (System.Single v) [0x00007] in <0ec35a220aea490187b153a1b6df7823>:0 at PiTracker.PiTrackerServerPrxHelper+<_iceI_getProjection>c__AnonStorey1.<>m__0 (Ice.OutputStream ostr) [0x00008] in /Users/xx/xx/:2049 at IceInternal.OutgoingAsync.invoke (System.String operation, Ice.OperationMode mode, Ice.FormatType format, System.Collections.Generic.Dictionary`2[TKey,TValue] context, System.Boolean synchronous, System.Action`1[T] write) [0x00020] in <0ec35a220aea490187b153a1b6df7823>:0 at IceInternal.OutgoingAsyncT`1[T].invoke (System.String operation, Ice.OperationMode mode, Ice.FormatType format, System.Collections.Generic.Dictionary`2[TKey,TValue] context, System.Boolean synchronous, System.Action`1[T] writ

我发现了一个关于此主题的旧论坛条目 https://forums.zeroc.com/discussion/5730/ice-on-mono-on-android 但它似乎不再有效,因为 ICE 构建脚本不再允许托管构建。我也在 ICE 论坛上问过,但只有在使用 .netcore 2.0 的 Unity2018 上的答案应该可以,但没有。

非常感谢任何帮助。

ZeroC 团队回答了这个问题。这实际上是他们的 CSharp 代码库中的一个错误。 https://forums.zeroc.com/discussion/46631/build-ice-3-7-1-with-option-managed-yes-on-macos-or-windows#latest

截至目前,如果您遇到此问题,则需要从 3.7 分支构建 ICE (https://github.com/zeroc-ice/ice/tree/3.7) for .NET yourself following their build instructions: https://github.com/zeroc-ice/ice/tree/3.7/csharp