• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1595
  • Last Modified:

System.Diagnostics.Debug.WriteLine

System.Diagnostics.Debug.WriteLine(sqlText4 + "\n");

Can someone please tell me where the above output goes. Which window? I am in debug configuration and for the life of me cannot find it anywhere.
0
claghorn
Asked:
claghorn
  • 9
  • 7
  • 4
  • +1
1 Solution
 
anyoneisCommented:
Output. CTL-Alt-O with std c# setup or View, Output.

DAvid
0
 
claghornAuthor Commented:
maybe so but why does my editor skip over this line? I have my project set to debug.
0
 
vo1dCommented:
is it a console application?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
claghornAuthor Commented:
yes, it is a cosole application, but can't I write to the immediate window at least?
worst case I'll have to write to file maybe. I'm just trying to generate sql that I can run in another window.
0
 
anyoneisCommented:
If it is a console application, why not write it to the console using Writeline? Something like:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleOutput
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Copy Me!");
            Console.WriteLine("Copy Me!");
            System.Diagnostics.Debug.WriteLine("Copy Me!");
            System.Diagnostics.Debug.WriteLine("Copy Me!");

            Console.ReadKey();
        }
    }
}


To copy the output form the DOS window, right click on the title bar of the DOS window and select Edit, Mark. Then use the mouse to select the text you want to put on the clipboard and right click again. That will copy the highlight region to the clipboard.

Alternatively, just use Visual studio, View, Output. There, after the program has run, will be whatever you put using  System.Diagnostics.Debug.WriteLine.

David
0
 
vo1dCommented:
so because you are using a console app, you will have to use Console.WiteLine to get output.
0
 
claghornAuthor Commented:
The console window is useless to me. I cannot copy all 455 lines that I need. There is a ceiling that I cannot break through. The console window is not scrollable and is too narrow. It breaks each line into two which won't run in the other window I going to run the statements in. The View - Output is useless too. It shows non sql statements that the compiler generates.
0
 
vo1dCommented:
could you set a breakpoint to that line?
or is it marked as inactive?
0
 
claghornAuthor Commented:
the line does'nt exist according to the runtime engine. I think I'll have to a file, if it can do that.
0
 
anyoneisCommented:
Are you doing a release build? The line wouldn't exist if so. Right-click on the solution in the solution explorer, then select conjfiguration manager. Ensure you are doing a debug build.

David
0
 
claghornAuthor Commented:
yep, its in debug configuration.
0
 
vo1dCommented:
which framework version do you use?
0
 
claghornAuthor Commented:
vs 2005
0
 
vo1dCommented:
try to output a static text with a breakpoint like this:
System.Diagnostics.Debug.WriteLine("ok");

does your breakpoint not work too?
0
 
claghornAuthor Commented:
it skips over it., but even if it did not I'd have to continue 455 times, the amount of sql lines i'm generating. don't want to do that.
0
 
vo1dCommented:
then use the StreamWriter class to write to a textfile.
0
 
anyoneisCommented:
When I compile and run the program I sent you, and look in the Output Window, I see:

'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\drogers\My Documents\Visual Studio 2005\Projects\ConsoleOutput\ConsoleOutput\bin\Debug\ConsoleOutput.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x96c has exited with code 0 (0x0).
The thread 0x1e48 has exited with code 0 (0x0).
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\drogers\My Documents\Visual Studio 2005\Projects\ConsoleOutput\ConsoleOutput\bin\Debug\ConsoleOutput.exe', Symbols loaded.
'ConsoleOutput.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Copy Me!  <<<-------
Copy Me!  <<<-------
The thread '<No Name>' (0x3d8) has exited with code 0 (0x0).
The thread 0x1d74 has exited with code 0 (0x0).
The program '[2836] ConsoleOutput.vshost.exe: Managed' has exited with code 0 (0x0).


Which, yes, has a bunch of compiler stuff, but it also has my output!!

David
0
 
claghornAuthor Commented:
yes, isee but that would not help me at all. I have to write to a file. Thanks Anyways.
0
 
vo1dCommented:
maybe it is a bug if you use the vshost.exe process to run your application in your ide.
disable that option and try again.
0
 
claghornAuthor Commented:
My solution was to write output to file. Here is the code for this. Hope this helps someone?
public static System.String tempFile = "C:\\logfile1";
StreamWriter streamWriter = null;
try
{
    // open for append
    streamWriter = new StreamWriter(tempFile, true);
    // append some text
    streamWriter.WriteLine(sqlText);
}

if (streamWriter != null)
             streamWriter.Close();

This thread is closed. Thanks
0
 
GranModCommented:
PAQed with points refunded (20)

GranMod
Community Support Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 9
  • 7
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now