Binding fails with target frameworks netcoreapp 2.1 and 2.2
This package works fine when I target netcoreapp2.0. But when I target anything above that I get
Microsoft.Azure.WebJobs.Host: Error indexing method 'UploadImage'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'cosmosDbClient' to type ICosmosDbClient. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
I have exactly the same issue
check if the package you deploy have non-empty extensions.json file. If not, update functions sdk to 1.0.26.
I tried this but still no extensions.json, and it still failed like before. See this gist for some example code
Do I need to create my own extensions.json that references the DI extension?
no, the extensions.json should be created automatically by sdk. please share also the csproj file.
You can also check my project for reference: https://github.com/miqm/playground
@miqm Thanks for the example I will look at it, I updated the gist with my csproj
Looks like you're using 1.0.24 - you should be on sdk 1.0.26 - have you tried upgrading? I know it doesn't work under 1.0.26
I duplicated your setup in the example, and the startup code runs fine but the binding to the [Inject] attribute still failes with 'Microsoft.Extensions.DependencyInjection.Abstractions: Unable to resolve service for type 'ObjectDetection.Services.ICosmosDbClient' while attempting to activate 'ObjectDetection.UploadImage'.' Hmmm, any idea here?
Share your code if possible.
Not sure if this is will work, but try separate code with extensions into a library that function app will depend upon.