Microsoft.Extensions.ApiDescription.Server Unable to find service type 'Microsoft.Extensions.ApiDescriptions.IDocumentProvider' in dependency injection container. #57939
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
feature-openapi
Needs: Author Feedback
The author of this issue needs to respond in order for us to continue investigating this issue.
Is there an existing issue for this?
Describe the bug
I ran into this bug while trying to use
Microsoft.Extensions.ApiDescription.Server
for openapi file generation.Given this code (see repro for
.sln
)and dependencies
the generation during build fails on resolving the
IDocumentProvider
, although it is registered usingAddOpenApi
. Whenever I inlineMethodThatBreaksBuild
generation works as expected. Similar behavior occurs forMapOpenApi
and conditional execution.Expected Behavior
I expect an
Example.json
to be generated during build, without any errors.Steps To Reproduce
Build this solution
Example.zip
Exceptions (if any)
dotnet build Example.sln
.NET Version
9.0.100-rc.1.24452.12
Anything else?
No response
The text was updated successfully, but these errors were encountered: