-
Notifications
You must be signed in to change notification settings - Fork 337
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
Fix for DI registration not completing as expected #1386
Conversation
Signed-off-by: Whit Waldo <[email protected]>
…if user isn't utilizing ASP.NET Core from caller Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we might simplify the registration here a bit.
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1386 +/- ##
==========================================
+ Coverage 67.28% 71.05% +3.77%
==========================================
Files 174 188 +14
Lines 6025 6389 +364
Branches 671 697 +26
==========================================
+ Hits 4054 4540 +486
+ Misses 1802 1684 -118
+ Partials 169 165 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Whit Waldo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs fix for build break, but otherwise looks good. Wish we didn't have to create a services scope to pull dependencies from the container, but I don't see a way to defer it any further.
Signed-off-by: Whit Waldo <[email protected]>
Description
#1363 changed how clients registered themselves under the hood with DI to make for a more uniform process. With Workflow, this meant switching to a factory that attempts to load values from an injected IConfiguration.
Fix breakdown
IConfiguration
injection optional as the caller might not be using ASP.NET Core and thus may not have actually registered thisIHttpClientFactory
optional because while it's registered as part of usingAddWorkflowClient
, the caller might not be using that route (though they should)IConfiguration
andIHttpClientFactory
are injected to as those would be resolved and used as part of the registration of the durable task functionality. Unfortunately, two key steps were overlooked: The factory itself was never registered and the method performing the necessary additional registrations was never invoked because it lived in a DI registration that would never resolve to invoke it. Corrected this by registering the factory as intended and by creating a scoped provider during registration that resolves and invokes the method ensuring that the types are registered on theIServiceCollection
as intended.Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #1385
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: