Example #1
0
 protected abstract ConstructorInfo?GetConstructorImpl(BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[] types, ParameterModifier[]?modifiers);
Example #2
0
 public sealed override object InvokeMember(string name, BindingFlags invokeAttr, Binder?binder, object?target, object?[]?args, ParameterModifier[]?modifiers, CultureInfo?culture, string[]?namedParameters) => throw new NotSupportedException(SR.NotSupported_SignatureType);
Example #3
0
 protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder?binder, Type?returnType, Type[]?types, ParameterModifier[]?modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
Example #4
0
 protected override PropertyInfo?GetPropertyImpl(string name, BindingFlags bindingAttr, Binder?binder,
                                                 Type?returnType, Type[]?types, ParameterModifier[]?modifiers)
 {
     throw new NotSupportedException(SR.NotSupported_NonReflectedType);
 }
Example #5
0
 protected abstract override MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers);
Example #6
0
        //
        // Note: CreateInstance returns null for Nullable<T>, e.g. CreateInstance(typeof(int?)) returns null.
        //

        public static object?CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, BindingFlags bindingAttr, Binder?binder, object?[]?args, CultureInfo?culture, object?[]?activationAttributes)
        {
            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (type is System.Reflection.Emit.TypeBuilder)
            {
                throw new NotSupportedException(SR.NotSupported_CreateInstanceWithTypeBuilder);
            }

            // If they didn't specify a lookup, then we will provide the default lookup.
            const int LookupMask = 0x000000FF;

            if ((bindingAttr & (BindingFlags)LookupMask) == 0)
            {
                bindingAttr |= ConstructorDefault;
            }

            if (activationAttributes?.Length > 0)
            {
                throw new PlatformNotSupportedException(SR.NotSupported_ActivAttr);
            }

            if (type.UnderlyingSystemType is RuntimeType rt)
            {
                return(rt.CreateInstanceImpl(bindingAttr, binder, args, culture));
            }

            throw new ArgumentException(SR.Arg_MustBeType, nameof(type));
        }
Example #7
0
 // Not valid in a ReflectionOnly context
 public sealed override object Invoke(object?obj, BindingFlags invokeAttr, Binder?binder, object?[]?parameters, CultureInfo?culture) => throw new InvalidOperationException(SR.Arg_ReflectionOnlyInvoke);
Example #8
0
 public abstract object?InvokeMember(string name, BindingFlags invokeAttr, Binder?binder, object?target, object[]?args, ParameterModifier[]?modifiers, CultureInfo?culture, string[]?namedParameters);
 protected override MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     if (global_type_created == null)
     {
         return(null);
     }
     if (types == null)
     {
         return(global_type_created.GetMethod(name));
     }
     return(global_type_created.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers));
 }
Example #10
0
 protected abstract PropertyInfo?GetPropertyImpl(string name, BindingFlags bindingAttr, Binder?binder, Type?returnType, Type[]?types, ParameterModifier[]?modifiers);
Example #11
0
 public object?InvokeMember(string name, BindingFlags invokeAttr, Binder?binder, object?target, object[]?args, CultureInfo?culture) => InvokeMember(name, invokeAttr, binder, target, args, null, culture, null);
Example #12
0
 protected virtual MethodInfo?GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers) => throw new NotSupportedException();
Example #13
0
 public MethodInfo?GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[] types, ParameterModifier[]?modifiers)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     if (genericParameterCount < 0)
     {
         throw new ArgumentException(SR.ArgumentOutOfRange_NeedNonNegNum, nameof(genericParameterCount));
     }
     if (types == null)
     {
         throw new ArgumentNullException(nameof(types));
     }
     for (int i = 0; i < types.Length; i++)
     {
         if (types[i] == null)
         {
             throw new ArgumentNullException(nameof(types));
         }
     }
     return(GetMethodImpl(name, genericParameterCount, bindingAttr, binder, callConvention, types, modifiers));
 }
Example #14
0
 public MethodInfo?GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder?binder, Type[] types, ParameterModifier[]?modifiers) => GetMethod(name, genericParameterCount, bindingAttr, binder, CallingConventions.Any, types, modifiers);
Example #15
0
 public sealed override object?InvokeMember(string name, BindingFlags invokeAttr, Binder?binder, object?target, object?[]?args, ParameterModifier[]?modifiers, CultureInfo?culture, string[]?namedParameters) => throw new InvalidOperationException(SR.Arg_ReflectionOnlyInvoke);
Example #16
0
 public override void SetValue(object?obj, object?value, BindingFlags invokeAttr, Binder?binder, CultureInfo?culture) => m_field.SetValue(obj, value, invokeAttr, binder, culture);
Example #17
0
 // Backdoor for RoModule to invoke GetMethodImpl();
 internal MethodInfo?InternalGetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     return(GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers));
 }
Example #18
0
 public override object?InvokeMember(string name, BindingFlags invokeAttr, Binder?binder, object?target,
                                     object[]?args, ParameterModifier[]?modifiers, CultureInfo?culture, string[]?namedParameters)
 {
     return(typeImpl.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters));
 }
Example #19
0
        public static ObjectHandle?CreateInstance(string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder?binder, object?[]?args, CultureInfo?culture, object?[]?activationAttributes)
        {
            StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;

            return(CreateInstanceInternal(assemblyName,
                                          typeName,
                                          ignoreCase,
                                          bindingAttr,
                                          binder,
                                          args,
                                          culture,
                                          activationAttributes,
                                          ref stackMark));
        }
Example #20
0
 protected override ConstructorInfo?GetConstructorImpl(BindingFlags bindingAttr, Binder?binder,
                                                       CallingConventions callConvention, Type[] types, ParameterModifier[]?modifiers)
 {
     return(typeImpl.GetConstructor(bindingAttr, binder, callConvention, types, modifiers));
 }
Example #21
0
 protected override MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder,
                                             CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     throw new NotSupportedException(SR.NotSupported_NonReflectedType);
 }
Example #22
0
 protected override MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder,
                                             CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     // This is interesting there are two paths into the impl.  One that validates
     //  type as non-null and one where type may be null.
     if (types == null)
     {
         return(typeImpl.GetMethod(name, bindingAttr));
     }
     else
     {
         return(typeImpl.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers));
     }
 }
Example #23
0
 public override object Invoke(object?obj, BindingFlags invokeAttr, Binder?binder, object?[]?parameters, CultureInfo?culture)
 {
     throw new NotSupportedException(SR.NotSupported_DynamicModule);
 }
Example #24
0
 protected override PropertyInfo?GetPropertyImpl(string name, BindingFlags bindingAttr, Binder?binder,
                                                 Type?returnType, Type[]?types, ParameterModifier[]?modifiers)
 {
     if (returnType == null && types == null)
     {
         return(typeImpl.GetProperty(name, bindingAttr));
     }
     else
     {
         return(typeImpl.GetProperty(name, bindingAttr, binder, returnType, types !, modifiers));
     }
 }
Example #25
0
        public override void SetValue(object?obj, object?val, BindingFlags invokeAttr, Binder?binder, CultureInfo?culture)
        {
            // NOTE!!  If this is implemented, make sure that this throws
            // a NotSupportedException for Save-only dynamic assemblies.
            // Otherwise, it could cause the .cctor to be executed.

            throw new NotSupportedException(SR.NotSupported_DynamicModule);
        }
Example #26
0
 protected virtual MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     throw NotImplemented.ByDesign;
 }
Example #27
0
 protected sealed override MethodInfo GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
Example #28
0
 public override void SetValue(object?obj, object?val, BindingFlags invokeAttr, Binder?binder, CultureInfo?culture)
 {
     throw CreateNotSupportedException();
 }
Example #29
0
 protected sealed override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[] types, ParameterModifier[]?modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
Example #30
0
 public ConstructorInfo?GetConstructor(BindingFlags bindingAttr, Binder?binder, Type[] types, ParameterModifier[]?modifiers) => GetConstructor(bindingAttr, binder, CallingConventions.Any, types, modifiers);