0

I have the following code:

static void Main(string[] args)
{
    string edifile = args[0].ToString();
    string editype = args[1].ToString();
    string orderpath = @"C:\Tremor\MXSG\Orders\";

    ReadPurchaseOrders(edifile, orderpath, editype);
}

In a batch file I am passing string parameters:

Start C:\Tremor\EDIHUB\ReadEDI.application "C:\Temp\testedi\Arrow_ORDERS_D97A_1_20171002_053002_0000038641.txt" "EdifactOrders"

Error says:

Index was outside the bounds of the array.  

Any ideas why I would get this error? Any help would be appreciated!

Gholamali Irani
  • 4,391
  • 6
  • 28
  • 59
Tremor
  • 9
  • 1
  • 4
  • This question has absolutely nothing to do with EDI. Please stop tag spamming. Read the tag description before using it, and only use the ones that actually are relevant to your post. The fact you have *EDI* in your foldername twice or you're passing *EdiFactOrders* as a command line argument does **not** make the question about EDI. – Ken White Jan 23 '18 at 01:08
  • Have you tried it without the "Start" command? –  Jan 23 '18 at 01:21
  • Got the same error when I removed "Start" from the batch file. – Tremor Jan 23 '18 at 01:29
  • Are you certain that this is happening in the Main function and not the one it calls? –  Jan 23 '18 at 01:34
  • cd C:\Users\tolaes\Documents\Visual Studio 2013\Projects\ReadEDI\ReadEDI\bin\Debug ReadEDI.exe "C:\Temp\testedi\Arrow_ORDERS_D97A_1_20171002_053002_0000038641.txt" "EdifactOrders" this works – Tremor Jan 23 '18 at 01:59
  • I was able to determine the issue. I needed to define arg1 and arg2 in project properties so it knows to look for 2 args. – Tremor Feb 14 '18 at 00:59

0 Answers0