labramusic
labramusic

Reputation: 31

Why doesn't Console.WriteLine print anything in Visual Studio with Run without Debugging?

I made a new C# console application in Visual Studio 2015 and the line Console.WriteLine("String"); works fine when I start debugging, but running without debugging returns a blank command prompt window. How do I print to the console using start without debugging?

Upvotes: 2

Views: 1382

Answers (2)

labramusic
labramusic

Reputation: 31

As Hans Passant commented, it was exactly because of my antivirus Avast that the "Run without debugging" wouldn't display anything. I disabled its shields and everything worked fine.

Upvotes: 0

Coaden
Coaden

Reputation: 466

Console.WriteLine() works the same in Release and Debug mode. It writes to standard output stdout. If you are creating a console application you should see the output in either mode.

Debug.WriteLine() however; has a compiler directive around it - #if DEBUG - and will not be compiled into release code.

Upvotes: 2

Related Questions