title: Topshelf C# Windows Service - Cannot pass HostControl
body: <p>I am trying to pass a HostControl instance to the start method of a topshelf service but I am getting the following compiler errors:</p>
  
  <ul>
  <li>Not all code paths return a value in lambda expression of type</li>
  <li>'HostSettings' does not contain a definition for 'ConstructUsing'</li>
  <li><strong>'HostSettings' does not contain a definition for 'WhenStarted' and no 
  extension method 'WhenStarted' accepting a first argument of type 'HostSettings' 
  could be found</strong> (are you missing a using directive or an assembly reference?)</li>
  </ul>
  
  <p>I have implement the interface 'ServiceControl' for the EventBroker class.</p>
  
  <pre><code>using Topshelf;
  namespace Sample
  {
    class Program
    {
      static void Main(string[] args)
      {
          HostFactory.Run(x =&gt;
          {
              x.Service&lt;EventBroker&gt;(s =&gt;
              {
                  s.ConstructUsing(name =&gt; new EventBroker());
                  s.WhenStarted((tc, hostControl) =&gt; tc.Start(hostControl));
                  s.WhenStopped(tc =&gt; tc.Stop());
              });
              x.RunAsLocalSystem();
  </code></pre>
  
  <p>Am I missing some an assembly reference or something else? I am using TopShelf v3.3.154.0. Without the 'hostControl' it is working fine.</p>