OutputDebugString in C#

jalaram

Lifer
Aug 14, 2000
12,920
2
81
Hello all,

I have a few dll files written in cpp that use OutputDebugString for Trace statements that I view using Sysinternals' DebugView program. Everything works great like that regardless if the dll is release or debug.

Now I'm using a dll written in C# and I want to know how to do the same. I did my usual Google search and found Debug.Print. I'm assuming that is the same as System.Diagnostics.Debug.Print which I've added. However, neither the DebugView program nor the VS 2005 Console output window shows any output. I've added #define DEBUG on the top of my main cs source file. I've added a listener (for the console output windows) during the Activate method which gets called when the dll is loaded.

Here's the overview of the programs and dll files:

Prog A <-> C# assembly add-in dll <-> C++ bridge dll <-> Prog B

I have no control over the two programs. I just want to send info from one to another. Prog B loads and calls functions in the bridge dll. Prog A loads the add-in dll as an assembly. Ideally, all I would need is the bridge to communicate, but for speed's sake I created a C# add-in for some repetitive calls. The OutputDebugString calls in the C++ bridge output fine.

Am I missing something?
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
System.Diagnostics.Debug only runs when you build in Debug mode. The calls are disabled in Release mode.
 

jalaram

Lifer
Aug 14, 2000
12,920
2
81
System.Diagnostics.Debug only runs when you build in Debug mode. The calls are disabled in Release mode.

Thanks for the reply. I had read that as well, so I added #define DEBUG and my build configuration is Debug:Any CPU.

I was only bringing up release mode earlier to refer to my C++ dlls.