private static void ReadMethodLocations(Dictionary <string, string> methodLocations, string pdbFixturePath, string peFixturePath) { var host = new PeReader.DefaultHost(); var pdbFileStream = File.OpenRead(pdbFixturePath); var peReader = new PeReader(host); var pdbReader = new PdbReader(pdbFileStream, host); var assembly = peReader.OpenAssembly( BinaryDocument.GetBinaryDocumentForFile(peFixturePath, host) ); foreach (var type in assembly.GetAllTypes()) { foreach (var member in type.Members) { foreach (var sourceLocation in pdbReader.GetPrimarySourceLocationsFor(member.Locations)) { var memberName = $"{member}"; if (!methodLocations.ContainsKey(memberName)) { methodLocations.Add( memberName, $"{sourceLocation.SourceDocument.Name}:{sourceLocation.StartLine}" ); } } } } }