-
Notifications
You must be signed in to change notification settings - Fork 31
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
Not working with Azure durable activity function #15
Comments
Do you have a repository you can share that reproduces the issue? Also validate that AuthenticationService has a parameter less constructor. That GenericApiService has a constructor that takes an IOAuthService. That AicGenericSdk has an constructor that takes an IGenericAPIService. And an EmailReminderService constructor that takes an IAicGenericSdk. If you don't want to have those constructors take interfaces as the parameters you will need to use builder.Register instead of RegisterType. |
All the ctors have proper parameters the way you described it. Here is the code link https://drive.google.com/file/d/1ZVO98BNwpJcX85iI0AP17MOD10_DVRVj/view?usp=sharing |
I am experiencing the same issue. (ServiceBus Queue Trigger) |
@goldytech It looks like the files have been removed from Google drive. Can you share them via GitHub? |
I didn't get to look at the source in detail, but I would classify the problem the OP is having as a limitation rather than a bug. The issue he's having would arise in the case of Durable functions more so because there is an increased likelihood of having the pattern class A { function x,y,z } (an orchestrator with multiple nested activity functions). The line |
Is there a workaround for this or will there be a change to allow this to work with Durable Functions? I was planning on using this for my Durable Functions (which I just started building), but obviously will need to find another solution if this one doesn't work with them. Thanks for providing this library! |
I have not been able to replicate this issue. I am currently using this package with durable functions and it is working as expected. Can you provide a sample project so that I can validate this issue? |
@vandersmissenc I haven't experienced an issue yet, but was assuming based on the OP that it didn't support Durable Functions. It's great to hear that that's not the case! I will give it a go. I was just trying to hedge before getting too far down a given path. Thanks again for a great solution! |
@vandersmissenc Just gave it a shot with my Durable Functions and I'm getting this: It's very possible i'm doing something incorrectly, but I followed the information from the ReadMe. Any help would be greatly appreciated! |
Is this an azure functions v1(.net framework) or v2(.net core)? Do you have either the steps to reproduce this or a reproduction repo I can check out? @tstone84 |
I have been able to replicate this issue locally. The problem appears to be that when the dependency injection config is created it registers for the class and it uses the class name as the key but when the individual method tries to resolve objects it uses the function name. If you only have one function in your class as the name is the same as the class name you would not see this behavior. I have made an update in the code and I am currently testing to verify it is resolved. I will keep you updated. Thanks for reporting the issue. |
… name used to resolved is registered at the time of creation instead of the time of injection.
I pushed the fix to nuget as a beta package. I will validate tomorrow that is resolves the issues when installed via nuget and if so I will push the full version and resolve this issue. |
@vandersmissenc Sorry, I wasn't able to respond last night. Thanks for looking into this and providing a fix! I'll pull down the pre-release version and give it a go. |
I was testing it this morning and if you create a fresh project and just install Microsoft.Azure.WebJobs.Extensions.DurableTask and AzureFunctions.Autofac then it works fine. There appears to be a conflict with another package because in my more complex solution I am seeing the method not found exception still. After you test it out let me know what you see and if possible the packages you are referencing in your project @tstone84 |
I have narrowed down the issue to Autofac. When I install my external package it installs Autofac 4.6.2 which then produces the method not found exception. I have tried upgrading to 4.8.1 but the same error occurs. I have the package right now relying on Autofac 4.2.1 since that is what Azure Functions Host uses but it seems like I have to set a hard restriction to that version. |
@vandersmissenc Yep, I'm still seeing the issue with the beta package. Originally, I was on 4.8.1 of Autofac and downgraded to 4.2.1 to try to resolve it after seeing some threads online about that issue, but didn't have any success. Again, I appreciate your quick response and you looking into this. Thx! |
Can you install 3.02-beta04 and see if you still have issues? I was able to remove my dependency on Autofac in my external package and I am no longer having issues with this version of the package. If you are still having issues can you provide a repo project I can check out? Thanks @tstone84 |
* Resolved #15 - Modified the way DI resolves objects so that the class name used to resolved is registered at the time of creation instead of the time of injection. * Removed auto generation of symbols
It appears that this issue has sprung up again. I am using Autofac 4.9.4, Autofac.Extensions.DependencyInjection 4.4.0 and AzureFunctions.Autofac 3.0.7. Was there a change that caused such a regression? |
You must use Autofac 4.2.1 due to restrictions in Azure Functions. Please try with that version and see if you still have problems. |
Hi,
I'm using this library in my Azure durable functions app.
I've defined my DIConfig as follows, and when the function app starts I can see the ctor of this class is called with my activity function class name as functionName parameter value.
Below is the code of my activity function , where I'm want to use DI
This is the error I'm getting
var emailReminderSvc = new EmailReminderService(new AicGenericSdk(new GenericAPIService(new AuthenticationService()),null ));
I hope I've registered dependencies in the right order.
Please help
The text was updated successfully, but these errors were encountered: