title: c# Dependency Injection cannot convert lambda to intended delegate
body: <p>Cannot convert lambda to intended delegate because some of the return types in the block  are not implicitly converted to the delegate return type.</p>
  
  <p>without DI</p>
  
  <pre><code>var chromeDriverService = ChromeDriverService.CreateDefaultService();
  var chromeOptions = new ChromeOptions();
  chromeOptions.AddArguments(new List&lt;string&gt;() { "headless" });
  
  ChromeDriver driver = new ChromeDriver(chromeDriverService, chromeOptions);
  </code></pre>
  
  <p>with DI in Startup.cs</p>
  
  <pre><code> services.AddScoped&lt;ChromeDriverService&gt;((serviceProvider =&gt;
   {
     return  ChromeDriverService.CreateDefaultService();
   }));
   //**** errors here*****
   services.AddScoped&lt;ChromeOptions&gt;((serviceProvider =&gt;
   { return new ChromeOptions().AddArguments(new List&lt;string&gt;() { "headless" }); }));
   // errors here******
   // how would i pass the driver service &amp; options 
   services.AddScoped&lt;ChromeDriver&gt;(
   (serviceProvider =&gt;
   {
     return new ChromeDriver(chromeDriverService,chromeOptions);
   }));
  </code></pre>
  
  <p>how do i make it so it's convertible and pass the correct options to the chromeDriver ?</p>