[Mono-list] Console.ReadLine.Split -> NullReferenceException
Jon Cosby
jon at jcosby.com
Sun Oct 21 13:23:33 EDT 2007
Trying to read input from the console, I get a NullReferenceException at
runtime. I'm not even prompted for input.
////////////////////////////
int arg1 = 0, arg2 = 0;
Console.WriteLine("Enter input: ");
string[] sInput = Console.ReadLine().Split(new char[] {' '});
////////////////////////////
Enter input:
Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
at test.MainClass.Main (System.String[] args) [0x0000e] in
/home/jon/tmp/test/test/Main.cs:18
////////////////////////////
Is anyone else getting this? I'll report it on Bugzilla, unless someone
can see something I'm overlooking.
Jon Cosby
More information about the Mono-list
mailing list