这可能与Json.NET 100%无关,但因为它是崩溃的组件......
序列化工作正常,直到Windows App Cert Kit的第二次测试。从此应用启动开始,它会引发以下异常:
System.EntryPointNotFoundException Entry point was not found.
at Newtonsoft.Json.Utilities.ReflectionUtils.GetFieldsAndProperties(Type type, BindingFlags bindingAttr) in \Newtonsoft.Json\Utilities\ReflectionUtils.cs:line 661
at Newtonsoft.Json.Serialization.DefaultContractResolver.GetSerializableMembers(Type objectType) in \Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 267
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type type, MemberSerialization memberSerialization) in \Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 845
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType) in \Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 349
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType) in \Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 734
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type) in \Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 232
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe(Object value) in \Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 77
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value) in \Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 58
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value) in \Newtonsoft.Json\JsonSerializer.cs:line 608
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) in \Newtonsoft.Json\JsonConvert.cs:line 749
代码看起来像这样......
var test = JsonConvert.SerializeObject(new { id = "a", test = "test" });
在应用程序上运行WACK后,我必须重新安装它以使其再次运行。
有谁知道WACK如何运行应用程序?我想它在每次发布时会以某种方式模拟各种环境,但我无法弄清楚它是如何混淆我的应用程序的。
答案 0 :(得分:0)
问题是由Json.NET在GetFieldsAndProperties中使用匿名类型引起的。在第三方dll中使用时,WinRT必须有错误。
答案 1 :(得分:0)
对不起,我的错。我确认它已在Release 7中修复
我在Connect上打开了一个错误,因为这是在Windows 8 Metro上使用格栅JSNO.Net的阻塞问题。
https://connect.microsoft.com/VisualStudio/feedback/details/749011/ngen-failing-with-json-net-metro