I have a hybrid app which basically only shows the available commandline modifiers when started from the command prompt. There is then no windows Application code involved or initialized. If started from the commandline I try to attach the console to have ability for seeing output via Console.Writeline. I have now a "--help" command which only prints out the available commands and then exits the application. Basically nothing from the WinForm application is executed or initialized at this stage. The output to the console works fine, however the process is terminated as seen e.g. ProcMon, but I have to hit "Enter" to get the commandline prompt back. I use "FreeConsole", Environment.Exit, Application.Exit or the simple direct "return Exitcode", but it still waits for an "Enter" char until the prompt is back. I'm very sure the process is terminated as I can see the termination in ProcMon. What can be the cause for this behaviour ? I'm also using the log4net ColoredConsoleAppender whose output could be seen, but I meanwhile removed it from the configuration to have no interference here. This didn't changed also the described behaviour.
Asked
Active
Viewed 26 times
0
-
What is the type of the application? Console application or Windows Forms? – Steeeve Aug 05 '21 at 13:11
-
@Steeeve : It's windows forms...but the Application is only called for getting the executable name at startup in that case. No Forms are running or instantiated at that point. – Florian Storck Aug 05 '21 at 13:52
-
Does [this](https://stackoverflow.com/a/277776/10318835) help? – Steeeve Aug 05 '21 at 13:56
-
@Steeeve : yes, thank's , it explains some of it but it seems there is no perfect solution. I've to try some things out. – Florian Storck Aug 05 '21 at 14:08