Azure / Azure/azure-functions-host
Add IServiceProvider to dependency validator
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
#### What problem would the feature you're requesting solve? Please describe.
Customers are registering IServiceProvider, and this is leading to unexpected behavior and startup issues.
#### Describe the solution you'd like
Add validation logic such that customers running on:
- v3: receive a clear warning that this registration might cause startup issues.
- v4: receive a clear error stating that they cannot register IServiceProvider.
[Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection#overriding-host-services) stating that functions doesn't support registration of host services already exists, and adding this layer of validation would ensure more clear errors indicating the problem.
#### Additional context
[DependencyValidator.cs](https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/DependencyInjection/DependencyValidator/DependencyValidator.cs#L30)
Contributor guide
Research direction
Start with src/WebJobs.Script.WebHost/DependencyInjection/DependencyValidator/DependencyValidator.cs at the referenced validation logic, then review the linked dependency-injection documentation for the host-service restriction. Determine how registrations of IServiceProvider are detected for v3 and v4. Done means v3 produces a clear warning and v4 produces a clear error stating that IServiceProvider cannot be registered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100