void WriteMefCacheControl(ComposableCatalog catalog, ITimeTracker timer)
            {
                var mefAssemblyNames = new HashSet <string> ();
                var mefAssemblyInfos = new List <MefControlCacheAssemblyInfo> ();

                foreach (var assembly in MefAssemblies)
                {
                    mefAssemblyNames.Add(assembly.GetName().ToString());

                    mefAssemblyInfos.Add(new MefControlCacheAssemblyInfo {
                        Location        = assembly.Location,
                        ModuleVersionId = assembly.ManifestModule.ModuleVersionId,
                    });
                }

                var additionalInputAssemblies = new List <MefControlCacheAssemblyInfo> ();
                var loadedMap = loadedAssemblies.ToDictionary(x => x.FullName, x => x);

                foreach (var asm in catalog.GetInputAssemblies())
                {
                    var assemblyName = asm.ToString();
                    if (mefAssemblyNames.Contains(assemblyName))
                    {
                        continue;
                    }

                    if (!loadedMap.TryGetValue(assemblyName, out var assembly))
                    {
                        throw new InvalidRuntimeCompositionException(assemblyName);
                    }

                    additionalInputAssemblies.Add(new MefControlCacheAssemblyInfo {
                        Location        = assembly.Location,
                        ModuleVersionId = assembly.ManifestModule.ModuleVersionId,
                    });
                }

                // Create cache control data.
                var controlCache = new MefControlCache {
                    MefAssemblyInfos             = mefAssemblyInfos,
                    AdditionalInputAssemblyInfos = additionalInputAssemblies,
                };

                var serializer = new JsonSerializer();

                using (var fs = File.Open(MefCacheControlFile, FileMode.Create))
                    using (var sw = new StreamWriter(fs)) {
                        serializer.Serialize(sw, controlCache);
                    }
                timer.Trace("Composition control file written");
            }
            void WriteMefCacheControl(ITimeTracker timer)
            {
                // Create cache control data.
                var controlCache = new MefControlCache {
                    AssemblyInfos = Assemblies.Select(asm => new MefControlCacheAssemblyInfo {
                        Location         = asm.Location,
                        LastWriteTimeUtc = File.GetLastWriteTimeUtc(asm.Location),
                    }).ToArray(),
                };

                var serializer = new JsonSerializer();

                using (var fs = File.Open(MefCacheControlFile, FileMode.Create))
                    using (var sw = new StreamWriter(fs)) {
                        serializer.Serialize(sw, controlCache);
                    }
                timer.Trace("Composition control file written");
            }