MEF part unable to import Autofac autogenerated factory
- by Michael Wagner
This is a (to me) pretty weird problem, because it was already running perfectly but went completely south after some unrelated changes.
I've got a Repository which imports in its constructor a list of IExtensions via Autofacs MEF integration. One of these extensions contains a backreference to the Repository as Lazy(Of IRepository) (lazy because of the circular reference that would occur).
But as soon as I try to use the repository, Autofac throws a ComponentNotRegisteredException with the message "The requested service 'ContractName=Assembly.IRepository()' has not been registered."
That is, however, not really correct, because when I break right after the container-build and explore the list of services, it's there - Exported() and with the correct ContractName.
I'd appreciate any help on this...
Michael