ŇąđĬr Belmokhtar ŇąđĬr Belmokhtar - 5 months ago 35
C# Question

"Hello world" c# program appear for a split of a second with Visual Studio

The code is correct I checked, and there is no real problem with my PC, my hardware is a bit old but it can do the job, so I'm guessing it's the settings of Visual Studio, I use the 2017 community edition and the solution is a consol application. the solution runs but I don't see my msg or anything, just the consol opening and closing real fast

Answer Source

You are probably running the application in debug, without something to prevent it to close as soon as the job gets done.
Basically, your code executes, and the application shuts because there is nothing else left to do.
Two solutions:

  • do as Štěpán Šubík recommands : put a Console.ReadKey();
  • start the application without debugging (Ctrl+F5 or menu Debug -> Start Without Debugging).

In both case, the console won't close itself automatically :).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download