Azure / azure-functions-vs-build-sdk

MSBuild task for Azure Functions
MIT License
99 stars 66 forks source link

Errors after upgrading to 1.0.19 #232

Open igorgnedish opened 6 years ago

igorgnedish commented 6 years ago

Hi All,

after functions SDK has been updated to 1.0.19 (with corresponding packages like Microsoft.Azure.WebJobs and Microsoft.Azure.WebJobs.Extensions to 3.0.0-beta8 as mentioned here: Azure/app-service-announcements#129).

in the project I have had a custom binding implemented, I was using this approach: https://github.com/Azure/azure-webjobs-sdk/wiki/Creating-custom-input-and-output-bindings

Noticed two things that does not work anymore:

in IExtensionConfigProvider implementation ExtensionConfigContext does not contain Config property anymore. So it's not clear how can I resolve IExtensionRegistry in order to registed 'global' filter in IExtensionConfigProvider implementation I registered BindingRule and Binded in to input Note that ExtensionConfigProvider is located in different assembly (not in the functions' one). Also this code was working before SDK update occured.

So, after I run the project I can see a bunch of a following errors: Error indexing method 'FunctionClass.MethodName' [8/31/2018 7:40:28 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'FunctionClass.MethodName'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'bindableParameterName' to type ParameterType. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

czitelli commented 6 years ago

Hi, I have the same error injection my custom ExtensionProvider on Functions V2 SDK 1.0.19. (Before this update It's been working well) The exceptions message is: FunctionClass.MethodName'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'bindableParameterName' to type ParameterType. Make sure the parameter Type is supported by the binding.

ielcoro commented 6 years ago

About IExtensionConfigProvider, I posted how it's done now with te 1.0.19 changes here.

igorgnedish commented 6 years ago

also here's a dup of the this. maybe will find some useful info there: https://github.com/Azure/azure-functions-core-tools/issues/684

czitelli commented 6 years ago

I've the solution, @ielcoro has the thruth, you need an Startup Class like this

using My.Functions;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;
using Microsoft.Extensions.DependencyInjection;

[assembly: WebJobsStartup(typeof(WebJobsExtensionStartup ))]
namespace My.Functions
{
    public class WebJobsExtensionStartup : IWebJobsStartup
    {
        public void Configure(IWebJobsBuilder builder)
        {
            builder.AddExtension<InjectionConfiguration>();
            // InjectionConfiguration must be implement IExtensionConfigProvider like the old version
        }
    } 
}

With this class, you are configuring your custom injection. Note that the startup class (WebJobsExtensionStartup) is the same reference for assembly attribute Good luck!!