title: Task.Factory.StartNew is not working in console c# application
body: <p>I am having a console application which reads the messages from Console.OpenStandardInput();
  I am doing this in a task. but it seems to be not working.</p>
  
  <pre><code>   static void Main(string[] args)
          {
      wtoken = new CancellationTokenSource();
              readInputStream = Task.Factory.StartNew(() =&gt;
              {
                  wtoken.Token.ThrowIfCancellationRequested();
                  while (true)
                  { 
                      if (wtoken.Token.IsCancellationRequested)
                      {
                          wtoken.Token.ThrowIfCancellationRequested();
                      }
                      else
                      {
                         OpenStandardStreamIn();
                      }
                  }
              }, wtoken.Token
              );
       Console.ReadLine();
  }
  </code></pre>
  
  <p>Here is my OpenStandardStreamIn function</p>
  
  <pre><code>   public static void OpenStandardStreamIn()
          {
                  Stream stdin = Console.OpenStandardInput();
                  int length = 0;
                  byte[] bytes = new byte[4];
                  stdin.Read(bytes, 0, 4);
                  length = System.BitConverter.ToInt32(bytes, 0);
                  string input = "";
                  for (int i = 0; i &lt; length; i++)
                  {
                      input += (char)stdin.ReadByte();
                  }
                  Console.Write(input);
              }
  </code></pre>
  
  <p>Any help? why it is not working in a continous loop</p>