示例#1
0
        public PdbSymbols GetSymbolsProviderForFile(string assemblyFile)
        {
            PdbSymbols reader;

            if (!_readers.TryGetValue(assemblyFile, out reader))
            {
                ISymUnmanagedReader rawReader;
                var importerIID = typeof(IMetaDataImport).GUID;
                var importer    = _dispenser.OpenScope(assemblyFile, 0, ref importerIID);

                int result = _symbolBinder.GetReaderForFile2(importer,
                                                             assemblyFile,
                                                             Path.GetDirectoryName(assemblyFile),
                                                             SymSearchPolicies.AllowOriginalPathAccess,
                                                             out rawReader);

                if (result == (int)DiaErrors.E_PDB_NOT_FOUND ||
                    result < 0)
                {
                    return(null);
                }

                _readers.Add(assemblyFile, reader = new PdbSymbols(rawReader));
                _instanceCollector.AddComObject(rawReader);
                _instanceCollector.AddComObject(importer);
            }
            return(reader);
        }
        public PdbSymbols GetSymbolsProviderForFile(string assemblyFile)
        {
            PdbSymbols reader;
            if (!_readers.TryGetValue(assemblyFile, out reader))
            {
                ISymUnmanagedReader rawReader;
                var importerIID = typeof(IMetaDataImport).GUID;
                var importer = _dispenser.OpenScope(assemblyFile, 0, ref importerIID);

                int result = _symbolBinder.GetReaderForFile2(importer,
                    assemblyFile,
                    Path.GetDirectoryName(assemblyFile),
                    SymSearchPolicies.AllowOriginalPathAccess,
                    out rawReader);

                if (result == (int)DiaErrors.E_PDB_NOT_FOUND ||
                    result < 0)
                    return null;

                _readers.Add(assemblyFile, reader = new PdbSymbols(rawReader));
                _instanceCollector.AddComObject(rawReader);
                _instanceCollector.AddComObject(importer);
            }
            return reader;
        }