当我尝试将JSON字符串反序列化为类时,我得到了一个异常,我使用Newtonsoft.Json
我这样做:
MyClass response = JsonConvert.DeserializeObject<MyClass>(JsonString);与C# .net Core项目中相同数据的代码相同,Newtonsoft.Json工作良好,但在Blazor项目中有例外
'System.Collections.Specialized.INotifyCollectionChanged‘WASM:未处理的异常: blazor.webassembly.js:1 WASM: System.TypeLoadException:未能加载字段'Newtonsoft.Json.Linq.JToken:_parent’(1)的类型,原因是:无法从typeref (程序集中的预期类System.TypeLoadException、Version=2.0.5.0、Culture=neutral、PublicKeyToken=7cec85d7bea7798e )解析类型,原因是:无法从typeref(预期类Newtonsoft.Json.Linq.JToken:_parent,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e')解析类型:mscorlib,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e Version=2.0.5.0成员:(Null)
发布于 2018-12-08 18:57:28
看上去是这个bug https://github.com/aspnet/Blazor/issues/1692
<PropertyGroup>
<BlazorLinkOnBuild>false</BlazorLinkOnBuild>
</PropertyGroup>https://stackoverflow.com/questions/53685746
复制相似问题