Example #1
0
        public void Initialize(DiaDataSource pdbDataSource, IEnumerable <string> imports)
        {
            this.pdbDataSource = pdbDataSource;
            this.imports       = imports;

            AnalyzeLibraries();
        }
        public DiaResolver(string binary, string pathExtension)
        {
            Binary = binary;

            if (!TryCreateDiaInstance(Dia140) && !TryCreateDiaInstance(Dia120) && !TryCreateDiaInstance(Dia110))
            {
                ErrorMessages.Add("Couldn't find the msdia.dll to parse *.pdb files. You will not get any source locations for your tests.");
                return;
            }

            string pdb = FindPdbFile(binary, pathExtension);

            if (pdb == null)
            {
                ErrorMessages.Add($"Couldn't find the .pdb file of file '{binary}'. You will not get any source locations for your tests.");
                return;
            }

            FileStream = File.Open(pdb, FileMode.Open, FileAccess.Read, FileShare.Read);
            DiaDataSource.loadDataFromIStream(new DiaMemoryStream(FileStream));

            dynamic diaSession110or140;

            DiaDataSource.openSession(out diaSession110or140);
            DiaSession = new IDiaSessionAdapter(diaSession110or140);
        }
Example #3
0
        public static DiaDataSource GetPdbDataSource(string nonClrImage, bool searchForPdb = true)
        {
            var fileInfo      = new FileInfo(Path.Combine(Path.GetDirectoryName(nonClrImage), Path.GetFileNameWithoutExtension(nonClrImage) + ".pdb"));
            var diaDataSource = new DiaDataSource();

            if (!fileInfo.Exists)
            {
                Debugger.Break();
            }

            diaDataSource.LoadExe(nonClrImage);

            return(diaDataSource);
        }