Ejemplo n.º 1
0
        public static CorDebugClass ClassFromRuntimeValue(RuntimeValue rtv, CorDebugAppDomain appDomain)
        {
            RuntimeValue_Reflection rtvf = rtv as RuntimeValue_Reflection;
            CorDebugClass           cls  = null;
            object objBuiltInKey         = null;

            Debug.Assert(!rtv.IsNull);

            if (rtvf != null)
            {
                objBuiltInKey = rtvf.ReflectionType;
            }
            else if (rtv.DataType == RuntimeDataType.DATATYPE_TRANSPARENT_PROXY)
            {
                objBuiltInKey = RuntimeDataType.DATATYPE_TRANSPARENT_PROXY;
            }
            else
            {
                cls = nanoCLR_TypeSystem.CorDebugClassFromTypeIndex(rtv.Type, appDomain);;
            }

            if (objBuiltInKey != null)
            {
                CorDebugProcess.BuiltinType builtInType = appDomain.Process.ResolveBuiltInType(objBuiltInKey);

                cls = builtInType.GetClass(appDomain);

                if (cls == null)
                {
                    cls = new CorDebugClass(builtInType.GetAssembly(appDomain), builtInType.TokenCLR);
                }
            }

            return(cls);
        }
Ejemplo n.º 2
0
        private uint GetTypeDef_Index(CorElementType elementType, ICorDebugClass pElementClass)
        {
            uint tdIndex;

            if (pElementClass != null)
            {
                tdIndex = ((CorDebugClass)pElementClass).TypeDef_Index;
            }
            else
            {
                CorDebugProcess.BuiltinType builtInType = this.Process.ResolveBuiltInType(elementType);
                tdIndex = builtInType.GetClass(this.m_appDomain).TypeDef_Index;
            }

            return(tdIndex);
        }