azure-functions-openapi-extension: BUG: Object reference not set.... .net 6 functions
Describe the issue When using this library in a new Azure Functions project (.net6, runtime V4) it works locally but not on Azure.
Object reference not set to an instance of an object.
To Reproduce
- Create new Azure functions project with .Net 6
- Add a new project without dependencies and reference it in your functions project
- Deploy to Azure
- Call
/api/swagger.json
Expected behavior I expect that swagger would just work like it does locally.
Screenshots

Environment (please complete the following information, if applicable):
- OS: Azure (Windows Service plan,
FUNCTIONS_EXTENSION_VERSION=~4,FUNCTIONS_WORKER_RUNTIME=dotnet) - Version
1.0.0(nuget)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 16 (5 by maintainers)
Hi @justinyoo - I can confirm that even after updating to v1.3.0 of the
Microsoft.Azure.WebJobs.Extensions.OpenApipackage I’m still seeing the following error when my function app references anet6.0class library which has no dependencies:I had the same problem and I solved it based on an old issue. Where the person indicated that all projects on their system must have at least one dependency. I added a random package to a project of mine that didn’t have any and it started working.
Since the comments above provided a work-around, this is what triggers the error:
Bizarre issue. The “at least one dependency per project” workaround worked for me as well.
I am having the exact same issue (.net6, runtime V4). It works just fine locally but not on Azure.