Comments (11)
@dadhi Set milestone 3.1.0?
from dryioc.
@kirodge, Thanks for posting.
Yes, it is probably a cache, but it should not be there because of arguments. I will check.
from dryioc.
Thanks, I created a PR for testing the issue
from dryioc.
The fix is available in DryIoc v3.1.0-preview-03
from dryioc.
Thanks a lot for the quick fix @dadhi.
The issue is resolved in DryIoc v3.1.0-preview-03
from dryioc.
yep.
from dryioc.
I would set milestone myself, if I was able to.
Any due date for 3.1?
from dryioc.
It will be a v4. Currently in a preview. Soonish I hope.
from dryioc.
This issue is a show stopper for my project as well.
Any timelines for v4 ?
Maybe it could be back-ported to 3.1 in the mean time ?
Thanks.
from dryioc.
V4 will be here soon. If you are watching the repo, you see that I am closing the last bugs.
Regarding back ports, I am open for PRs.
from dryioc.
EDIT: Actually, it appears to be another issue. Please see #105.
It appears that the issue is still there in v4.0.1.
I've prepared the tiniest use case I could come up with and placed it in a .NET fiddle.
Here's the code, for completeness:
// @nuget: DryIoc.dll -Version 4.0.1
using System;
using DryIoc;
public class Program
{
public static void Main()
{
using (var container = new Container(ConfigureContainer))
{
container.Register<IAlpha, Alpha>();
container.Register<IBravo, Bravo>();
using (var scope = container.OpenScope())
{
Console.WriteLine("--- Scope #1");
scope.ResolveNamed<IAlpha>("Alice");
scope.ResolveNamed<IBravo>("Bob");
}
using (var scope = container.OpenScope())
{
Console.WriteLine("--- Scope #2");
// I would expect the Container to throw on the following line,
// because it doesn't know how to create an instance of Alpha.
// Instead, it happily creates an Alpha named Bob!
scope.ResolveNamed<IBravo>("Bob");
}
}
}
static Rules ConfigureContainer(Rules rules)
{
return rules
.With(FactoryMethod.ConstructorWithResolvableArguments)
.WithDefaultReuse(Reuse.ScopedOrSingleton);
}
}
public static class ResolverExtensions
{
public static TService ResolveNamed<TService>(this IResolver @this, string name)
{
return @this.Resolve<TService>(args: new object[] { name });
}
}
public abstract class Service
{
protected Service(string name)
{
Console.WriteLine("This is an instance of {0} called {1}.", GetType().Name, name);
}
}
public interface IAlpha { }
public interface IBravo { }
public sealed class Alpha : Service, IAlpha
{
public Alpha(string name)
: base(name) { }
}
public sealed class Bravo : Service, IBravo
{
public Bravo(string name, IAlpha alpha)
: base(name) { }
}
from dryioc.
Related Issues (20)
- Consistent behavior of a faulty singleton HOT 2
- FactoryType is not forwarded in the RegisterMapping<TService, TRegisteredService> method HOT 1
- IDisposable dependencies does not get disposed when web request ends HOT 5
- Add the HotUsedInstance for fast access to skip all the resolution steps
- Conditional registrations
- MS DI AddKeyed... variant registration fails HOT 8
- Check for mismatch lifestyle scope between service and dependencies HOT 7
- troubleshooting sudden ArgumentException at TryInterpretSingletonAndUnwrapContainerException HOT 3
- [question/feature request] keyed services in delegate resolution HOT 8
- Use default constructor if no registration is found
- Add the global test option to run all tests with WithoutUseInterpretation option
- Feature Request: add global .WithDefaultServiceTypeCondition(Func<Type, bool> condition) method HOT 1
- System.NullReferenceException: Object reference not set to an instance of an object HOT 5
- 'WithConcreteTypeDynamicRegistrations' results in unintended instantiation HOT 3
- Exception: Window already exists HOT 4
- Resolve enforces passed arguments to be used (and fails because of it) HOT 4
- Type registered with Singleton instantiating multiple times
- [BUG] Resolve<> crashes with the misleading, casting-related Exception when class is also registered using RegisterInitializer HOT 5
- Virus Warning with DryIoc Version 5.4.3 on Some Antivirus Software HOT 1
- Resolving func-wrapper when having circular-dependency throws RecursiveDependencyDetected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dryioc.