No constructor for type SwaggerGenerator can be instantiated using services from the service container and default values : <p>I'm trying to add Swagger to my project. The error received is as follows.</p>

<blockquote>
  <p>No constructor for type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' can be instantiated using services from the service container and default values.</p>
</blockquote>

<p>Since I haven't changed anything in Swagger binaries themselves, just installed the packages <em>Swashbuckle.AspNetCore</em> and <em>Swashbuckle.AspNetCore.Swagger</em> (both in version 4.0.1) I'm assuming that it's about the configuration. Following the suggestion <a href="https://stackoverflow.com/a/48539782/1525840">here</a>, I've set up the config shown below.</p>

<pre><code>services.AddSwaggerGen(_ =&gt;
{
  _.SwaggerDoc("v1", new Info { Version = "v1", Title = "My API" });
});

app.UseSwagger();
app.UseSwaggerUI(_ =&gt; { _.SwaggerEndpoint("/swagger/v1/swagger.json", "API docs"); });
</code></pre>

<p>I'm not sure if I'm missing a package, if one of those I have is the wrong version or if the set config I'm providing isn't sufficient. </p>
