简体   繁体   中英

System.ArgumentNullException error with MonoDevelop compiling a c# code

I have another simple question. I have a C# program written as a .cs file. MonoDevelop (improved by Xamarin) managed to build this project. However, when I try to run it, I get the error:

System.ArgumentNullException: Argument cannot be null.
Parameter name: s
  at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider)[0x00012] in /private/tmp/monobuild/build/BUILD/mono- 2.10.9/mcs/class/corlib/System/Double.cs:229
  at System.Double.Parse (System.String s) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System/Double.cs:200
  at SampleNamespace.SampleClass.Main () [0x00049] in /Users/ninakuklisova/ThoughtWorks/Sales Taxes with inputs.cs:42

which points to the following line of the code:

values[ItemNumber,2] = Double.Parse(quant);

What I find mysterious is that there is no /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System/ folder on my Mac, and when I compiled this code on online compilers, all went well. Do you know what could be wrong?

Thank you very much!

  1. That folder probably existed on the machine of whoever compiled mono.

  2. Check to see if quant is null.

是的,就是这么简单:只是不要在第1列之前提到第2列。我想绝大多数人都不会这样做。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM