• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISymUnmanagedReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ISymUnmanagedReader类属于命名空间,在下文中一共展示了ISymUnmanagedReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: Handle

 public Handle(ISymUnmanagedReader reader)
 {
     _reader = reader;
 }
开发者ID:rynowak,项目名称:symbro,代码行数:4,代码来源:SymbolReaderFactory.cs


示例14: SymbolReader

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reader">An unmanaged symbol reader</param>
		public SymbolReader(ISymUnmanagedReader reader) {
			if (reader == null)
				throw new ArgumentNullException("reader");
			this.reader = reader;
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:9,代码来源:SymbolReader.cs


示例15: GetBaselineEncDebugInfo

        private EditAndContinueMethodDebugInformation GetBaselineEncDebugInfo(MethodDefinitionHandle methodHandle)
        {
            Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.MTA);

            if (_pdbReader == null)
            {
                // Unmarshal the symbol reader (being marshalled cross thread from STA -> MTA).
                Debug.Assert(_pdbReaderObjAsStream != IntPtr.Zero);
                object pdbReaderObjMta;
                int hr = NativeMethods.GetObjectForStream(_pdbReaderObjAsStream, out pdbReaderObjMta);
                _pdbReaderObjAsStream = IntPtr.Zero;
                if (hr != VSConstants.S_OK)
                {
                    log.Write("Error unmarshaling object from stream.");
                    return default(EditAndContinueMethodDebugInformation);
                }
                _pdbReader = (ISymUnmanagedReader)pdbReaderObjMta;
            }

            int methodToken = MetadataTokens.GetToken(methodHandle);
            byte[] debugInfo = _pdbReader.GetCustomDebugInfoBytes(methodToken, methodVersion: 1);
            if (debugInfo != null)
            {
                try
                {
                    var localSlots = CustomDebugInfoReader.TryGetCustomDebugInfoRecord(debugInfo, CustomDebugInfoKind.EditAndContinueLocalSlotMap);
                    var lambdaMap = CustomDebugInfoReader.TryGetCustomDebugInfoRecord(debugInfo, CustomDebugInfoKind.EditAndContinueLambdaMap);
                    return EditAndContinueMethodDebugInformation.Create(localSlots, lambdaMap);
                }
                catch (Exception e) when (e is InvalidOperationException || e is InvalidDataException)
                {
                    log.Write($"Error reading CDI of method 0x{methodToken:X8}: {e.Message}");
                }
            }

            return default(EditAndContinueMethodDebugInformation);
        }
开发者ID:AnthonyDGreen,项目名称:roslyn,代码行数:37,代码来源:VsENCRebuildableProjectImpl.cs


示例16: UnmanagedPdbSymbolReader

 private UnmanagedPdbSymbolReader(ISymUnmanagedReader symUnmanagedReader)
 {
     _symUnmanagedReader = symUnmanagedReader;
 }
开发者ID:Maoni0,项目名称:corert,代码行数:4,代码来源:UnmanagedPdbSymbolReader.cs


示例17: CreateMethodContextFactory

 private static ExpressionCompiler.CreateContextDelegate CreateMethodContextFactory(
     Guid moduleVersionId,
     ISymUnmanagedReader symReader,
     int methodToken,
     int localSignatureToken)
 {
     return (blocks, useReferencedModulesOnly) => EvaluationContext.CreateMethodContext(
         ToCompilation(blocks, useReferencedModulesOnly, moduleVersionId),
         symReader,
         moduleVersionId,
         methodToken,
         methodVersion: 1,
         ilOffset: 0,
         localSignatureToken: localSignatureToken);
 }
开发者ID:MischkowskyM,项目名称:roslyn,代码行数:15,代码来源:ReferencedModulesTests.cs


示例18: 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


示例19: 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


示例20: 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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISymUnmanagedVariable类代码示例发布时间:2022-05-24
下一篇:
C# ISymUnmanagedDocument类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap