Comments (4)
If it's not supported, it should throw an exception. It was supported before, so this is a silent breaking change. The current behavior isn't even reasonable, since the call succeeds, but the InjectionFactory is simply dropped from the registration.
from abstractions.
It was discussed here
from abstractions.
The workaround for this problem is to split up the interface and type registrations. So, the above example would become:
container.RegisterType(new InjectionFactory(cont => FooFactory.Create()));
container.RegisterType<IFoo, Foo>();
I think this is a pretty dangerous bug. If Foo had a public constructor this would have been a silent bug as Foo might be resolved with the wrong state. I've actually found other places in my app where that's exactly what is happening.
from abstractions.
https://github.com/unitycontainer/unity/releases/tag/5.2.1.311
from abstractions.
Related Issues (20)
- RegisterFactory delegate should be able to call the original Resolve with overrides HOT 1
- FactoryLifetime.Scoped has wrong return type
- Fix InjectionConstructor & InjectionMethod selection with Type vs parameter of Type
- Unity.Abstractions 5.11.6 not working with Unity.AspNet.WebApi 5.0.15? HOT 3
- PerSessionLifetimeManager no longer works after upgrading to Unity.Abstraction 5.11 HOT 4
- Method "ToString" does not have an implementation exception Unity versions 5.11.8 and 5.11.9 HOT 4
- Document Unity Release versioning strategy HOT 9
- Add missing constructors to DependencyOverride<T>
- ECCN question HOT 1
- XML documentation question HOT 1
- How to return the old behaviour of Unity registration/resolve processes HOT 1
- Add name validation for PropertyOverride and FieldOverride
- DependencyOverride incorrect matches
- Remove obsolete class TypeBasedOverride
- Optimize ResolverOverride
- Fix ParameterOverrides.OnType(Type targetType)
- Resolve fails when registered with nested injection
- Unity.Extensions.Inject does not cover all cases for Arrays, Parameters, and members
- ILifetimeContainer interface changes
- Changes to IResolveContext interface
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 abstractions.