public static LoadedAssembly FromFile(string path) { using (var s = File.OpenRead(path)) using (var pe = new System.Reflection.PortableExecutable.PEReader(s)) { if (!pe.HasMetadata) { return(null); } var holder = new MetadataBlockHolder(pe.GetMetadata()); if (!holder.Reader.IsAssembly) { holder.Dispose(); return(null); } return(new LoadedAssembly(holder)); } }
public void Dispose() { _holder?.Dispose(); }