When adding command line arguments from the project's Start Options, the vshost.exe is added as an argument
If I put two arguments in that field, it shows three because it gives me the vshost.exe process as well.
It's throwing off my debugging. Anyone know either a way to fix this or an alternate method of getting the command line arguments in WPF?
I'm currently getting them via:
string args = Environment.GetCommandLineArgs();
The first argument is always the process name.
When you run the exe outside the debugger the first argument will be "MyApplication.exe".
You should start your processing of the command line arguments from index 1.
The first element in the array contains the file name of the executing program. If the file name is not available, the first element is equal to String.Empty. The remaining elements contain any additional tokens entered on the command line.