Mono missing System.Numerics.BigInteger.Parse(stri

2020-03-12 03:34发布

问题:

I'm currently getting the following error using the Json.NET/Newtonsoft.JSON library:

Missing method System.Numerics.BigInteger::Parse(string,IFormatProvider) in assembly
/usr/lib/mono/gac/System.Numerics/4.0.0.0__b77a5c561934e089/System.Numerics.dll,
referenced in assembly ~/dev/Mono/Mercury/Mercury/bin/Debug/Newtonsoft.Json.dll

This occurs every time that the Json retrieved from the couchDB database has a numeric value field. I discovered from searching that the method that the library is calling from System.Numerics isn't yet implemented in Mono.

The problem is that Json.NET is a dependency for another library that I'm using (WDK.API.CouchDB [3]).

Is there any way I can circumvent this without tweaking the source of any of the libraries? Any Suggestions?

PS: I'm using Mono 3.0.6 and MonoDevelop 4.0.8, on Linux. I just started learning C# and this is my first project with it. I tried to search the topic on the web with no fruitful result.

Thanks

[3] code.google.com/p/skitsanoswdk

回答1:

Use a 4.5 version of Json.NET until Mono fix it.



回答2:

To fix this you can add a reference to System.Numerics and then set its property Copy Local to true.



回答3:

Have you tried any other method for converting strings to ints? I usually use Convert.ToInt32(//string) or if you want huge ints, then use Convert.ToInt64(//string)

Otherwise, check out. The TryParse() function is pretty handy:

http://www.dotnetperls.com/convert-string-int



回答4:

If the method is not implemented, the best thing to do is implement it. Mono is an open source project. As such, if you cannot wait for the developers to implement something, you should step up and implement it, and send a pull request with your change.