title: StreamReader Peek() method breaking without throwing exception
body: <p>I have a chrome native messaging host application that reads JSON messages from STDIN and writes data to STDOUT.</p>
  
  <p>The problem I am facing right now is with the <code>StreamReader.Peek()</code> method.</p>
  
  <p>On debugging on first iteration it runs successfully, but on second iteration it breaks at <strong>reader.Peek()</strong> point with out throwing any exception.</p>
  
  <p>The control just goes away without any exception.</p>
  
  <pre><code>var length = 0;
  var lengthBytes = new byte[4];
  stdin.Read(lengthBytes, 0, 4);
  length = BitConverter.ToInt32(lengthBytes, 0);
  
  var messageBuffer = new char[length];
  using (var reader = new StreamReader(stdin))
  {
      while (reader.Peek() &gt;= 0)
      {
          reader.Read(messageBuffer, 0, messageBuffer.Length);
      }
  }
  
  var message = new string(messageBuffer);
  Log.Debug(message);
  var jsonMessageObject = JsonConvert.DeserializeObject&lt;JObject&gt;(message);
  
  if (jsonMessageObject == null)
  {
      return null;
  }
  </code></pre>
  
  <p>Can someone help how to know whats going wrong even though it had read all the data perfectly?</p>
  
  <p>Why is <code>Peek()</code> breaking without any exception?</p>