I had same issue in ASP.NET Core 2.1 web api but I have resolved issue by first installing the lower version of package & upgrading it version by version
Swashbuckle.AspNetCore 2.1.0 and then after I have upgraded the package version by version until I got the same error but I haven't received same error again even upgrading till swashbuckle.AspNetCore 5.0.0-rc2 & its now working properly with following configuration
Use namespace as following because Info class is not more used in latest version of swagger instead of OpenApiInfo class used to describe about swagger metadata
using Microsoft.OpenApi.Models;
then use the following code in Startup.cs class under the ConfigureServices method
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "www.compilemode.com", Version = "v1" });
});
This is very strange resolution but this is the only work around I have found after spending lots of time.