Esempio n. 1
0
        internal static Type MonoDebugger_ResolveType(Module module, int token)
        {
            ResolveTokenError resolveTokenError;
            IntPtr            intPtr = Module.ResolveTypeToken(module._impl, token, null, null, out resolveTokenError);

            if (intPtr == IntPtr.Zero)
            {
                return(null);
            }
            return(Type.GetTypeFromHandle(new RuntimeTypeHandle(intPtr)));
        }
Esempio n. 2
0
        /// <summary>Returns the type identified by the specified metadata token, in the context defined by the specified generic type parameters.</summary>
        /// <returns>A <see cref="T:System.Type" /> object representing the type that is identified by the specified metadata token.</returns>
        /// <param name="metadataToken">A metadata token that identifies a type in the module.</param>
        /// <param name="genericTypeArguments">An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the type where the token is in scope, or null if that type is not generic. </param>
        /// <param name="genericMethodArguments">An array of <see cref="T:System.Type" /> objects representing the generic type arguments of the method where the token is in scope, or null if that method is not generic.</param>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="metadataToken" /> is not a token for a type in the scope of the current module.-or-<paramref name="metadataToken" /> is a TypeSpec whose signature contains element type var (a type parameter of a generic type) or mvar (a type parameter of a generic method), and the necessary generic type arguments were not supplied for either or both of <paramref name="genericTypeArguments" /> and <paramref name="genericMethodArguments" />.</exception>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="metadataToken" /> is not a valid token in the scope of the current module.</exception>
        public Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
        {
            ResolveTokenError error;
            IntPtr            intPtr = Module.ResolveTypeToken(this._impl, metadataToken, this.ptrs_from_types(genericTypeArguments), this.ptrs_from_types(genericMethodArguments), out error);

            if (intPtr == IntPtr.Zero)
            {
                throw this.resolve_token_exception(metadataToken, error, "Type");
            }
            return(Type.GetTypeFromHandle(new RuntimeTypeHandle(intPtr)));
        }