Azure / Azure/azure-functions-host
Fix DryIoC instance disposal setting (v3 only)
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
.NET Core DI should not dispose of instances that are passed in directly (i.e. not via a factory): https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.0#disposal-of-services
Yet our DryIoC configuration does dispose of these. This is a breaking change technically so we'll take it in v3 with something like:
```
container.UseInstance(descriptor.ServiceType, descriptor.ImplementationInstance, IfAlreadyRegistered.AppendNotKeyed, preventDisposal: true);
```
https://github.com/Azure/azure-functions-host/blob/v3.x/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/DryIocAdapter.cs#L161-L162
Contributor guide
Assessment
This issue has not been assessed yet.