Closed dvabuzyarov closed 1 year ago
@dvabuzyarov Hi. Thanks for finding and the analysis. I will take a look soon.
Here is a test to reproduce the issue
public class Disposable : IDisposable
{
public void Dispose()
{
}
}
[TestMethod]
public void NullReferenceException()
{
using var container = new Container();
container.Register<IDisposable, Disposable>(Reuse.ScopedOrSingleton);
var scope = container.OpenScope() as IContainer;
var child = scope.CreateChild();
child.Resolve<IDisposable>();
}
@dvabuzyarov Appreciated :)
@dvabuzyarov The fix is published to NuGet with DryIoc v5.3.2
I am getting null reference exception for a child container when trying to resolve a disposable service. The exception has happened in this code:
The child container is created by this code:
Due debugging I figured out that this code is invoked:
Dropping the disposables create an empty map. In contrast in other places I can see a different code:
instead of
like in this code:
DryIoc.dll: Version=5.3.1 .net core 6