0
I was programming normally in VS in "Console" mode when I came across this message:
"A first chance Exception of type 'System.Formatexception' occurred in mscorlib.dll An unhandled Exception of type 'System.Formatexception' occurred in mscorlib.dll Additional information: Index (based on zero) must be greater than or equal to zero and smaller than the argument list size. The program '[1124] Consoleapplication4.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0)"
What it’s all about and how to fix it?
Code:
string A1;
string A2;
string A3;
string A4;
string A5;
String A6;
String A7;
String A8;
A1 = Console.ReadLine();
A2 = Console.ReadLine();
A3 = Console.ReadLine();
A4 = Console.ReadLine();
A5 = Console.ReadLine();
A6 = Console.ReadLine();
A7 = Console.ReadLine();
A8 = Console.ReadLine();
Console.Write("Segunda: {0}, {1}, {2}, {3}", A1, A2, A3, A4);
Console.ReadLine();
Console.Write("Terça: {4}, {7}, {5}, {1}, {6}", A5, A8, A6, A2, A7);
Console.ReadKey();
When debugging, post the code from where the exception was triggered, so we can point out the problem. By error msg, the problem is in one of the parameters you passed to some function, or a negative value, or a value greater than the allowed.
– Ismael
Passes more information, Like the debug shown above, Or the snippet of your code that generates this Exception, Only the error message is very vague.
– Edenilson Bila