title: AggregateException: Some services are not able to be constructed
body: <p>I have a project in .NET 5.0, everything worked fine - build, execute, just work - until 10th April.</p>
  <p>Now I have a lot of error with registering services.</p>
  <pre><code>Unhandled exception. System.AggregateException: Some services are not able to be constructed 
  (Error while validating the service descriptor 'ServiceType: AService.DataAccess.MyDbContext 
  Lifetime: Scoped ImplementationType: AService.DataAccess.MyDbContext': Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbSet`1[AService.Domain.Entities.B.B]' while 
  attempting to activate 'AService.DataAccess.MyDbContext'.) (Error while validating the 
  service descriptor 'ServiceType: 
  MediatR.IRequestHandler`2[AService.Api.Queries.B.GetAllQuery, 
  System.Collections.Generic.IEnumerable`1[AService.Api.Queries.B.Dtos.BDto]] 
  Lifetime: Transient ImplementationType: 
  AService.Queries.B.GetAllQueryHandler': Unable to resolve service for type 
  'Microsoft.EntityFrameworkCore.DbSet`1[AService.Domain.Entities.B.B]' while 
  attempting to activate 'AService.DataAccess.MyDbContext'.)
  </code></pre>
  <p>I short - every repository, every service, everything that needs to be registered and IS registered in <code>Startup.cs</code> as below:</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddControllers().AddNewtonsoftJson(options =&gt; 
          options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);
  
      services.AddDbContext&lt;MyDbContext&gt;();
      
      services.AddStackExchangeRedisExtensions&lt;NewtonsoftSerializer&gt;((options) =&gt; 
          Configuration.GetSection(&quot;Redis&quot;).Get&lt;RedisConfiguration&gt;());
      
      services.AddMediatR(Assembly.GetExecutingAssembly());
  
      services.AddTransient&lt;IARepository, ARepository&gt;();
      services.AddTransient&lt;IBRepository, BRepository&gt;();
      services.AddTransient&lt;ICRepository, CRepository&gt;();
  
      services.AddSwaggerGen(c =&gt;
      {
          c.SwaggerDoc(&quot;v1&quot;, new OpenApiInfo {Title = &quot;Service API&quot;, Version = &quot;v1.0&quot;});
      });
  
  }
  
  
  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  {
      if (env.IsDevelopment())
      {
          app.UseDeveloperExceptionPage();
      }
  
      app.UseStaticFiles();
      app.UseRouting();
      app.UseCors();
  
      app.UseEndpoints(endpoints =&gt;
      {
          endpoints.MapControllers();
      });
  
      app.UseSwagger();
  
      app.UseSwaggerUI(c =&gt;
      {
          c.SwaggerEndpoint(&quot;/swagger/v1/swagger.json&quot;, &quot;Menu Service API v1.0&quot;);
      });
  }
  </code></pre>
  <p><code>Program.cs</code></p>
  <pre><code>public class Program
  {
      public static void Main(string[] args)
      {
          CreateHostBuilder(args).Build().Run();
      }
  
      public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
          Host.CreateDefaultBuilder(args)
              .ConfigureWebHostDefaults(webBuilder =&gt; { webBuilder.UseStartup&lt;Startup&gt;(); });
  }
  </code></pre>
  <p>I don't know is it a problem with Rider version (I program on macos). When I debug I have the following error message:</p>
  <blockquote>
  <p>An IL variable is not available at the current native IP. (0x80131304). The error code is CORDBG_E_IL_VAR_NOT_AVAILABLE, or 0x80131304.</p>
  </blockquote>
  <p>Have anybody an idea what can cause that error? As I said at the beginning, everything worked fine few days before.</p>
  <p>EDIT - added MyDbContext:</p>
  <pre><code>public class MyDbContext : DbContext
  {
      public MyDbContext(DbSet&lt;A&gt; a, DbSet&lt;B&gt; b, DbSet&lt;C&gt; c)
      {
          As = a;
          Bs = b;
          Cs = c;
      }
  
      public DbSet&lt;A&gt; As { get; }
      public DbSet&lt;B&gt; Bs { get; }
      public DbSet&lt;C&gt; Cs { get; }
  
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          optionsBuilder.UseSqlServer(@&quot;Server=localhost;Database=my-db;User=user;Password=password&quot;);
      }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;B&gt;()
              .HasOne(mi =&gt; mi.A)
              .WithMany(m =&gt; m.Bs)
              .HasForeignKey(mi =&gt; mi.AId);
  
          modelBuilder.Entity&lt;B&gt;()
              .Property(mi =&gt; mi.Xs)
              .HasConversion(
                  a =&gt; string.Join(',', a),
                  a =&gt; a.Split(',', StringSplitOptions.RemoveEmptyEntries));
      }
  }
  </code></pre>