private static void ExpandEmbeddedReferences(ICache cache, IList<IMetadataReference> references)
        {
            var otherReferences = new List<IMetadataReference>();

            foreach (var reference in references)
            {
                var fileReference = reference as IMetadataFileReference;

                if (fileReference != null &&
                    string.Equals(Path.GetExtension(fileReference.Path), ".dll", StringComparison.OrdinalIgnoreCase))
                {
                    // We don't use the exact path since that might clash with another key
                    var key = "ANI_" + fileReference.Path;

                    var embeddedRefs = cache.Get<IList<IMetadataEmbeddedReference>>(key, ctx =>
                                       {
                                           ctx.Monitor(new FileWriteTimeCacheDependency(fileReference.Path));

                                           using (var fileStream = File.OpenRead(fileReference.Path))
                                           using (var reader = new PEReader(fileStream))
                                           {
                                               return reader.GetEmbeddedReferences();
                                           }
                                       });

                    otherReferences.AddRange(embeddedRefs);
                }
            }

            references.AddRange(otherReferences);
        }
        private static void ExpandEmbeddedReferences(IList<IMetadataReference> references)
        {
            var otherReferences = new List<IMetadataReference>();

            foreach (var reference in references)
            {
                var fileReference = reference as IMetadataFileReference;

                if (fileReference != null)
                {
                    using (var fileStream = File.OpenRead(fileReference.Path))
                    using (var reader = new PEReader(fileStream))
                    {
                        otherReferences.AddRange(reader.GetEmbeddedReferences());
                    }
                }
            }

            references.AddRange(otherReferences);
        }