We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
After upgrading my project to v5.9.7 I experience StackOverflowExceptions when executing code that makes use of DependencyOverrides.
Note this is somewhat related to this issue logged in abstractions, but I think this may be a distinct issue.
See this repo that replicates the problem
public class Tests { [TestMethod] public void ShouldResolveAlternativeImplementationWhenUsingOverride() { // arrange var target = new UnityContainer(); target .RegisterType<IController, TheController>() .RegisterType<IMessageProvider, DefaultMessageProvider>() .RegisterType<IMessageProvider, AlternativeMessageProvider>(nameof(AlternativeMessageProvider)) ; var resolvedParameter = new ResolvedParameter<IMessageProvider>( nameof(AlternativeMessageProvider)); var dependencyOverride = new DependencyOverride<IMessageProvider>(resolvedParameter); // act var actual = target.Resolve<IController>(dependencyOverride); // <-- Throws StackOverflowException // assert Assert.AreEqual(actual.GetMessage(), "Goodbye cruel world!"); } } public interface IController { string GetMessage(); } public class TheController : IController { private readonly IMessageProvider _messageProvider; public TheController(IMessageProvider messageProvider) { _messageProvider = messageProvider; } public string GetMessage() { return _messageProvider.CalculateMessage(); } } public interface IMessageProvider { string CalculateMessage(); } class DefaultMessageProvider : IMessageProvider { public string CalculateMessage() { return "Hello World"; } } class AlternativeMessageProvider : IMessageProvider { public string CalculateMessage() { return "Goodbye cruel world!"; } }
The text was updated successfully, but these errors were encountered:
More tests (#144)
5ad54bf
ENikS
No branches or pull requests
Description
After upgrading my project to v5.9.7 I experience StackOverflowExceptions when executing code that makes use of DependencyOverrides.
Note this is somewhat related to this issue logged in abstractions, but I think this may be a distinct issue.
To Reproduce
See this repo that replicates the problem
The text was updated successfully, but these errors were encountered: