According to the MEF Preview 9 source code (which probably closely matches the code that ships in .NET 4), the CompositionContainer will wrap the directory in CatalogExportProvider . This export provider is stored in the field and placed with the container. However, CatalogExportProvider.Dispose will not take turns removing the wrapped ComposablePartCatalog .
Therefore, the answer is: CompositionContainer does not delete the directory.
You can verify this by running this code that will not print anything on the console:
class MyCatalog : ComposablePartCatalog { protected override void Dispose(bool disposing) { Console.WriteLine("Disposed!"); base.Dispose(); } public override IQueryable<ComposablePartDefinition> Parts { get { throw new NotImplementedException(); } } } class Program { static void Main(string[] args) { var container = new CompositionContainer(new MyCatalog()); container.Dispose(); Console.ReadKey(); } }
source share