我们的应用程序在Windows上使用JSON.net就好了。在Linux上(我们在Ubuntu中进行测试)我们得到一个例外:
An exception was thrown by the type initializer for Newtonsoft.Json.Utilities.ConvertUtils
20150310_11:51:37.404 ERROR : at Newtonsoft.Json.Serialization.DefaultContractResolver.IsJsonPrimitiveType(System.Type t)
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(System.Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(System.Type type)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe(System.Type type)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(Newtonsoft.Json.JsonReader reader, System.Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(Newtonsoft.Json.JsonReader reader, System.Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject(System.String value, Newtonsoft.Json.JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject(System.String value)
InnerException是
Could not load file or assembly 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
在网上的其他地方,他们说可能是我们需要安装" libmono-system-numerics4.0-cil"但apt-get显示已经安装并且已经更新。
我们正在使用.NET 4.0(因为我们希望与Windows XP保持兼容,市场份额仍然很大)。
关于如何让它运行的任何想法?
答案 0 :(得分:1)
无论出于何种原因,它只是不想与Linux和Linux上安装的版本配合使用。永远不能加载它。
这是我做的最终导致它运行的: