反序列化双重抛出单声道异常

时间:2014-03-08 08:19:51

标签: c# mono json.net

我有这块JSON(实际上我有一个更大的JSON片段,但这足以引发异常):

{'something': 0.0}

然后我尝试使用JsonConvert.DeserializeObject或JObject.Parse反序列化它:

var result = JObject.Parse("{'something': 0.0}");

这在我的运行Windows的开发机器上工作正常,但是当我在使用mono的Raspbian Pi上运行它时会引发异常:

System.FormatException: Input string was not in the correct format
  at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0 
  at System.Double.Parse (System.String s, IFormatProvider provider) [0x00000] in <filename unknown>:0 
  at System.Convert.ToDouble (System.String value, IFormatProvider provider) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonTextReader.ParseNumber () [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonTextReader.ParseValue () [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonTextReader.ReadInternal () [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonTextReader.Read () [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Linq.JContainer.ReadContentFrom (Newtonsoft.Json.JsonReader r) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom (Newtonsoft.Json.JsonReader reader) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Linq.JObject.Load (Newtonsoft.Json.JsonReader reader) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Linq.JObject.Parse (System.String json) [0x00000] in <filename unknown>:0 
  at Tstat.Mono.Program.Main () [0x00000] in <filename unknown>:0 

我尝试更改线程的文化,但这没有任何效果。

这是JSON.NET中的错误,还是我做错了什么?

更新

某些版本控制信息。我从源代码构建单声道,所以我有这个版本的单声道运行:

Mono JIT compiler version 3.4.0 (master/89684c5 Thu Feb 27 14:37:23 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            sgen

JSON.NET是5.0.8版(程序集版本4.5.0)

0 个答案:

没有答案