Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send the entire debug console output to clipboard?

I would like to know in C# or VB.NET if at any time I could send all the output that is written in the debug console of my IDE, to the clipboard.

Example Pseudo-Code in vb.net:

For x as integer = 0 to integer.maxvalue
    debug.writeline("test console line " & x)
next

Clipboard.SetText(Debug.Output)

I would like to copy all the lines of the debug console, including the messages that were written at the moment of execution, just ALL:

WindowsApplication6.vshost.exe' (CLR v4.0.30319: WindowsApplication6.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. etc... test console line 1 test console line 2 test console line 3 etc...

I hope that maybe using DTE (or easier) it could be done, any ideas?

like image 352
ElektroStudios Avatar asked Oct 21 '22 04:10

ElektroStudios


1 Answers

I would go this way:

EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0");
TextSelection sel = dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Debug").TextDocument.Selection;
sel.StartOfDocument(false);
sel.EndOfDocument(true);
Clipboard.SetText(sel.Text);
like image 162
romanoza Avatar answered Nov 03 '22 21:11

romanoza