title: Console.ReadLine() passed to C# event
body: <p>I'm learning RX and would like to use Console.ReadLine as a source for observable sequences.</p>
  
  <p>I know that I can create "IEnumerable" using "yield return", but for my concrete use case I've decided to create a C# event, so that potentially many observers will be able to share the same keyboard input.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class Program
  {
      private delegate void OnNewInputLineHandler(string line);
  
      private static event OnNewInputLineHandler OnNewInputLineEvent = _ =&gt; {};
  
      static void Main(string[] args)
      {
          Task.Run((Action) GetInput);
  
          var input = ConsoleInput();
          input.Subscribe(s=&gt;Console.WriteLine("1: " + s));
  
          Thread.Sleep(30000);
      }
  
      private static void GetInput()
      {
          while (true)
              OnNewInputLineEvent(Console.ReadLine());
      }
  
      private static IObservable&lt;string&gt; ConsoleInput()
      {
          return Observable.Create&lt;string&gt;(
          (IObserver&lt;string&gt; observer) =&gt;
          {
              OnNewInputLineHandler h = observer.OnNext;
              OnNewInputLineEvent += h;
              return Disposable.Create(() =&gt; { OnNewInputLineEvent -= h; });
          });
      }
  }
  </code></pre>
  
  <p>My problem - when I run the GetInput method as it is shown above, the very first input line is not sent to the sequence (but it is sent to the event handler).</p>
  
  <p>However, if I replace it with the following version, everything works as expected:</p>
  
  <pre><code>private static void GetInput()
  {
      while (true)
      {
          var s = Console.ReadLine();
          OnNewInputLineEvent(s);
      }
  }
  </code></pre>
  
  <p>Could someone shed some light on why this might happen?</p>