title: .Net-Core 2.2 MassTransit.ConfigurationException: The state machine was not properly configured
body: <p>Newbie question - what am I missing?  Are there any dotnetcore 2.2 Saga examples available?</p>
  
  <p>I have a basic end to end system working OK with messages flowing across containers in docker-compose, but adding a Saga seems to be a challenge - </p>
  
  <p>Q. Am I missing a scheduler dependency?  In MassTransit 5.5.5, cfg.UseInMemoryMessageScheduler(); doesn't compile.</p>
  
  <p>Something odd was going on, I had to mark my state machine explicitly as ISaga </p>
  
  <p>MassTransit.ConfigurationException: Failed to create the state machine connector for Model.WorkflowExecutionStateMachine ---> MassTransit.ConfigurationException: The state machine was not properly configured:
  workflowapi_1  | [Failure] ExecutingTask was not specified</p>
  
  <pre><code>
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
  
          // Register MassTransit
          services.AddMassTransit(x =&gt;
          {
              x.AddConsumer&lt;WorkflowTaskConsumer&gt;();
  
              // required?
              x.AddSaga&lt;WorkflowExecutionSaga&gt;();
  
              x.AddBus(provider =&gt; Bus.Factory.CreateUsingRabbitMq(cfg =&gt;
              {
                  var rabbitMQHostName = $"rabbitmq://{configuration["RabbitMQHostName"]}";
  
                  Console.Out.WriteLineAsync($"Starting Workflow Receiver... {rabbitMQHostName}/{QueueNames.ExeuteWorkflowTaskQueue}");
  
                  var host = cfg.Host(new Uri(rabbitMQHostName), hostConfig =&gt;
                  {
                      hostConfig.Username("guest");
                      hostConfig.Password("guest");
                  });
  
                  // A basic message works OK
                  cfg.ReceiveEndpoint(host, QueueNames.ExeuteWorkflowTaskQueue, ep =&gt;
                  {
                      ep.PrefetchCount = 1;
                      ep.UseMessageRetry(mr =&gt; mr.Interval(1000, 2));
                      ep.ConfigureConsumer&lt;WorkflowTaskConsumer&gt;(provider);
                  });
  
                  // Doesn't like this
                  cfg.ReceiveEndpoint(host, QueueNames.WorkflowStateMachineSagaQueueName, ep =&gt;
                  {
                      ep.PrefetchCount = 1;
                      ep.UseMessageRetry(mr =&gt; mr.Interval(1000, 2));
                      ep.StateMachineSaga(new WorkflowExecutionSaga(), new InMemorySagaRepository&lt;WorkflowExecutionStateMachine&gt;());
                  });
              }));
  
              cfg.UseInMemoryMessageScheduler(); // doesn't compile!
          });
      }
  
  </code></pre>
  
  <p>Bus is started as follows - </p>
  
  <pre><code>
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              // The default HSTS value is 30 days. You may want to change this for production scenarios, 
              // see https://aka.ms/aspnetcore-hsts.
              app.UseHsts();
          }
  
          app.UseMvc();
  
          var bus = app.ApplicationServices.GetService&lt;IBusControl&gt;();
          var busHandle = TaskUtil.Await(() =&gt;
          {
              return bus.StartAsync();
          });
  
          lifetime.ApplicationStopping.Register(() =&gt;
          {
              busHandle.Stop();
          });
      }
  
  </code></pre>
  
  <p>Exception details are</p>
  
  <p>Unhandled Exception: MassTransit.ConfigurationException: Failed to create the state machine connector for Rapid.Workflow.Api.Model.WorkflowExecutionStateMachine ---> MassTransit.ConfigurationException: The state machine was not properly configured:
  workflowapi_1  | [Failure] ExecutingTask was not specified
  workflowapi_1  |    at Automatonymous.StateMachineConfigurationResult.CompileResults(IEnumerable<code>1 results)
  workflowapi_1  |    at Automatonymous.StateMachineConnectors.StateMachineConnector</code>1.StateMachineEvents()+MoveNext()
  workflowapi_1  |    at System.Collections.Generic.List<code>1.AddEnumerable(IEnumerable</code>1 enumerable)
  workflowapi_1  |    at System.Linq.Enumerable.ToList[TSource](IEnumerable<code>1 source)
  workflowapi_1  |    at Automatonymous.StateMachineConnectors.StateMachineConnector</code>1..ctor(SagaStateMachine<code>1 stateMachine)
  workflowapi_1  |    --- End of inner exception stack trace ---
  workflowapi_1  |    at Automatonymous.StateMachineConnectors.StateMachineConnector</code>1..ctor(SagaStateMachine<code>1 stateMachine)
  workflowapi_1  |    at Automatonymous.SagaConfigurators.StateMachineSagaConfigurator</code>1..ctor(SagaStateMachine<code>1 stateMachine, ISagaRepository</code>1 repository, ISagaConfigurationObserver observer)
  workflowapi_1  |    at MassTransit.AutomatonymousReceiveEndpointExtensions.StateMachineSaga[TInstance](IReceiveEndpointConfigurator configurator, SagaStateMachine<code>1 stateMachine, ISagaRepository</code>1 repository, Action`1 configure)
  workflowapi_1  |    at Rapid.Workflow.Api.Startup.&lt;>c.b__2_5(IRabbitMqReceiveEndpointConfigurator ep) in /src/Workflow.Api/Startup.cs:line 74</p>
  
  <p>Dependencies are </p>
  
  <pre><code>&lt;PackageReference Include="Automatonymous" Version="4.1.6" /&gt;
  &lt;PackageReference Include="MassTransit" Version="5.5.5" /&gt;
  &lt;PackageReference Include="MassTransit.RabbitMQ" Version="5.5.5" /&gt;
  &lt;PackageReference Include="MassTransit.AspNetCore" Version="5.5.5" /&gt;
  &lt;PackageReference Include="MassTransit.Automatonymous" Version="5.5.5" /&gt; 
  &lt;PackageReference Include="MassTransit.Extensions.DependencyInjection" Version="5.5.5" /&gt;
  &lt;PackageReference Include="Newtonsoft.Json" Version="12.0.2" /&gt;
  </code></pre>
  
  <p>Thanks for any tips or ideas - </p>