序列化时,JSON的.Net的Windows Mobile错误 [英] JSON .Net Windows Mobile Error when serializing

查看:428
本文介绍了序列化时,JSON的.Net的Windows Mobile错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行的code此位:

I am running this bit of code:

 string serialized = JsonConvert.SerializeObject(somethingToSend);

和它引发此异常:

的MissingMethodException:未能从程序集加载类型System.Runtime.Serialization.StreamingContext'mscorlib程序,版本= 3.5.0.0,文化=中性公钥= 969DB8053D3322AC

MissingMethodException: Could not load type 'System.Runtime.Serialization.StreamingContext' from assembly 'mscorlib, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.

下面是我的配置:

  • 在Visual Studio 2008中(包括所有最新的服务包等)
  • 在针对Windows Mobile 6的NET 3.5的智能设备项目
  • 的Json DOTNET的 4.5版发布7(引用来自WindowsPhone的文件夹中的zip的DLL)
  • Visual Studio 2008 (with all the latest service packs etc)
  • Smart Device project targeting Windows Mobile 6 .Net 3.5
  • Json DotNet version 4.5 Release 7 (referencing the DLL from the WindowsPhone folder in the zip)

回答这个问题有一个图书馆阅读JSON在C#在Windows Mobile?意味着它应该工作。

The answer to this question "Is there a library to read JSON in C# on Windows Mobile?" implies that it should work.

我并附上真实的设备(所以没有仿真器)在那里我有previously从这里安装CAB文件无差错运行在调试:

I am running it in debug with the real device attached (so no emulator) where I have previously installed the CAB file from here without error:

C:\ Program Files文件(x86)的\ Microsoft.NET \ SDK \ CompactFramework \ V3.5 \ Windows CE的\ NETCFv35.wce.armv4.cab

C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\NETCFv35.wce.armv4.cab

应用程序,直到我点击运行线之上的按钮运行正常,因此,没有人知道我缺少的是什么?

The application runs fine until I click the button that is running the line above, so does anyone know what I am missing?

本线 Json.Compact.dll为Windows CE 5.0?建议我需要在Windows SDK安装的,我有。由于它是在设备上运行我想这不会是修复反正。

This thread "Json.Compact.dll for Windows CE 5.0?" suggests that I would need the Windows SDK installed, which I have. Given it is running on the device itself I guess that is not going to be the fix anyway.

另一个建议是建立从源代码,但像这个问题笔者我无法加载项目文件到VS 2008来做到这一点。我可以创建一个新的项目,包括源文件,并设法得到它编译但在此之前我这样做,我想我会问这里是否是值得的,或者还有别的东西从安装缺少的设备上吧?或者,也许我应该使用其他版本?

The other suggestion is to build from source but like the author of the question I cannot load the project file into VS 2008 to do that. I could create a new project and include the source files and try to get it to compile but before I do that I thought I would ask here if it is worth it or if there is something else missing from the installation on the device perhaps? Or maybe I should be using an alternate build?

推荐答案

所以,我需要RTFM!自述文件说:

So I needed to RTFM! The readme file says:

微软在Visual Studio 2010中停止Compact Framework的支持。   对于Compact Framework的3.5版本下载Json.NET 3.5。

Microsoft stopped support for the Compact Framework in Visual Studio 2010. For a Compact Framework 3.5 build download Json.NET 3.5.

所以我抓住了最新的3.5版本,这是: Json.NET 3.5 8发布,更新了我的引用指向 Newtonsoft.Json.Compact.dll 组装,运行它和它的工作就好了。

So I grabbed the most recent 3.5 version which is: Json.NET 3.5 Release 8, updated my reference to point to the Newtonsoft.Json.Compact.dll assembly, ran it and it worked fine.

这篇关于序列化时,JSON的.Net的Windows Mobile错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆