-
Notifications
You must be signed in to change notification settings - Fork 201
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
Azure function Publish not creating Startup class entry in extensions.json #972
Comments
There is a workaround for this issues posted in a different thread: Azure/azure-functions-host#3386 (comment) |
Some of those issues are known limitations of the product at the moment. We are working on first class support for customer facing DI capabilities in Azure Functions, which will come with a full set of documentation, including services you can depend on and official guidance. In the meantime, use of those undocumented patterns may be fragile in Azure Functions, which is something to be aware of. Updates on this will be landing very soon. |
@fabiocav can you give an estimation on when the DI capabilities will be available in Azure Functions? We're using Boris Wilhelms implementation as well, and the startup entry no longer being added to the extensions.json when publishing is a bit annoying. Being able to use an out of the box solution for DI would be preferable therefore. |
This workaround no longer works with Microsoft.NET.Sdk.Functions 1.0.24 and netcoreapp2.1 function apps. An empty extensions.json file is generated. I found another workaround - If the startup class is contained contained in a separate assembly referenced by the azure function assembly then the extensions.json is created correctly. |
@fabiocav Feel free to reach out to me by internal Microsoft chat and I can show you how it fails live. And we are not using anything fragile, just straight Azure Functions. |
I seem to be able to reproduce this reliably (happy to share if required). Targetting netcoreapp2.1 extensions.json is empty, changing project to target netstandard2.0 it's created correctly. The fix suggested by @stijnbrouwers works for me but the workaround in #3386 doesn't. Initial testing shows this is also the case targetting netcoreapp2.2. |
Thank you for all the feedback here. The issue is well understood, but unfortunately, due to higher priority items (including design and implementation work on the official extensibility and DI model for Functions), it hasn't been addressed yet. We'll keep updating this as progress is made and will have this assigned to a sprint milestone when the work is assigned. |
We're working on this now and work is being tracked here. I'm going to close this issue just so we don't have too many duplicate issues across repos. Progress is being made though (was on a few emails about progress today 😄) |
This appears to be an issue again now that V3 of the function runtime has been recently promoted out of preview. |
We are developing a set of Azure functions for our new product. We are using dependency injection for our project following the strategy , mentioned in the following article
https://blog.wille-zone.de/post/azure-functions-dependency-injection/
and registered the extension in Startup.cs
This is working fine in the local development environment. However when we tried to publish it azure , the azure functions runtime was not detecting the injected dependencies . We found a similiar problem in the following sctak over flow.com post
https://stackoverflow.com/questions/52123538/iextensionconfigprovider-not-initializing-or-binding-with-microsoft-azure-webjob
We made changes as per their recommendation in the accepted answer. As per this
"In C# the SDK 1.0.19 looks at build time for classes attributed with WebJobsStartup assembly attribute in the current function project or any dependency (ProjectReference or PackageReference) of the current project, and generates the corresponding extensions.json file."
However we ran in to strange problem, When we do a release build , the startup class entry is created in the extensions.json
{
"extensions":[
{ "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"},
{ "name": "Startup", "typeName":"AAA.BBBB.Functions.Startup, AAA.BBB.Functions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}
]
}
however when we try to publish , the startup class entry is NOT created in the extensions.json
{
"extensions":[
{ "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
]
}
We are stumped and do not know what is the problem
We have created a issue for this in stackoverflow -
The text was updated successfully, but these errors were encountered: