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


C# ICorDebugFunction.GetClass方法代码示例

本文整理汇总了C#中ICorDebugFunction.GetClass方法的典型用法代码示例。如果您正苦于以下问题:C# ICorDebugFunction.GetClass方法的具体用法?C# ICorDebugFunction.GetClass怎么用?C# ICorDebugFunction.GetClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICorDebugFunction的用法示例。


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

示例1: StackFrame

        internal StackFrame(Thread thread, ICorDebugILFrame corILFrame, uint chainIndex, uint frameIndex)
        {
            this.process = thread.Process;
            this.thread = thread;
            this.appDomain = process.AppDomains[corILFrame.GetFunction().GetClass().GetModule().GetAssembly().GetAppDomain()];
            this.corILFrame = corILFrame;
            this.corILFramePauseSession = process.PauseSession;
            this.corFunction = corILFrame.GetFunction();
            this.chainIndex = chainIndex;
            this.frameIndex = frameIndex;

            MetaDataImport metaData = thread.Process.Modules[corFunction.GetClass().GetModule()].MetaData;
            int methodGenArgs = metaData.EnumGenericParams(corFunction.GetToken()).Length;
            // Class parameters are first, then the method ones
            List<ICorDebugType> corGenArgs = ((ICorDebugILFrame2)corILFrame).EnumerateTypeParameters().ToList();
            // Remove method parametrs at the end
            corGenArgs.RemoveRange(corGenArgs.Count - methodGenArgs, methodGenArgs);
            List<DebugType> genArgs = new List<DebugType>(corGenArgs.Count);
            foreach(ICorDebugType corGenArg in corGenArgs) {
                genArgs.Add(DebugType.CreateFromCorType(this.AppDomain, corGenArg));
            }

            DebugType debugType = DebugType.CreateFromCorClass(
                this.AppDomain,
                null,
                corFunction.GetClass(),
                genArgs.ToArray()
            );
            this.methodInfo = (DebugMethodInfo)debugType.GetMember(corFunction.GetToken());
        }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:30,代码来源:StackFrame.cs

示例2: Import

		public static IMethod Import(this ICompilation compilation, ICorDebugFunction corFunction)
		{
			Module module = compilation.GetAppDomain().Process.GetModule(corFunction.GetModule());
			if (module.IsDynamic || module.IsInMemory) {
				return module.Assembly.GetTypeDefinition("", "UnknownDynamicType").Methods.First();
			}
			var info = GetInfo(module.Assembly);
			uint functionToken = corFunction.GetToken();
			var unresolvedMethod = info.GetMethodFromToken(functionToken);
			if (unresolvedMethod == null) {
				// The type containing this function wasn't loaded yet
				uint classToken = corFunction.GetClass().GetToken();
				var definition = ToTypeDefinitionReference(module, classToken).Resolve(new SimpleTypeResolveContext(module.Assembly)).GetDefinition();
				if (definition == null)
					throw new InvalidOperationException("Could not find class for token " + classToken);
				definition.Methods.ToList(); // enforce loading the methods so that they get added to the dictionary
				unresolvedMethod = info.GetMethodFromToken(functionToken);
				if (unresolvedMethod == null)
					throw new InvalidOperationException("Could not find function with token " + functionToken);
			}
			return unresolvedMethod.Resolve(new SimpleTypeResolveContext(module.Assembly));
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:22,代码来源:TypeSystemExtensions.cs


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