OutputDebugString doesnt work in the debugger (VS 2010 Pro - Beta 1, C#) - by MillKa

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 457063 Comments
Status Closed Workarounds
Type Bug Repros 9
Opened 5/24/2009 12:46:13 AM
Access Restriction Public


Debug output from C# code via P/Invoke OutputDebugString doesnt work in the Debugger.
Output appears in VS OutputWindow, but not in MS-SysInternals DebugView or other Debug Monitors.

OutputDebugString works, when running outside VS, and when running inside VS but without debugging (Launch via Ctrl-F5).

This bug is not identical to #330369 ( https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=330369 ). Please note, that the 'Steps to reproduce' implement precisely the recommended workaround on bug #330369.

If the decision to cut off all other debug monitors is by design, there should be an option/switch/registry setting to re-enable other debug monitors.

The code to reproduce the bug is attached as ODS.cs. Compile as console application.

The output to Console in class MTL is of course redundant, but proves that that the methods of MTL are actually called.
Sign in to post a comment.
Posted by Giladk on 12/8/2010 at 3:30 AM
I would like to add myself to the "users who need this feature" list. DebugView was a main way to debug our software and now that it is not working we will have to think of a different approach.

I think MS should release a workaround so it would be possible to enable this feature.
Posted by rcassick on 11/27/2010 at 9:55 AM
I can't believe that this is in the state that it is in. Seriously? MS feels that that they can just horn in on the debug stream and isolate it now? Yeah, it's fine that I can still get the debug in the debug window of the editor, but the USEFULL part of debugview was when I wanted to get coordinated debugging between multiple process running in multiple instances of VS. It also gave me high-res time stamps without having to write code to do it, then pull that text from the individual windows into somethign like excel so I can see all the debug together sorted by date and time?



Not kidding me here?

I need to make a phone call...
Posted by vtchrisp on 6/25/2010 at 10:23 AM
I can also attest that this is a new regression with .netfx 4.

I'm also annoyed by the verbose "HR originated" and "HR propogated" messages that spew when starting an app.

Is there any way to disable VS from highjacking the single target of OutputDebugString? I find the output window in VS to be entirely too noisy to be usable!
Posted by Clive _ RA on 5/25/2010 at 3:07 PM
We have also come across this problem today.

We migrated our projects to Vis Studio 2010 and we continued to see our trace output in DebugView

However as soon as we changed projects to use .Net 4 then the output to DebugView does not appear, unless running in non-debug mode.
Posted by yspring on 4/13/2010 at 1:30 AM
Ah yeah? I why (using VS2010 RTM and RC) do I see all the debug output from 3.5 projects but not from 4.0 projects? And why does EVERY .NET 4 process flood DebugView? How do you expect serious debugging this way?
Posted by Microsoft on 5/28/2009 at 1:41 PM

Thank you for taking the time to report this. The issue you have reported is classified as by “By Design”, to explain: MS-SysInternals DebugView has never worked when a native debugger is attached. The CLR has a new debugging architecture where the CLR is native debugging the application even when managed only attached, and therefore MS-SysInternals DebugView will not work.

Best Regards,
Andrew Hall
Visual Studio Debugger
Posted by Microsoft on 5/25/2009 at 4:16 AM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Posted by MillKa on 5/24/2009 at 8:57 AM
To SvenC:
Has NOT always been like that !
In VS 2008 and VS 2005, output to OutputDebugString goes to VS-OutputWindow AND DebugView (or another debug monitor).
Just run the attached sample in VS2008 and then in VS2010.

To MS:
If for some reason, output to VS-OutputWindow AND DebugView is not possible anymore with VS2010/NET4, VS should check if DebugView is running either when VS is started or when the Debugee is started. If DebugView or some other external debug monitor is running, VS should not redirect OutputDebugString to VS-OutputWindow.
If there is some good reason for the new behaviour, there should be some way to switch back to the old behaviour for those who need it.
Posted by SvenC on 5/24/2009 at 2:48 AM
Has always been like that: only one debug listener is possible. Try e.g. to start DebugView twice, you will see that the second DebugView cannot connect to the local machine