0

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!

2 Answers 2

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

  2. Check to see if quant is null.

Sign up to request clarification or add additional context in comments.

6 Comments

... or use Double.TryParse
Thanks for such a quick response, guys! I'm still puzzled - quant is not null, and Double.TryParse does not seem to work either. Do you have more ideas?
How doesn't it work? What is actually in quant? Please update your question, and I might be able to update my answer
It seems like I solved the problem: it didn't want to work with array elements in a random order; when I renamed values[ItemNumber,2] = Double.Parse(quant); as values[ItemNumber,1] = Double.Parse(quant); and the next element mentioned, [ItemNumber,1], as [ItemNumber,2], I didn't receive any more error messages. But my brain wouldn't have turned on without your help. Thanks!
Glad to help, although I'm not entirely sure I understand what the issue was. The exception you showed is definitely from Double.Parse, so... Well, good that it's resolved anyway!
|
0

Yes, it was that simple: just don't mention column 2 before column 1. I guess most people won't do it anyways.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.