调用Newtonsoft.Json 报FileNotFoundException 错误

时间:2024-11-08 08:05:43

具体如下:

Exception StackTrace at Newtonsoft.Json.Converters.BinaryConverter.CanConvert(Type objectType)
at Newtonsoft.Json.JsonSerializer.GetMatchingConverter(IList`1 converters, Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract(JsonContract contract)
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value)

而外部CATCH的是:FileNotFoundException

程序是.NET 2.0的,通过配置,运行在.NET 4.0下

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
</startup>

当时系统盘只有700M左右空间,调试时一但用Json.Converter 就会报上面的错。

然后装了.NET FRAMEWORK 2.0 后就正常了。

可能是磁盘空间不足导致.NET 4.0运行环境出了问题。