当前位置: 首页>>代码示例>>C#>>正文


C# ISymUnmanagedReader类代码示例

本文整理汇总了C#中ISymUnmanagedReader的典型用法代码示例。如果您正苦于以下问题:C# ISymUnmanagedReader类的具体用法?C# ISymUnmanagedReader怎么用?C# ISymUnmanagedReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISymUnmanagedReader类属于命名空间,在下文中一共展示了ISymUnmanagedReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PDBReader

        public PDBReader(string assemblyPath)
        {
            object metaDataImport = null;
            IMetaDataDispenser dispenser = null;

            try
            {
                Guid metaDataImportIID = new Guid(IMetaDataImportGuid);

                dispenser = (IMetaDataDispenser)(new MetaDataDispenser());
                dispenser.OpenScope(assemblyPath, 0, ref metaDataImportIID, out metaDataImport);

                this.symReader = (ISymUnmanagedReader)(new CorSymReader_SxS());
                this.symReader.Initialize(metaDataImport, assemblyPath, null, null);
            }
            finally
            {
                // Release COM objects so that files don't remain locked.
                if (metaDataImport != null)
                    Marshal.ReleaseComObject(metaDataImport);

                if (dispenser != null)
                    Marshal.ReleaseComObject(dispenser);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:PDBReader.cs

示例2: PdbToXmlConverter

 private PdbToXmlConverter(XmlWriter writer, ISymUnmanagedReader symReader, MetadataReader metadataReader, PdbToXmlOptions options)
 {
     _symReader = symReader;
     _metadataReader = metadataReader;
     _writer = writer;
     _options = options;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:7,代码来源:PdbToXml.cs

示例3: GetMethodTokensForEachLine

        private int[][] GetMethodTokensForEachLine(ISymUnmanagedReader symReader, ISymUnmanagedDocument symDocument, int minZeroBasedLine, int maxZeroBasedLine)
        {
            var result = new List<int[]>();

            for (int line = minZeroBasedLine; line <= maxZeroBasedLine; line++)
            {
                int[] allMethodTokens = GetMethodTokensFromDocumentPosition(symReader, symDocument, line, 0);

                ISymUnmanagedMethod method;
                int hr = symReader.GetMethodFromDocumentPosition(symDocument, line, 1, out method);

                if (hr != HResult.S_OK)
                {
                    Assert.Equal(HResult.E_FAIL, hr);
                    Assert.Equal(0, allMethodTokens.Length);
                }
                else
                {
                    int primaryToken;
                    Assert.Equal(HResult.S_OK, method.GetToken(out primaryToken));
                    Assert.Equal(primaryToken, allMethodTokens.First());
                }

                result.Add(allMethodTokens);
            }

            return result.ToArray();
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:28,代码来源:MethodMapTests.cs

示例4: Create

 public unsafe static ModuleInstance Create(
     PEMemoryBlock metadata,
     Guid moduleVersionId,
     ISymUnmanagedReader symReader = null)
 {
     return Create((IntPtr)metadata.Pointer, metadata.Length, moduleVersionId, symReader);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:ModuleInstance.cs

示例5: SymbolWriterClass

 public SymbolWriterClass(EnCManager manager,ITokenTranslator transl)
 {
     // Create the writer from the COM catalog
     Type writerType = Type.GetTypeFromCLSID(typeof(CorSymWriter_SxSClass).GUID);
     object comWriterObj = Activator.CreateInstance(writerType);
     Type readerType = Type.GetTypeFromCLSID(typeof(CorSymReader_SxSClass).GUID);
     object comReaderObj = Activator.CreateInstance(readerType);
     mWriter = (ISymUnmanagedWriter2)comWriterObj;
     mReader = (ISymUnmanagedReader)comReaderObj;
     this.manager = manager;
     this.stream = new CorMemStream();
     this.translator = transl;
     State = WriterState.NotIninitialized;
 }
开发者ID:maresja1,项目名称:SDenc,代码行数:14,代码来源:SymbolWriter.cs

示例6: TestGetMethodFromDocumentPosition

        private void TestGetMethodFromDocumentPosition(
            ISymUnmanagedReader symReader,
            ISymUnmanagedDocument symDocument,
            int zeroBasedLine,
            int zeroBasedColumn,
            int expectedToken)
        {
            ISymUnmanagedMethod method;
            Assert.Equal(HResult.S_OK, symReader.GetMethodFromDocumentPosition(symDocument, zeroBasedLine, zeroBasedColumn, out method));

            int token;
            Assert.Equal(HResult.S_OK, method.GetToken(out token));
            Assert.Equal(expectedToken, token);
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:14,代码来源:MethodMapTests.cs

示例7: TestGetDocument

 private void TestGetDocument(ISymUnmanagedReader symReader, string name, string expectedUrl)
 {
     ISymUnmanagedDocument document;
     if (expectedUrl != null)
     {
         // guids are ignored
         Assert.Equal(HResult.S_OK, symReader.GetDocument(name, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), out document));
         ValidateDocumentUrl(document, expectedUrl);
     }
     else
     {
         // guids are ignored
         Assert.Equal(HResult.S_FALSE, symReader.GetDocument(name, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), out document));
         Assert.Null(document);
     }
 }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:16,代码来源:SymReaderTests.cs

示例8: CreateRuntimeInstance

        internal RuntimeInstance CreateRuntimeInstance(
            string assemblyName,
            ImmutableArray<MetadataReference> references,
            byte[] exeBytes,
            ISymUnmanagedReader symReader,
            bool includeLocalSignatures = true)
        {
            var exeReference = AssemblyMetadata.CreateFromImage(exeBytes).GetReference(display: assemblyName);
            var modulesBuilder = ArrayBuilder<ModuleInstance>.GetInstance();
            // Create modules for the references
            modulesBuilder.AddRange(references.Select(r => r.ToModuleInstance(fullImage: null, symReader: null, includeLocalSignatures: includeLocalSignatures)));
            // Create a module for the exe.
            modulesBuilder.Add(exeReference.ToModuleInstance(exeBytes, symReader, includeLocalSignatures: includeLocalSignatures));

            var modules = modulesBuilder.ToImmutableAndFree();
            modules.VerifyAllModules();

            var instance = new RuntimeInstance(modules);
            _runtimeInstances.Add(instance);
            return instance;
        }
开发者ID:JackWangCUMT,项目名称:roslyn,代码行数:21,代码来源:ExpressionCompilerTestBase.cs

示例9: GetMethodTokensFromDocumentPosition

        private int[] GetMethodTokensFromDocumentPosition(
            ISymUnmanagedReader symReader,
            ISymUnmanagedDocument symDocument,
            int zeroBasedLine,
            int zeroBasedColumn)
        {
            int count;
            Assert.Equal(HResult.S_OK, symReader.GetMethodsFromDocumentPosition(symDocument, zeroBasedLine, zeroBasedColumn, 0, out count, null));

            var methods = new ISymUnmanagedMethod[count];
            int count2;
            Assert.Equal(HResult.S_OK, symReader.GetMethodsFromDocumentPosition(symDocument, zeroBasedLine, zeroBasedColumn, count, out count2, methods));
            Assert.Equal(count, count2);

            return methods.Select(m =>
            {
                int token;
                Assert.Equal(HResult.S_OK, m.GetToken(out token));
                return token;
            }).ToArray();
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:21,代码来源:MethodMapTests.cs

示例10: GetContextState

        internal static void GetContextState(
            RuntimeInstance runtime,
            string methodOrTypeName,
            out ImmutableArray<MetadataBlock> blocks,
            out Guid moduleVersionId,
            out ISymUnmanagedReader symReader,
            out int methodOrTypeToken,
            out int localSignatureToken)
        {
            var moduleInstances = runtime.Modules;
            blocks = moduleInstances.SelectAsArray(m => m.MetadataBlock);

            var compilation = blocks.ToCompilation();

            var methodOrType = GetMethodOrTypeBySignature(compilation, methodOrTypeName);

            var module = (PEModuleSymbol)methodOrType.ContainingModule;
            var id = module.Module.GetModuleVersionIdOrThrow();
            var moduleInstance = moduleInstances.First(m => m.ModuleVersionId == id);

            moduleVersionId = id;
            symReader = (ISymUnmanagedReader)moduleInstance.SymReader;

            EntityHandle methodOrTypeHandle;
            if (methodOrType.Kind == SymbolKind.Method)
            {
                methodOrTypeHandle = ((PEMethodSymbol)methodOrType).Handle;
                localSignatureToken = moduleInstance.GetLocalSignatureToken((MethodDefinitionHandle)methodOrTypeHandle);
            }
            else
            {
                methodOrTypeHandle = ((PENamedTypeSymbol)methodOrType).Handle;
                localSignatureToken = -1;
            }

            MetadataReader reader = null; // null should be ok
            methodOrTypeToken = reader.GetToken(methodOrTypeHandle);
        }
开发者ID:JackWangCUMT,项目名称:roslyn,代码行数:38,代码来源:ExpressionCompilerTestBase.cs

示例11: PDBReader

 public PDBReader(string assemblyPath)
 {
     object unknown = null;
     System.Workflow.ComponentModel.Compiler.IMetaDataDispenser o = null;
     try
     {
         Guid riid = new Guid("7DAC8207-D3AE-4c75-9B67-92801A497D44");
         o = (System.Workflow.ComponentModel.Compiler.IMetaDataDispenser) new System.Workflow.ComponentModel.Compiler.MetaDataDispenser();
         o.OpenScope(assemblyPath, 0, ref riid, out unknown);
         this.symReader = (ISymUnmanagedReader) new CorSymReader_SxS();
         this.symReader.Initialize(unknown, assemblyPath, null, null);
     }
     finally
     {
         if (unknown != null)
         {
             Marshal.ReleaseComObject(unknown);
         }
         if (o != null)
         {
             Marshal.ReleaseComObject(o);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:PDBReader.cs

示例12: LoadSymbolsDynamic

		/// <summary>
		/// Load symbols for dynamic module
		/// (as of .NET 4.0)
		/// </summary>
		public void LoadSymbolsDynamic()
		{
			if (this.CorModule is ICorDebugModule3 && this.IsDynamic) {
				Guid guid = new Guid(0, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 70);
				try {
					symReader = (ISymUnmanagedReader)((ICorDebugModule3)this.CorModule).CreateReaderForInMemorySymbols(guid);
				} catch (COMException e) {
					// 0x80131C3B The application did not supply symbols when it loaded or created this module, or they are not yet available.
					if ((uint)e.ErrorCode == 0x80131C3B) {
						process.TraceMessage("Failed to load dynamic symbols for " + this.Name);
						return;
					}
					throw;
				}
				TrackedComObjects.Track(symReader);
				process.TraceMessage("Loaded dynamic symbols for " + this.Name);
				OnSymbolsUpdated();
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:23,代码来源:Module.cs

示例13: Dispose

 public void Dispose()
 {
     // If the underlying symbol reader supports an explicit dispose interface to release
     // it's resources, then call it.
     (rawReader as ISymUnmanagedDispose)?.Destroy();
     this.rawReader = null;
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:7,代码来源:TempPdbReader.cs

示例14: SymReader

        internal SymReader(byte[] pdbBytes, ImmutableDictionary<string, byte[]> constantSignaturesOpt = null)
        {
            _reader = SymUnmanagedReaderExtensions.CreateReader(
                new MemoryStream(pdbBytes),
                PDB::Roslyn.Test.PdbUtilities.DummyMetadataImport.Instance);

            _constantSignaturesOpt = constantSignaturesOpt;
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:8,代码来源:SymReader.cs

示例15: Dispose

 private void Dispose()
 {
     if (this.symReader != null)
     {
         Marshal.ReleaseComObject(this.symReader);
         this.symReader = null;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:PDBReader.cs


注:本文中的ISymUnmanagedReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。