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

Registration overrides previously registered type #35

Closed
wildcatxxd opened this issue Nov 13, 2017 · 2 comments
Closed

Registration overrides previously registered type #35

wildcatxxd opened this issue Nov 13, 2017 · 2 comments
Assignees
Labels
release Release branch
Milestone

Comments

@wildcatxxd
Copy link

wildcatxxd commented Nov 13, 2017

Subsequent registrations affecting previously registered mapped types:

[TestMethod]
public void ConflictTypeMapping()
{
    IUnityContainer container = new UnityContainer();

    container.RegisterType<ILogger, MockLogger>(new ContainerControlledLifetimeManager());
    ILogger logger = container.Resolve<ILogger>();

    Assert.IsNotNull(logger);
    Assert.AreSame(container.Resolve<ILogger>(), logger);

    container.RegisterType<MockLogger>(new TransientLifetimeManager());

    Assert.AreSame(container.Resolve<ILogger>(), logger);
}

The last assertion is failing.

@ENikS ENikS changed the title New Issue New Issue got it Nov 13, 2017
@ENikS ENikS changed the title New Issue got it Registration overrides previously registered type Nov 13, 2017
@ENikS ENikS added the bug label Nov 13, 2017
@ENikS ENikS self-assigned this Nov 13, 2017
@ENikS ENikS added this to the 5.2.1 milestone Nov 13, 2017
@ENikS
Copy link
Contributor

ENikS commented Nov 13, 2017

Must be the longest running bug in Unity. Almost a feature by now.

@ENikS
Copy link
Contributor

ENikS commented Nov 14, 2017

Fixed in:
cb419d5
013060b
475d8ed
7ea7387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Release branch
Projects
None yet
Development

No branches or pull requests

2 participants