LoadedAssembly LoadAssembly(FileName fileName, CancellationToken cancellationToken, bool includeInternalMembers)
        {
            DateTime lastWriteTime = File.GetLastWriteTimeUtc(fileName);
            string cacheFileName = GetCacheFileName(fileName);
            LoadedAssembly pc = TryReadFromCache(cacheFileName, lastWriteTime);
            if (pc != null) {
                if (!includeInternalMembers || includeInternalMembers == pc.HasInternalMembers)
                    return pc;
            }

            //LoggingService.Debug("Loading " + fileName);
            cancellationToken.ThrowIfCancellationRequested();
            var param = new ReaderParameters();
            param.AssemblyResolver = new DummyAssemblyResolver();
            ModuleDefinition module = ModuleDefinition.ReadModule(fileName, param);

            CecilLoader l = new CecilLoader();
            l.IncludeInternalMembers = includeInternalMembers;
            string xmlDocFile = FindXmlDocumentation(fileName, module.Runtime);
            if (xmlDocFile != null) {
                try {
                    l.DocumentationProvider = new XmlDocumentationProvider(xmlDocFile);
                } catch (XmlException ex) {
                    LoggingService.Warn("Ignoring error while reading xml doc from " + xmlDocFile, ex);
                } catch (IOException ex) {
                    LoggingService.Warn("Ignoring error while reading xml doc from " + xmlDocFile, ex);
                } catch (UnauthorizedAccessException ex) {
                    LoggingService.Warn("Ignoring error while reading xml doc from " + xmlDocFile, ex);
                }
            }
            l.CancellationToken = cancellationToken;
            var references = module.AssemblyReferences
                .Select(anr => new DomAssemblyName(anr.FullName));
            pc = new LoadedAssembly(l.LoadModule(module), lastWriteTime, includeInternalMembers, references);
            SaveToCacheAsync(cacheFileName, lastWriteTime, pc).FireAndForget();
            //SaveToCache(cacheFileName, lastWriteTime, pc);
            return pc;
        }
		static IUnresolvedAssembly LoadModule(Module module, string fileName)
		{
			var param = new Mono.Cecil.ReaderParameters { AssemblyResolver = new DummyAssemblyResolver() };
			var cecilModule = Mono.Cecil.ModuleDefinition.ReadModule(fileName, param);
			
			var moduleMetadataInfo = new ModuleMetadataInfo(module, cecilModule);
			var loader = new CecilLoader();
			loader.IncludeInternalMembers = true;
			loader.LazyLoad = true;
			loader.OnEntityLoaded = moduleMetadataInfo.AddMember;
			
			var asm = loader.LoadModule(cecilModule);
			weakTable.Add(asm, moduleMetadataInfo);
			return asm;
		}