none
SOS,求助在WebClient中使用Newtonsoft.Json解析Json出错的BUG RRS feed

  • 常规讨论

  •         public MainPage()
            {
                InitializeComponent();

                WebClient web = new WebClient();
                web.DownloadStringCompleted += new DownloadStringCompletedEventHandler(web_DownloadStringCompleted);
                web.DownloadStringAsync(new Uri("http://localhost/list.json"));
            }

            void web_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
            {
                try
                {
                    string sJson = e.Result;
                    var p = JsonConvert.DeserializeObject(sJson, typeof(OpernItem));
                    OpernItem oi = p as OpernItem;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

    代码如上,sJson字符串已经获得值了也没问题,为什么反序列化就出错了,而且最诡异的是,用控制台调试是好的。
     ex.Message:
    Could not load type 'System.Dynamic.IDynamicMetaObjectProvider' from assembly 'System.Core, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
    要疯了!

    2012年4月27日 2:38