Swashbuckle.AspNetCore
Swashbuckle.AspNetCore copied to clipboard
System.InvalidOperationException for XmlCommentsParameterFilter
I am having the following exception throw after upgrading to .Net8: System.InvalidOperationException: A suitable constructor for type 'Swashbuckle.AspNetCore.SwaggerGen.XmlCommentsParameterFilter' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.
Any initial thoughts or suggested fixes would be appreciated! Using Swashbuckle.AspNetCore 6.5.0 Using Swashbuckle.AspNetCore.SwaggerUI 6.5.0 Using Swashbuckle.AspNetCore.SwaggerGen 6.5.0 Using Swashbuckle.AspNetCore.Swagger 6.5.0
I am also facing the same when I am publishing this on IIS. in local its working fine.
Have you tested with https://github.com/Havunen/DotSwashbuckle https://www.nuget.org/packages/DotSwashbuckle.AspNetCore
It's not obvious to me at first glance why this wouldn't be working.
The activation call comes from here:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/830c5a6f7468bce6b716d84c034a258dbbcbfe98/src/Swashbuckle.AspNetCore.SwaggerGen/DependencyInjection/ConfigureSwaggerGeneratorOptions.cs#L76-L77
The constructor receives a single XPathDocument
:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/830c5a6f7468bce6b716d84c034a258dbbcbfe98/src/Swashbuckle.AspNetCore.SwaggerGen/XmlComments/XmlCommentsParameterFilter.cs#L11
Which is provided as the argument here:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/830c5a6f7468bce6b716d84c034a258dbbcbfe98/src/Swashbuckle.AspNetCore.SwaggerGen/DependencyInjection/SwaggerGenOptionsExtensions.cs#L433
It might be related to this breaking change in .NET 8.
Having updated Swashbuckle to target net8.0
, I can't replicate this with our test suite.
Please provide a minimal reproducible example as a GitHub repository that demonstrates the issue you're experiencing so we can look into this further.
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.
This issue was closed because it has been inactive for 14 days since being marked as stale.