Ejemplo n.º 1
0
        public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle)
        {
            // Arguments:
            //    Array aArray, RuntimeFieldHandle aFieldHandle
            XS.Set(XSRegisters.EDI, XSRegisters.EBP, sourceDisplacement: 20); // array
            XS.Set(XSRegisters.ESI, XSRegisters.EBP, sourceDisplacement: 12);  // aFieldHandle
            XS.Add(XSRegisters.EDI, 8);
            XS.Push(EDI, isIndirect: true); // element size
            XS.Add(XSRegisters.EDI, 4);
            XS.Set(EAX, EDI, sourceIsIndirect: true);
            XS.Multiply(ESP, isIndirect: true, size: RegisterSize.Int32);
            XS.Pop(XSRegisters.ECX);
            XS.Set(XSRegisters.ECX, XSRegisters.EAX);
            XS.Set(XSRegisters.EAX, 0);
            XS.Add(XSRegisters.EDI, 4);

            XS.Label(".StartLoop");
            XS.Set(DL, ESI, sourceIsIndirect: true);
            XS.Set(EDI, DL, destinationIsIndirect: true);
            XS.Add(XSRegisters.EAX, 1);
            XS.Add(XSRegisters.ESI, 1);
            XS.Add(XSRegisters.EDI, 1);
            XS.Compare(XSRegisters.EAX, XSRegisters.ECX);
            XS.Jump(CPUx86.ConditionalTestEnum.Equal, ".EndLoop");
            XS.Jump(".StartLoop");

            XS.Label(".EndLoop");
        }
Ejemplo n.º 2
0
        public static void TestUseCase(Assert assert)
        {
            assert.Expect(7);

            var t1 = new Type();
            assert.Ok(t1 != null, "#565 t1");

            var t2 = new ValueType();
            assert.Ok(t2 != null, "#565 t2");

            var t3 = new IntPtr();
            assert.Ok(t3.GetType() == typeof(IntPtr) , "#565 t3");

            var t4 = new UIntPtr();
            assert.Ok(t4.GetType() == typeof(UIntPtr), "#565 t4");

            var t5 = new ParamArrayAttribute();
            assert.Ok(t5 != null, "#565 t5");

            var t6 = new RuntimeTypeHandle();
            assert.Ok(t6.GetType() == typeof(RuntimeTypeHandle), "#565 t6");

            var t7 = new RuntimeFieldHandle();
            assert.Ok(t7.GetType() == typeof(RuntimeFieldHandle), "#565 t7");
        }
Ejemplo n.º 3
0
		public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle) {
			// Arguments:
			//    Array aArray, RuntimeFieldHandle aFieldHandle
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0xC }; // array
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 8 };// aFieldHandle
            new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceValue = 8 };
			new CPUx86.Push{DestinationReg=CPUx86.Registers.EDI, DestinationIsIndirect=true};
            new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceValue = 4 };
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EDI, SourceIsIndirect = true };
			new CPUx86.Multiply{DestinationReg=CPUx86.Registers.ESP, DestinationIsIndirect=true, Size=32};
            new CPUx86.Pop { DestinationReg = CPUx86.Registers.ECX };
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EAX };
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
            new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceValue = 4 };

			new Label(".StartLoop");
			new CPUx86.Mov { DestinationReg = CPUx86.Registers.DL, SourceReg = CPUx86.Registers.ESI, SourceIsIndirect = true };
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.DL };
			new CPUx86.Add{DestinationReg = CPUx86.Registers.EAX, SourceValue=1};
            new CPUx86.Add { DestinationReg = CPUx86.Registers.ESI, SourceValue = 1 };
            new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceValue = 1 };
			new CPUx86.Compare { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ECX };
            new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Equal, DestinationLabel = ".EndLoop" };
            new CPUx86.Jump { DestinationLabel = ".StartLoop" };

			new Label(".EndLoop");
		}
Ejemplo n.º 4
0
		internal object LoadRemoteFieldNew (IntPtr classPtr, IntPtr fieldPtr) {
			Mono.RuntimeClassHandle classHandle = new Mono.RuntimeClassHandle (classPtr);
			RuntimeFieldHandle fieldHandle = new RuntimeFieldHandle (fieldPtr);
			RuntimeTypeHandle typeHandle = classHandle.GetTypeHandle ();

			FieldInfo field = FieldInfo.GetFieldFromHandle (fieldHandle);

			if (InCurrentContext ()) {
				object o = _rp._server;
				return field.GetValue(o);
			}

			string typeName = Type.GetTypeFromHandle(typeHandle).FullName;
			string fieldName = field.Name;
			object[] inArgs = new object[] { typeName,
							  fieldName };
			object[] outArgsMsg = new object[1];
			MethodInfo minfo = typeof(object).GetMethod("FieldGetter", BindingFlags.NonPublic | BindingFlags.Instance);
			if (minfo == null)
				throw new MissingMethodException ("System.Object", "FieldGetter");
			MonoMethodMessage msg = new MonoMethodMessage (minfo, inArgs, outArgsMsg);
			object[] outArgs;
			Exception exc;
			RealProxy.PrivateInvoke (_rp, msg, out exc, out outArgs);
			if (exc != null)
				throw exc;
			return outArgs[0];
		}
Ejemplo n.º 5
0
        public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));

            return RuntimeType.GetFieldInfo(declaringType.GetRuntimeType(), handle.GetRuntimeFieldInfo());
        }           
Ejemplo n.º 6
0
        public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage))
            {
                FrameworkEventSource.Log.BeginGetFieldFromHandle();
            }
#endif
            
            FieldInfo f = RuntimeType.GetFieldInfo(handle.GetRuntimeFieldInfo());

            Type declaringType = f.DeclaringType;

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && declaringType != null && f != null)
            {
                FrameworkEventSource.Log.EndGetFieldFromHandle(declaringType.GetFullNameForEtw(), f.GetFullNameForEtw());
            }
#endif
            
            if (declaringType != null && declaringType.IsGenericType)
                throw new ArgumentException(String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_FieldDeclaringTypeGeneric"), 
                    f.Name, declaringType.GetGenericTypeDefinition()));

            return f;            
        }           
Ejemplo n.º 7
0
        static StackObject *GetFieldFromHandle_20(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.RuntimeTypeHandle @declaringType = (System.RuntimeTypeHandle) typeof(System.RuntimeTypeHandle).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.RuntimeFieldHandle @handle = (System.RuntimeFieldHandle) typeof(System.RuntimeFieldHandle).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = System.Reflection.FieldInfo.GetFieldFromHandle(@handle, @declaringType);

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Ejemplo n.º 8
0
        internal static void Initialize(RuntimeFieldHandle field, byte opKey)
        {
            FieldInfo fieldInfo = FieldInfo.GetFieldFromHandle(field);
            byte[] sig = fieldInfo.Module.ResolveSignature(fieldInfo.MetadataToken);
            int len = sig.Length;
            int key = fieldInfo.GetOptionalCustomModifiers()[0].MetadataToken;

            key += (fieldInfo.Name[Mutation.KeyI0] ^ sig[--len]) << Mutation.KeyI4;
            key += (fieldInfo.Name[Mutation.KeyI1] ^ sig[--len]) << Mutation.KeyI5;
            key += (fieldInfo.Name[Mutation.KeyI2] ^ sig[--len]) << Mutation.KeyI6;
            len--;
            key += (fieldInfo.Name[Mutation.KeyI3] ^ sig[--len]) << Mutation.KeyI7;

            int token = Mutation.Placeholder(key);
            token *= fieldInfo.GetCustomAttributes(false)[0].GetHashCode();

            MethodBase method = fieldInfo.Module.ResolveMethod(token);
            Type delegateType = fieldInfo.FieldType;
            if (method.IsStatic)
                fieldInfo.SetValue(null, Delegate.CreateDelegate(delegateType, (MethodInfo)method));

            else {
                DynamicMethod dm = null;
                Type[] argTypes = null;

                foreach (MethodInfo invoke in fieldInfo.FieldType.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance))
                    if (invoke.DeclaringType == delegateType) {
                        ParameterInfo[] paramTypes = invoke.GetParameters();
                        argTypes = new Type[paramTypes.Length];
                        for (int i = 0; i < argTypes.Length; i++)
                            argTypes[i] = paramTypes[i].ParameterType;

                        Type declType = method.DeclaringType;
                        dm = new DynamicMethod("", invoke.ReturnType, argTypes, (declType.IsInterface || declType.IsArray) ? delegateType : declType, true);
                        break;
                    }

                DynamicILInfo info = dm.GetDynamicILInfo();
                info.SetLocalSignature(new byte[] { 0x7, 0x0 });
                var code = new byte[2 * argTypes.Length + 6];
                int index = 0;
                for (int i = 0; i < argTypes.Length; i++) {
                    code[index++] = 0x0e;
                    code[index++] = (byte)i;
                }
                code[index++] = (byte)((byte)fieldInfo.Name[Mutation.KeyI8] ^ opKey);
                int dmToken = info.GetTokenFor(method.MethodHandle);
                code[index++] = (byte)dmToken;
                code[index++] = (byte)(dmToken >> 8);
                code[index++] = (byte)(dmToken >> 16);
                code[index++] = (byte)(dmToken >> 24);
                code[index] = 0x2a;
                info.SetCode(code, argTypes.Length + 1);

                fieldInfo.SetValue(null, dm.CreateDelegate(delegateType));
            }
        }
        //
        // This overload of GetFieldForHandle only accepts handles for fields declared on non-generic types. To resolve handles for fields
        // declared on generic types, you must pass the declaring type explicitly using the two-argument overload of GetFieldFromHandle.
        //
        // This is a vestige from desktop generic sharing that got itself enshrined in the code generated by the C# compiler for Linq Expressions.
        //
        public override sealed FieldInfo GetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle)
        {
            ExecutionEnvironment executionEnvironment = ReflectionCoreExecution.ExecutionEnvironment;
            FieldHandle fieldHandle;
            RuntimeTypeHandle declaringTypeHandle;
            if (!executionEnvironment.TryGetFieldFromHandle(runtimeFieldHandle, out declaringTypeHandle, out fieldHandle))
                throw new ArgumentException(SR.Argument_InvalidHandle);

            FieldInfo fieldInfo = GetFieldInfo(declaringTypeHandle, fieldHandle);
            if (fieldInfo.DeclaringType.IsConstructedGenericType) // For compat with desktop, insist that the caller pass us the declaring type to resolve members of generic types.
                throw new ArgumentException(SR.Format(SR.Argument_FieldDeclaringTypeGeneric, fieldInfo));
            return fieldInfo;
        }
Ejemplo n.º 10
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
 {
     if (handle.IsNullHandle())
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));
     }
     FieldInfo fieldInfo = RuntimeType.GetFieldInfo(handle);
     if ((fieldInfo.DeclaringType != null) && fieldInfo.DeclaringType.IsGenericType)
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_FieldDeclaringTypeGeneric"), new object[] { fieldInfo.Name, fieldInfo.DeclaringType.GetGenericTypeDefinition() }));
     }
     return fieldInfo;
 }
Ejemplo n.º 11
0
        public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"), "handle");
                
            FieldInfo f = RuntimeType.GetFieldInfo(handle.GetRuntimeFieldInfo());
                       
            Type declaringType = f.DeclaringType;
            if (declaringType != null && declaringType.IsGenericType)
                throw new ArgumentException(String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_FieldDeclaringTypeGeneric"), 
                    f.Name, declaringType.GetGenericTypeDefinition()));

            return f;            
        }           
        public static void InitializeArray(uint* array, RuntimeFieldHandle handle)
        {
            MetadataFieldDefinitionStruct* fieldDefinition = (MetadataFieldDefinitionStruct*)((uint**)&handle)[0];
            byte* arrayElements = (byte*)(array + 3);

            // See FieldDefinition for format of field handle
            byte* fieldData = fieldDefinition->FieldData;
            uint dataLength = fieldDefinition->OffsetOrSize;
            while (dataLength > 0)
            {
                *arrayElements = *fieldData;
                arrayElements++;
                fieldData++;
                dataLength--;
            }
        }
        public static void InitializeArray(uint* array, RuntimeFieldHandle handle)
        {
            uint* fieldDefinition = ((uint**)&handle)[0];
            byte* arrayElements = (byte*)(array + 3);

            // See FieldDefinition for format of field handle
            byte* fieldData = (byte*)*(fieldDefinition + 4);
            uint dataLength = *(fieldDefinition + 5);
            while (dataLength > 0)
            {
                *arrayElements = *fieldData;
                arrayElements++;
                fieldData++;
                dataLength--;
            }
        }
Ejemplo n.º 14
0
 public static unsafe TypedReference MakeTypedReference(object target, FieldInfo[] flds)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (flds == null)
     {
         throw new ArgumentNullException("flds");
     }
     if (flds.Length == 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_ArrayZeroError"));
     }
     RuntimeFieldHandle[] handleArray = new RuntimeFieldHandle[flds.Length];
     System.Type type = target.GetType();
     for (int i = 0; i < flds.Length; i++)
     {
         FieldInfo info = flds[i];
         if (!(info is RuntimeFieldInfo))
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo"));
         }
         if (info.IsInitOnly || info.IsStatic)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_TypedReferenceInvalidField"));
         }
         if ((type != info.DeclaringType) && !type.IsSubclassOf(info.DeclaringType))
         {
             throw new MissingMemberException(Environment.GetResourceString("MissingMemberTypeRef"));
         }
         System.Type fieldType = info.FieldType;
         if (fieldType.IsPrimitive)
         {
             throw new ArgumentException(Environment.GetResourceString("Arg_TypeRefPrimitve"));
         }
         if ((i < (flds.Length - 1)) && !fieldType.IsValueType)
         {
             throw new MissingMemberException(Environment.GetResourceString("MissingMemberNestErr"));
         }
         handleArray[i] = info.FieldHandle;
         type = fieldType;
     }
     TypedReference reference = new TypedReference();
     InternalMakeTypedReference((void*) &reference, target, handleArray, type.TypeHandle);
     return reference;
 }
        private unsafe bool TryGetDynamicRuntimeFieldHandleComponents(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out string fieldName)
        {
            IntPtr runtimeFieldHandleValue = *(IntPtr*)&runtimeFieldHandle;

            // Special flag in the handle value to indicate it was dynamically allocated
            Debug.Assert((runtimeFieldHandleValue.ToInt64() & 0x1) == 0x1);
            runtimeFieldHandleValue = runtimeFieldHandleValue - 1;

            DynamicFieldHandleInfo* fieldData = (DynamicFieldHandleInfo*)runtimeFieldHandleValue.ToPointer();
            declaringTypeHandle = *(RuntimeTypeHandle*)&(fieldData->DeclaringType);

            // FieldName points to the field name in NativeLayout format, so we parse it using a NativeParser
            IntPtr fieldNamePtr = fieldData->FieldName;
            fieldName = GetStringFromMemoryInNativeFormat(fieldNamePtr);

            return true;
        }
        //
        // This overload of GetFieldHandle can handle all field handles.
        //
        public override sealed FieldInfo GetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle)
        {
            ExecutionEnvironment executionEnvironment = ReflectionCoreExecution.ExecutionEnvironment;
            FieldHandle fieldHandle;
            if (!executionEnvironment.TryGetFieldFromHandleAndType(runtimeFieldHandle, declaringTypeHandle, out fieldHandle))
            {
                // This may be a field declared on a non-generic type: this api accepts that too so try the other table.
                RuntimeTypeHandle actualDeclaringTypeHandle;
                if (!executionEnvironment.TryGetFieldFromHandle(runtimeFieldHandle, out actualDeclaringTypeHandle, out fieldHandle))
                    throw new ArgumentException(SR.Argument_InvalidHandle);
                if (!actualDeclaringTypeHandle.Equals(declaringTypeHandle))
                    throw new ArgumentException(SR.Format(SR.Argument_ResolveFieldHandle,
                        declaringTypeHandle.GetTypeForRuntimeTypeHandle(),
                        actualDeclaringTypeHandle.GetTypeForRuntimeTypeHandle()));
            }

            FieldInfo fieldInfo = GetFieldInfo(declaringTypeHandle, fieldHandle);
            return fieldInfo;
        }
        public static TypedReference MakeTypedReference(Object target, FieldInfo[] flds) {
            if (target == null)
                throw new ArgumentNullException("target");
            if (flds == null)
                throw new ArgumentNullException("flds");
            if (flds.Length == 0)
                throw new ArgumentException(Environment.GetResourceString("Arg_ArrayZeroError"));
            else {
                RuntimeFieldHandle[] fields = new RuntimeFieldHandle[flds.Length];
          // For proper handling of Nullable<T> don't change GetType() to something like 'IsAssignableFrom'
          // Currently we can't make a TypedReference to fields of Nullable<T>, which is fine.  
                Type targetType = target.GetType();
                for (int i = 0; i < flds.Length; i++) {
                    FieldInfo field = flds[i];
                    if (!(field is RuntimeFieldInfo))
                        throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo"));
                    else if (field.IsInitOnly || field.IsStatic)
                        throw new ArgumentException(Environment.GetResourceString("Argument_TypedReferenceInvalidField"));
                    
                    if (targetType != field.DeclaringType && !targetType.IsSubclassOf(field.DeclaringType))
                        throw new MissingMemberException(Environment.GetResourceString("MissingMemberTypeRef"));

                    Type fieldType = field.FieldType;
                    if (fieldType.IsPrimitive)
                        throw new ArgumentException(Environment.GetResourceString("Arg_TypeRefPrimitve"));
                    
                    if (i < flds.Length - 1)
                        if (!fieldType.IsValueType) 
                            throw new MissingMemberException(Environment.GetResourceString("MissingMemberNestErr"));
                    
                    fields[i] = field.FieldHandle;
                    targetType = fieldType;
                }
                TypedReference result = new TypedReference ();
                // reference to TypedReference is banned, so have to pass result as pointer
                unsafe 
                {
                    InternalMakeTypedReference(&result, target, fields, targetType.TypeHandle);
                }
                return result;
            }
        }
Ejemplo n.º 18
0
        public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage))
            {
                FrameworkEventSource.Log.BeginGetFieldFromHandle();
            }
#endif

            FieldInfo f = RuntimeType.GetFieldInfo(declaringType.GetRuntimeType(), handle.GetRuntimeFieldInfo());

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && declaringType != null && f != null)
            {
                FrameworkEventSource.Log.EndGetFieldFromHandle(declaringType.GetRuntimeType().GetFullNameForEtw(), f.GetFullNameForEtw());
            }
#endif

            return f;
        }           
Ejemplo n.º 19
0
 private static unsafe void GetSignature(ref SignatureStruct signature, void* pCorSig, int cCorSig, RuntimeFieldHandle fieldHandle, RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
 {
     _GetSignature(ref signature, pCorSig, cCorSig, fieldHandle.Value, methodHandle.Value, declaringTypeHandle.Value);
 }
Ejemplo n.º 20
0
 public Signature(RuntimeFieldHandle fieldHandle, RuntimeTypeHandle declaringTypeHandle)
 {
     SignatureStruct signature = new SignatureStruct();
     GetSignature(ref signature, null, 0, fieldHandle, new RuntimeMethodHandle(null), declaringTypeHandle);
     this.m_signature = signature;
 }
Ejemplo n.º 21
0
		public void InitializeArray_Default ()
		{
			RuntimeFieldHandle h = new RuntimeFieldHandle ();
			RuntimeHelpers.InitializeArray (new Fielder ().array, h);
		}
Ejemplo n.º 22
0
 internal GenericFieldInfo(RuntimeFieldHandle fieldHandle, RuntimeTypeHandle context)
 {
     m_fieldHandle = fieldHandle;
     m_context = context;
 }
Ejemplo n.º 23
0
		public void System_RuntimeFieldHandle_Value ()
		{
			RuntimeFieldHandle handle = new RuntimeFieldHandle ();
			Assert.IsNotNull (handle, ".ctor");
			Assert.Throws<MethodAccessException> (delegate {
				Assert.IsNotNull (handle.Value);
			}, "RuntimeFieldHandle.Value"); // new SC in SL4
		}
Ejemplo n.º 24
0
 private static extern bool IsSecurityTransparent(RuntimeFieldHandle fieldHandle);
Ejemplo n.º 25
0
 public static void _register_field(Symbol globname, System.RuntimeFieldHandle hndl, Object value)
 {
     comp_hash_f[globname.v]       = System.Reflection.FieldInfo.GetFieldFromHandle(hndl);
     comp_hash[globname.v]         = null;
     Precompiler.symbols[globname] = value;
 }
Ejemplo n.º 26
0
 public unsafe bool Equals(RuntimeFieldHandle handle)
 {
     return handle.Value == Value;
 }
Ejemplo n.º 27
0
 private static extern bool IsSecurityTransparent(RuntimeFieldHandle fieldHandle);
Ejemplo n.º 28
0
		public int GetTokenFor (RuntimeFieldHandle field) {
			return this.method.GetILGenerator ().TokenGenerator.GetToken (FieldInfo.GetFieldFromHandle (field), false);
		}
Ejemplo n.º 29
0
 public bool Equals(RuntimeFieldHandle handle)
 {
     return(value == handle.Value);
 }
Ejemplo n.º 30
0
 public bool Equals(RuntimeFieldHandle handle)
 {
     return(handle.m_ptr == this.m_ptr);
 }
Ejemplo n.º 31
0
		[Test] // GetFieldFromHandle (RuntimeFieldHandle, RuntimeTypeHandle)
		public void GetFieldFromHandle2_Handle_Zero ()
		{
			object instance = new Class2 ();
			RuntimeTypeHandle th = Type.GetTypeHandle (instance);
			RuntimeFieldHandle fh = new RuntimeFieldHandle ();

			try {
				FieldInfo.GetFieldFromHandle (fh, th);
				Assert.Fail ("#1");
			} catch (ArgumentException ex) {
				// Handle is not initialized
				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsNull (ex.ParamName, "#5");
			}
		}
Ejemplo n.º 32
0
 public bool Equals(RuntimeFieldHandle handle)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 33
0
		RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
		{
			var refh = new RuntimeTypeHandle (reflectedType);
			using (var h = new Mono.SafeGPtrArrayHandle (GetFields_native (name, bindingAttr))) {
				int n = h.Length;
				var a = new RuntimeFieldInfo[n];
				for (int i = 0; i < n; i++) {
					var fh = new RuntimeFieldHandle (h[i]);
					a[i] = (RuntimeFieldInfo) FieldInfo.GetFieldFromHandle (fh, refh);
				}
				return a;
			}
		}
Ejemplo n.º 34
0
 private static extern bool IsSecuritySafeCritical(RuntimeFieldHandle fieldHandle);
Ejemplo n.º 35
0
		public int GetTokenFor (RuntimeFieldHandle field, RuntimeTypeHandle contextType) {
			throw new NotImplementedException ();
		}
Ejemplo n.º 36
0
 public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle)
 {
     throw null;
 }
Ejemplo n.º 37
0
 private static extern bool IsSecuritySafeCritical(RuntimeFieldHandle fieldHandle);
Ejemplo n.º 38
0
 public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle, System.RuntimeTypeHandle declaringType)
 {
     throw null;
 }
Ejemplo n.º 39
0
 internal static extern void CheckAttributeAccess(RuntimeFieldHandle fieldHandle, RuntimeModule decoratedTarget);
Ejemplo n.º 40
0
 internal static extern void CheckAttributeAccess(RuntimeFieldHandle fieldHandle, RuntimeModule decoratedTarget);