MEF part unable to import Autofac autogenerated factory

Posted by Michael Wagner on Stack Overflow See other posts from Stack Overflow or by Michael Wagner
Published on 2010-06-09T16:04:24Z Indexed on 2010/06/10 11:02 UTC
Read the original article Hit count: 359

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about MEF

Related posts about autofac