-
Notifications
You must be signed in to change notification settings - Fork 199
BUG: Object reference not set.... .net 6 functions #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am having the exact same issue (.net6, runtime V4). It works just fine locally but not on Azure. |
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. |
Bizarre issue. The "at least one dependency per project" workaround worked for me as well. |
I can confirm that this hack fixes my problem, but I think the need for at least one dependency in each project, should be treated as a BUG. Because it really is a strange thing to require. I just used this package because I was already using the dependency injection anyways. <ItemGroup>
<!-- Hack to fix OpenApi UI and Json in Azure, requiring at least one dependency for each project. -->
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup> |
@PedroLucasSilva do you maybe have the link to that other issue, seems like we need to reference it here. |
@justinyoo But why does it work locally? |
@svrooij I have no idea. I haven't got such an experience at all. I use exactly the same settings (.NET 6, v4, in-proc). Would you please tell me how to reproduce the issue? |
Since the comments above provided a work-around, this is what triggers the error:
|
@svrooij Alright. I tried to reproduce on my end, but... my app is still working. Here's my app structure: https://github.com/fitability/fitability-api/tree/main/users
They are buit and deployed to Azure through GitHub Actions, and it's working. |
I wanted to make a quick note to say that we've just run into this issue when running locally - in our setup we've got an Azure function project referencing a "shared" Using the hack suggested by @svrooij - adding the |
I changed the and updated the package version to v1.3.0. It works OK both locally and Azure on my end. @svrooij @chris-parker-bliss Would you please try on your end? |
@justinyoo it happens when there are no dependencies in the class library and it is set to |
That's exactly what I did. The |
Hi @justinyoo - I can confirm that even after updating to v1.3.0 of the
|
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
/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):
FUNCTIONS_EXTENSION_VERSION
=~4
,FUNCTIONS_WORKER_RUNTIME
=dotnet
)1.0.0
(nuget)The text was updated successfully, but these errors were encountered: