Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Lazy<T, TMetadata> incorrectly instantiates component when only querying for metadata #1
From @sherland on June 25, 2015 12:42
Copied from original issue: autofac/Autofac#651
referenced this issue
Jun 25, 2015
Now that I've come out of the .NET Core haze, I'm getting a chance to look at this.
The bug appears to be due to the way we wire up
Slight detour into the weeds:
In adapting MEF components to each other, we basically have to say "Export type
Point being, this has the unfortunate side effect that, while it works for most things, it means when a property on an object that runs through
A workaround is to register the types consuming
// After you register the part catalog, do this: builder.RegisterType<ServiceConsumer>().PropertiesAutowired();
I'm not sure how to resolve this from a MEF integration standpoint at this time. I'll have to keep looking at it.
pushed a commit
Oct 27, 2016
Right now it looks like the best I can do is add a failing (skipped) unit test to try and verify the behavior when we get a chance to fix it. There are a couple of other issues here (like the one about allowing open generics) that makes me wonder if the MEF integration either needs some TLC and major overhaul or has potentially reached its limits given it's a convenience bridge rather than a 100% feature-for-feature mapping from MEF to Autofac.
If you have a PR for this, we'd be happy to take it.