Azure / Azure/azure-functions-core-tools

Make workload Configure registration transactional

Open
#4,948 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

Today `WorkloadRegistration.RegisterWorkloadsAsync` calls each workload's `Configure(builder)` directly against the live `IServiceCollection`. If a workload registers services and then throws, the partial registrations are left in DI. We isolate the failure (warn and continue) but not its side effects.

Follow-up from #4941 (Fabio review).

**Acceptance:**
- A workload's `Configure` either fully applies or leaves the host `IServiceCollection` unchanged.
- Likely approach: stage Configure into a child `IServiceCollection`, copy into the real one only on success.
- Add a regression test for a workload that throws after registering a service.

**Out of scope:** rolling back side effects beyond DI registrations (file writes, etc.) — workloads must not do those in Configure.

Contributor guide

Open the contributing guide

Research direction

Start at WorkloadRegistration.RegisterWorkloadsAsync and trace how each workload's Configure(builder) writes to the live IServiceCollection. Add the regression test for a workload that registers a service and then throws; done means the failure is warned and continued while the host IServiceCollection remains unchanged, and successful configuration is applied.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.