Azure / Azure/azure-functions-host

Fix DryIoC instance disposal setting (v3 only)

Open
#5,298 0 comments 0 reactions 1 assignee Claimed by @brettsam View on GitHub
3.x
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.