For starters, I had a tool (App.exe) that was written in C++6, one of the most important aspects was the return codes which indicated where the tool failed.
This was really simple to do, I made my MAIN return int and then when I get to failure points I just do "return 1;" or "return 2;", etc... and this would return the correct value.
Now I am re-writing the same tool in C# (as a Console Application called App.exe) but the Return Codes are not working.
So far no matter what I try it always returns a value of 0x0 no matter where it fails, I have already tried a few different ways (as seen below) and nothing seems to works.
So from the above code you can see I have already tried 3 different approaches, setting the ExitCode, Exiting with an ExitCode, and simply Returning the value (as I used to do with C++6 and worked fine)
However, in all 3 cases I get the following (from the debug window)
The program '[1704] App.exe' has exited with code 0 (0x0).
No matter what I try it never returns with a return code (note that RET_UNKNOWNSTATIONTYPE = 0x00000001
Any clues, help, or hints would be greatly appreciated.
Thanks,
This was really simple to do, I made my MAIN return int and then when I get to failure points I just do "return 1;" or "return 2;", etc... and this would return the correct value.
Now I am re-writing the same tool in C# (as a Console Application called App.exe) but the Return Codes are not working.
So far no matter what I try it always returns a value of 0x0 no matter where it fails, I have already tried a few different ways (as seen below) and nothing seems to works.
Code:
try
{
// DO THE WORK
}
catch
{
//Environment.ExitCode = RET_UNKNOWNSTATIONTYPE;
//Environment.Exit(RET_UNKNOWNSTATIONTYPE);
//return RET_UNKNOWNSTATIONTYPE;
}
So from the above code you can see I have already tried 3 different approaches, setting the ExitCode, Exiting with an ExitCode, and simply Returning the value (as I used to do with C++6 and worked fine)
However, in all 3 cases I get the following (from the debug window)
The program '[1704] App.exe' has exited with code 0 (0x0).
No matter what I try it never returns with a return code (note that RET_UNKNOWNSTATIONTYPE = 0x00000001
Any clues, help, or hints would be greatly appreciated.
Thanks,