Beispiel #1
0
        private bool TryCreateReaderForMatchingPdb(
            string pdbFilePath,
            Guid guid,
            uint stamp,
            int age,
            LazyMetadataImport metadataImport,
            out ISymUnmanagedReader reader)
        {
            try
            {
                if (PortableShim.File.Exists(pdbFilePath))
                {
                    var symReader = SymReader.CreateFromFile(pdbFilePath, metadataImport);
                    reader = symReader;
                    return(symReader.PdbReader.MatchesModule(guid, stamp, age));
                }
            }
            catch
            {
                // nop
            }

            reader = null;
            return(false);
        }
        public int GetReaderFromPdbFile(
            [MarshalAs(UnmanagedType.Interface)] IMetadataImportProvider metadataImportProvider,
            [MarshalAs(UnmanagedType.LPWStr)] string pdbFilePath,
            [MarshalAs(UnmanagedType.Interface)] out ISymUnmanagedReader reader)
        {
            if (metadataImportProvider == null || string.IsNullOrEmpty(pdbFilePath))
            {
                reader = null;
                return(HResult.E_INVALIDARG);
            }

            reader = SymReader.CreateFromFile(pdbFilePath, new LazyMetadataImport(metadataImportProvider));
            return(HResult.S_OK);
        }
Beispiel #3
0
        public int GetReaderFromPdbFile(
            [MarshalAs(UnmanagedType.Interface)] IMetadataImportProvider metadataImportProvider,
            [MarshalAs(UnmanagedType.LPWStr)] string pdbFilePath,
            [MarshalAs(UnmanagedType.Interface)] out ISymUnmanagedReader reader)
        {
            if (metadataImportProvider == null)
            {
                throw new ArgumentException(null, nameof(metadataImportProvider));
            }

            if (string.IsNullOrEmpty(pdbFilePath))
            {
                throw new ArgumentException(null, nameof(pdbFilePath));
            }

            reader = SymReader.CreateFromFile(pdbFilePath, new LazyMetadataImport(metadataImportProvider));
            return(HResult.S_OK);
        }
Beispiel #4
0
        private bool TryCreateReaderForMatchingPdb(
            string pdbFilePath,
            Guid guid,
            uint stamp,
            int age,
            LazyMetadataImport metadataImport,
            out ISymUnmanagedReader reader)
        {
            if (PortableShim.File.Exists(pdbFilePath))
            {
                SymReader symReader;
                try
                {
                    symReader = SymReader.CreateFromFile(pdbFilePath, metadataImport);
                }
                catch
                {
                    reader = null;
                    return(false);
                }

                try
                {
                    if (symReader.PdbReader.MatchesModule(guid, stamp, age))
                    {
                        reader    = symReader;
                        symReader = null;
                        return(true);
                    }
                }
                finally
                {
                    symReader?.Destroy();
                }
            }

            reader = null;
            return(false);
        }