c# - Can output from OutputDebugString be viewed in Visual Studio's output window? -


I see C # and visual & nbsp; Studio & nbsp; I am using 2010.

When I write the OutputDebugString debug info, should it show in the output window?

I can see the output from output debugstring , but I thought I saw it under Visual Studio's output window under Menu Tools ? Options ? Debugging ? General , and the output is not being redirected to the immediate window. I also looked at the menu tool *? Options ? Debugging ? In the end, I have specified the debug messages that should be displayed in the output window to use the drop-down list in the Output window and all the normal output settings are set to "On".

If I change the menu tool *? Options ? Debugging ? To redirect the normal outlet to the instant window, output debugstring messages do not appear in the instant window.

Here is my complete test program:

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; Using System.Runtime.InteropServices; Using System.Diagnostics; Namespace output debugstring {class program {{DllImport ("kernel32.dll", chartset = charset.auto)} public static extern zero output debug string (string message); Fixed Zero Main (string [] Args) {Console.WriteLine ("Main - Enter - Console.WrightLine"); Debug Virline ("Main - Enter - Debug WrightLine"); Output debug string ("main - enter - outputdid bugstring"); Output debugstring ("main - exit - outputdid bugstring"); Debug Virus Line ("Main - Extrite - Debug. Viral"); Console.light line ("main - exit - console.light line"); }}}  

If I run within the debugger, then debugs. The Virlight line appears in the output output window, but OutputDebugString is not output.

If I run from the console window, both debug Lit and output debugstring shows in the debug view.

Output debugging Why does output never appear in the output window?

Eventually, my intention is not to write too much debug output with OutputDebugString , but I will use the system. Diagnostics or NLog or something similar. I'm just trying to figure out that if I configure a logging platform to write on OutputDebugString , the output will be visible within the debugger.

I went back to my original program (not the above general test) which would be trace source and trace listener to app.config Configures via File. If I configure trace sources to write to System.Diagnostics.DefaultTraceListener (which is written in OutputDebugString in writing), then trace source output on the debug window Go. However, lines that write directly with OutputDebugString (such as in my simple example) do not go into the debug window. In addition, if I use a different TraceListener which writes on OutputDebugString (I have got one with encoded Diagnostics on Codepax), then not on the output debug window goes.

A note about the Ukadc.Diagnostics trace listener ... There are some trace listeners in Ukadc.Diagnostics that allow for custom formatting of the output (available in log-ennet, nolog, and lab Similar to formatting). So, "only" can use "standard" .NET diagnostic logging with dependency on Ukadc.Diagnostics, but I can get some advanced features (such as output formatting) without possibly depending on a large platform. In this case, I can use Ukadc.Diagnostics OutputDebugStringTraceListener to write the logging output in the debug window in the same format (if desired, or a different format), as written in the file

Note that I have seen these questions, but they did not provide work solutions:

and

You were going on this question for a while. off course not!

Check the Project + Property, Debug Tab, "Enable Unmanned Code Debugging".


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -