title: Error CS0832 An expression tree may not contain an assignment operator
body: <pre><code>public class ConsoleRegistry : Registry
  {
      public ConsoleRegistry()
      {
          Scan(scan =&gt;
          {
              scan.TheCallingAssembly();
              scan.WithDefaultConventions();
          });
  
          For&lt;IJobFactory&gt;().Use&lt;StructureMapJobFactory&gt;();
  
          For&lt;ISchedulerFactory&gt;().Use(ctx =&gt; new StdSchedulerFactory());
          /*For&lt;IScheduler&gt;().Use(async delegate (IContext ctx)
          {
              var scheduler = await ctx.GetInstance&lt;ISchedulerFactory&gt;().GetScheduler();
              scheduler.JobFactory = ctx.GetInstance&lt;IJobFactory&gt;();
              return scheduler;
          });*/
  
          ForSingletonOf&lt;IScheduler&gt;().Use(ctx =&gt;
          {
              IScheduler scheduler = ctx.GetInstance&lt;ISchedulerFactory&gt;().GetScheduler().Result;
              scheduler.JobFactory = ctx.GetInstance&lt;IJobFactory&gt;();
              return scheduler;
          });
      }
  </code></pre>
  
  <p>What is wrong with last  <code>ForSingletonOf&lt;IScheduler&gt;()...</code>?</p>
  
  <p>I am getting this error</p>
  
  <blockquote>
    <p>Error CS0832 An expression tree may not contain an assignment operator</p>
  </blockquote>