zoukankan      html  css  js  c++  java
  • 调用Newtonsoft.Json 报FileNotFoundException 错误

    具体如下:

    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运行环境出了问题。

  • 相关阅读:
    c#基础 里氏转换
    c#基础 base和this的区别,在继承上面
    c#基础值类和引用类型_字符串
    c# 基础字符串
    c#基础-构造函数 this new
    c#基础3-方法的重载静态和非静态,字段属性,方法
    c#基础2-out-ref
    .net的基础知识点
    Xamarin.Form的坑
    weboack 4 tutorial
  • 原文地址:https://www.cnblogs.com/runliuv/p/5081916.html
Copyright © 2011-2022 走看看