Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see the trace in a separate console

Is it possible in C# to see the traces in a separate console. For example, I am having a window based application in which there are trace statements that will write the currently executed method name in to the console. When I run this application, it should automatically open a console and start the traces. Is this possible?


2 Answers

If you set the project type of your window application to Console, it will open a console window when you run it.

like image 131
jfs Avatar answered Jan 24 '26 13:01

jfs


You can create a console window by calling the Win32 AllocConsole API through P/Invoke.

http://pinvoke.net/default.aspx/kernel32/AllocConsole.html

like image 35
James Curran Avatar answered Jan 24 '26 12:01

James Curran