• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

OutputDebugString in C#

jalaram

Lifer
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?
 
System.Diagnostics.Debug only runs when you build in Debug mode. The calls are disabled in Release mode.
 
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.
 
Back
Top