title: How do I fix this ArgumentNullException in int.Parse?
body: <p>This is the .cs file runs fine in Mono:</p>
  
  <pre><code>using System;
  
  public class HelloWorld
  {
      static public void Main ()
      {
      Console.WriteLine("Enter a number");
  
      int UserNumber = int.Parse(Console.ReadLine());
  
      Console.WriteLine("Your number is: " + UserNumber);
      }
  }
  </code></pre>
  
  <p>I opened this Test.cs file in Xamarin, which worked properly. Then I choose 'Run' > 'Start Without Debugging' and these errors pop up in the display panel:</p>
  
  <pre><code>Enter a number
  
  Unhandled Exception:
  System.ArgumentNullException: Argument cannot be null.
  Parameter name: String
    at System.Number.StringToNumber (System.String str, NumberStyles options, System.NumberBuffer&amp; number, System.Globalization.NumberFormatInfo info, Boolean parseDecimal) [0x00054] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/number.cs:1084 
    at System.Number.ParseInt32 (System.String s, NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/number.cs:755 
    at System.Int32.Parse (System.String s) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/int32.cs:140 
    at HelloWorld.Main () [0x0000b] in /Users/Yardenbourg/Desktop/Test.cs:9 
  [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Argument cannot be null.
  Parameter name: String
    at System.Number.StringToNumber (System.String str, NumberStyles options, System.NumberBuffer&amp; number, System.Globalization.NumberFormatInfo info, Boolean parseDecimal) [0x00054] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/number.cs:1084 
    at System.Number.ParseInt32 (System.String s, NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/number.cs:755 
    at System.Int32.Parse (System.String s) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/int32.cs:140 
    at HelloWorld.Main () [0x0000b] in /Users/Yardenbourg/Desktop/Test.cs:9 
  The application was terminated by a signal: SIGHUP
  </code></pre>
  
  <p>I am not sure what the problem here is. Could it be to do with this line? </p>
  
  <pre><code>int UserNumber = int.Parse(Console.ReadLine());
  </code></pre>