public void Dispose()
        {
            currentAssemblyLoader?.Dispose();
            currentAssemblyLoader = null;

            foreach (var loader in assemblyLoadersByFullName.Values)
            {
                loader?.Dispose();
            }
            assemblyLoadersByFullName.Clear();
        }
        private bool TryGetCachedInfo(MetadataTypeReference typeReference, out CachedInfo cachedInfo)
        {
            var(assemblyReference, typeName) = NameSpec.FromMetadataTypeReference(typeReference);

            if (assemblyReference == null)
            {
                if (currentAssemblyLoader == null)
                {
                    currentAssemblyLoader = new AssemblyLazyLoader(currentAssemblyStreamFactory.Invoke());
                }

                if (currentAssemblyLoader.TryGetInfo(typeName, this, out cachedInfo))
                {
                    return(true);
                }

                // Attribute values containing enum type references serialize the string.
                // So far all mscorlib enum references I've seen include the assembly name,
                // but this is just in case.

                if (currentAssemblyMscorlibReference == null)
                {
                    currentAssemblyMscorlibReference = GetMscorlibReference(currentAssemblyStreamFactory.Invoke());
                }

                assemblyReference = currentAssemblyMscorlibReference;
            }

            var fullName = assemblyReference.FullName;

            if (!assemblyLoadersByFullName.TryGetValue(fullName, out var loader))
            {
                loader = assemblyResolver.TryGetAssemblyPath(assemblyReference, out var path) ? new AssemblyLazyLoader(File.OpenRead(path)) : null;
                assemblyLoadersByFullName.Add(fullName, loader);
            }

            if (loader == null)
            {
                // We couldn't locate the assembly.
                cachedInfo = default;
                return(false);
            }

            return(loader.TryGetInfo(typeName, this, out cachedInfo));
        }