1

I have a program that is GUI that builds my project and saves the logs in some folder. I also run it using cmd and it works fine but when I want to redirect it - it just breaks: enter image description here

it offers me to debug it - and it shows me this line :

  if (startPosition == 0)
                    {
                        Console.Write(s);
                    }
                    else
                    {
                        Console.CursorLeft = 70; //THIS LINE
                        Console.WriteLine(s);
                    }

can anyone help me understanding what is wring here? thank you!

user1391863
  • 137
  • 3
  • 12
  • That line moves the cursor 70 spaces inwards in the command line window? – Sayse Mar 18 '13 at 12:28
  • Are you redirecting Console to a file stream? If so, check that the configuration points to a valid location for the file. – Stefan Emanuelsson Mar 18 '13 at 12:51
  • You will need to avoid using properties like CursorLeft when output is redirected, there is no console. Use the code in [this answer](http://stackoverflow.com/a/3453272/17034) to detect that output is being redirected. – Hans Passant Mar 18 '13 at 13:58
  • when I'm creating the log file - it works fine even when I'm using the console. but when I want to re-direct it - then it fails =\ – user1391863 Mar 18 '13 at 14:23

0 Answers0