Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

MEF Question: Troubleshooting why Import is not importing when Export is exporting

$
0
0

This might sound a strange design to some. But this is what I am trying to do.

Assembly A Exports Part P.

Assembly A Imports Part P in one of its classes (note that same assembly exports it).

Assembly B is MEF Helper assembly which has a class that holds the CompositionContainer with all necessary catalogs.

A references B to call the MEF Helper classes.

The class in Assembly A that imports part P, calls on Assembly B's helper class; it calls the method FillMeWithParts(object target)

in the target parameter it provides this reference. 

FillMeWithParts() is defined as follows

        public void FillMeWithParts(object target)
        {
            //Fill the imports of this object
            try
            {
                this._container.ComposeParts(target);
            }
            catch (CompositionException compositionException)
            {
                Console.WriteLine(compositionException.ToString());
            }
            catch (Exception Exception)
            {

            }
        }

Here is the problem. The parts aren't imported. The DirectoryCatalog supplied in Helper assembly (B) does have correct directory for Assembly A.

What could be the issue ?


Fahad


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>