Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible inconsistent behaviour #559

Closed
dvabuzyarov opened this issue Feb 17, 2023 · 2 comments
Closed

Possible inconsistent behaviour #559

dvabuzyarov opened this issue Feb 17, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dvabuzyarov
Copy link

 class Foo
        {
        }

        [TestMethod]
        public async Task ScopedServiceWithOpenResolutionScope()
        {
            var container = new Container();
            container.Register<Foo>(Reuse.Scoped, setup: Setup.With(openResolutionScope: true));
            var foo = container.Resolve<Foo>();
            Assert.IsNotNull(foo);
            var actual = container.Resolve<IEnumerable<Foo>>();
            Assert.AreEqual(1, actual.Count());
        }

the first resolve would be resolved normally, but container.Resolve<IEnumerable>() would return an empty collection.
If we remove Reuse.Scoped from the registration then collection contains one item.

Not obvious why the collection is empty. And if it is a bug.

@dadhi
Copy link
Owner

dadhi commented Feb 17, 2023

@dvabuzyarov
From the first glance looks like a bug.
Thanks for finding and for the test. I will check.

@dadhi dadhi self-assigned this Feb 17, 2023
@dadhi dadhi added the bug Something isn't working label Feb 17, 2023
@dadhi dadhi added this to the v5.3.4 milestone Feb 17, 2023
dadhi added a commit that referenced this issue Feb 18, 2023
@dadhi dadhi closed this as completed in 16b1084 Mar 13, 2023
@dadhi
Copy link
Owner

dadhi commented Mar 13, 2023

@dvabuzyarov The v5.3.4 containing the fix is out.

dadhi added a commit that referenced this issue Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants