public static void InitializeArray (Array array, RuntimeFieldHandle fldHandle)
		{
			if ((array == null) || (fldHandle.Value == IntPtr.Zero))
				throw new ArgumentNullException ();

			InitializeArray (array, fldHandle.Value);
		}
    public bool PosTest1()
    {
        bool retVal = true;

        // Add your scenario description here
        TestLibrary.TestFramework.BeginScenario("PosTest1: Verify two hashcode of RuntimeFieldHandle equals");

        try
        {
            RuntimeFieldHandle rfh1 = new RuntimeFieldHandle();
            RuntimeFieldHandle rfh2 = new RuntimeFieldHandle();

            if (rfh1.GetHashCode() != rfh2.GetHashCode())
            {
                TestLibrary.TestFramework.LogError("001.1", "Method GetHashCode Err !");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
    public bool PosTest2()
    {
        bool retVal = true;

        // Add your scenario description here
        TestLibrary.TestFramework.BeginScenario("PosTest2: Verify a hashcode of RuntimeFieldHandle is not equal to object");

        try
        {
            RuntimeFieldHandle rfh = new RuntimeFieldHandle();
            object obj = new object();

            if (rfh.GetHashCode() == obj.GetHashCode())
            {
                TestLibrary.TestFramework.LogError("001.1", "Method GetHashCode Err !");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
    public bool PosTest2()
    {
        bool retVal = true;

        // Add your scenario description here
        TestLibrary.TestFramework.BeginScenario("PosTest2: Verify two struct RuntimeFieldHandle equals.");

        try
        {
            RuntimeFieldHandle rfh1 = new RuntimeFieldHandle();
            RuntimeFieldHandle rfh2 = new RuntimeFieldHandle();

            bool expected = true;
            bool actual = rfh1.Equals(rfh2);

            if (actual != expected)
            {
                TestLibrary.TestFramework.LogError("002.1", "Method Equals Err.");
                TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actual = " + actual + ", expected = " + expected);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Beispiel #5
0
 // TODO: Implement this method in the compiler
 public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle)
 {
     Logging.Debug("Initializing array " + array + " with value " + fldHandle);
     RuntimeType type = (RuntimeType)array.GetType();
     if (!type.Class.IsArray)
     {
         throw new SystemException("Array was not marked with class that was an array.  Class: " + type.Class);
     }
     if (type.Class.ElementClass == null)
     {
         throw new SystemException("Array was not marked with class that did not have an element class.  Class: " + type.Class);
     }
     Type elementType = Type.GetTypeFromHandle(((RuntimeTypeHandle)type.Class.ElementClass.VTable));
     if (elementType == Type.GetType("System.Int32"))
     {
         int[] intArray = var.Cast<Array>(array).Cast<int[]>();
         byte[] initialValue = var.Cast<RuntimeFieldHandle>(fldHandle).Cast<byte[]>();
         InitializeInt32Array(intArray, initialValue);
     }
     else
     {
         throw new SystemException("Cannot initialize array of type: " + elementType);
     }
 }
Beispiel #6
0
 public static extern void InitializeArray(Array array, RuntimeFieldHandle fldHandle);
 public bool Equals(RuntimeFieldHandle handle)
 {
 }
Beispiel #8
0
 public int GetTokenFor(RuntimeFieldHandle field)
 {
     return(this.method.GetILGenerator().TokenGenerator.GetToken(FieldInfo.GetFieldFromHandle(field), false));
 }
Beispiel #9
0
 public bool TryGetRuntimeFieldHandleComponents(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out string fieldName)
 {
     return(runtimeFieldHandle.IsDynamic() ?
            TryGetDynamicRuntimeFieldHandleComponents(runtimeFieldHandle, out declaringTypeHandle, out fieldName) :
            TryGetStaticRuntimeFieldHandleComponents(runtimeFieldHandle, out declaringTypeHandle, out fieldName));
 }
		public Field(RuntimeFieldHandle fieldHandle, object args)
		{
			FieldHandle = fieldHandle;
			Args = args;
		}
		public static FieldInfo GetFieldFromHandle (RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
		{
			if (handle.Value == IntPtr.Zero)
				throw new ArgumentException ("The handle is invalid.");
			FieldInfo fi = internal_from_handle_type (handle.Value, declaringType.Value);
			if (fi == null)
				throw new ArgumentException ("The field handle and the type handle are incompatible.");
			return fi;
		}
Beispiel #12
0
 public static unsafe void *ToVoid(this RuntimeFieldHandle src)
 => src.Value.ToVoid();
 public bool Equals(RuntimeFieldHandle handle)
 {
 }
 public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle)
 {
     InitializeArray(array, fldHandle.Value);
 }
 static void \u206D‭‌‪‍‎‫‏‏‭​‫‍‭​‎‎‮​‬​‬‬‮‭​‪‮([In] Array obj0, [In] RuntimeFieldHandle obj1)
 {
     // ISSUE: unable to decompile the method.
 }
Beispiel #16
0
        internal override void UnsafeSetValue(object?obj, object?value, BindingFlags invokeAttr, Binder?binder, CultureInfo?culture)
        {
            bool domainInitialized = false;

            RuntimeFieldHandle.SetValue(this, obj, value, null, Attributes, null, ref domainInitialized);
        }
 public override bool GetRuntimeFieldHandleComponents(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out string fieldName)
 {
     return TypeLoaderEnvironment.Instance.TryGetRuntimeFieldHandleComponents(runtimeFieldHandle, out declaringTypeHandle, out fieldName);
 }
Beispiel #18
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle) => ReflectionAugments.ReflectionCoreCallbacks.GetFieldFromHandle(handle);
 public abstract FieldInfo GetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle);
Beispiel #20
0
 extern public static FieldInfo GetFieldFromHandle([NoInterop(true)] RuntimeFieldHandle handle);
        //
        // 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 sealed override 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;
        }
Beispiel #22
0
        public void InitializeArray_Default()
        {
            RuntimeFieldHandle h = new RuntimeFieldHandle();

            RuntimeHelpers.InitializeArray(new Fielder().array, h);
        }
Beispiel #23
0
 /// <summary>
 /// Gets a <see cref="T:System.Reflection.FieldInfo"/> for the field represented by the specified handle.
 /// </summary>
 /// 
 /// <returns>
 /// A <see cref="T:System.Reflection.FieldInfo"/> object representing the field specified by <paramref name="handle"/>.
 /// </returns>
 /// <param name="handle">A <see cref="T:System.RuntimeFieldHandle"/> structure that contains the handle to the internal metadata representation of a field. </param><exception cref="T:System.ArgumentException"><paramref name="handle"/> is invalid.</exception>
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
 {
     throw new NotImplementedException();
 }
Beispiel #24
0
 public static void InitializeArray(Array array, RuntimeFieldHandle handle)
 {
 }
 public static bool op_Inequality(RuntimeFieldHandle left, RuntimeFieldHandle right)
 {
 }
 public static extern void InitializeArray(Array array, RuntimeFieldHandle fldHandle);
Beispiel #27
0
 public abstract FieldInfo GetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle);
Beispiel #28
0
 // FIXME:
 public int GetTokenFor(RuntimeFieldHandle field, RuntimeTypeHandle contextType)
 {
     throw new NotImplementedException();
 }
	extern public static void InitializeArray
				(Array array, RuntimeFieldHandle field);
Beispiel #30
0
 public abstract FieldInfo GetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle);
Beispiel #31
0
 internal override RuntimeModule GetRuntimeModule()
 {
     return(RuntimeTypeHandle.GetModule(RuntimeFieldHandle.GetApproxDeclaringType(this)));
 }
Beispiel #32
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
 {
     return(ReflectionAugments.ReflectionCoreCallbacks.GetFieldFromHandle(handle, declaringType));
 }
Beispiel #33
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle) => ReflectionAugments.ReflectionCoreCallbacks.GetFieldFromHandle(handle);
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle h, RuntimeTypeHandle x)
 {
     return(null);
 }
 public static bool op_Inequality(RuntimeFieldHandle left, RuntimeFieldHandle right)
 {
 }
 public static void InitializeArray(Array array, RuntimeFieldHandle handle)
 {
 }
 public abstract FieldInfo GetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle);
Beispiel #38
0
 public abstract bool TryGetFieldFromHandleAndType(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle, out FieldHandle fieldHandle);
        //
        // This overload of GetFieldHandle can handle all field handles.
        //
        public sealed override 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,
                        ReflectionCoreNonPortable.GetTypeForRuntimeTypeHandle(declaringTypeHandle),
                        ReflectionCoreNonPortable.GetTypeForRuntimeTypeHandle(actualDeclaringTypeHandle)));
            }

            FieldInfo fieldInfo = GetFieldInfo(declaringTypeHandle, fieldHandle);
            return fieldInfo;
        }
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle);
Beispiel #41
0
 public static long GetFieldOffset(RuntimeFieldHandle h) =>
 Marshal.ReadInt32(h.Value + (4 + IntPtr.Size)) & 0xFFFFFF;     // I have no idea what this is
 public bool TryGetRuntimeFieldHandleComponents(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out string fieldName)
 {
     throw new NotImplementedException();
 }
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType);
Beispiel #44
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
 {
     throw null;
 }
Beispiel #45
0
 public abstract bool TryGetFieldFromHandleAndType(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle, out FieldHandle fieldHandle);
Beispiel #46
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
 {
     throw null;
 }
Beispiel #47
0
 /// <summary>
 /// Gets a <see cref="T:System.Reflection.FieldInfo"/> for the field represented by the specified handle, for the specified generic type.
 /// </summary>
 /// 
 /// <returns>
 /// A <see cref="T:System.Reflection.FieldInfo"/> object representing the field specified by <paramref name="handle"/>, in the generic type specified by <paramref name="declaringType"/>.
 /// </returns>
 /// <param name="handle">A <see cref="T:System.RuntimeFieldHandle"/> structure that contains the handle to the internal metadata representation of a field.</param><param name="declaringType">A <see cref="T:System.RuntimeTypeHandle"/> structure that contains the handle to the generic type that defines the field.</param><exception cref="T:System.ArgumentException"><paramref name="handle"/> is invalid.-or-<paramref name="declaringType"/> is not compatible with <paramref name="handle"/>. For example, <paramref name="declaringType"/> is the runtime type handle of the generic type definition, and <paramref name="handle"/> comes from a constructed type. See Remarks.</exception>
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
 {
     throw new NotImplementedException();
 }
Beispiel #48
0
 public Utf8String(RuntimeFieldHandle utf8Bytes, int length)
 {
     _buffer = new byte[length];
     RuntimeHelpers.InitializeArray(_buffer, utf8Bytes);
 }
Beispiel #49
0
 public int GetTokenFor(RuntimeFieldHandle field)
 {
     return(DynamicScope.GetTokenFor(field));
 }
Beispiel #50
0
 public int GetTokenFor(RuntimeFieldHandle field, RuntimeTypeHandle contextType)
 {
     return(DynamicScope.GetTokenFor(field, contextType));
 }
		public static FieldInfo GetFieldFromHandle (RuntimeFieldHandle handle)
		{
			if (handle.Value == IntPtr.Zero)
				throw new ArgumentException ("The handle is invalid.");
			return internal_from_handle_type (handle.Value, IntPtr.Zero);
		}
Beispiel #52
0
 public int GetTokenFor(RuntimeFieldHandle field)
 {
     m_tokens.Add(field);
     return(m_tokens.Count - 1 | (int)MetadataTokenType.FieldDef);
 }
Beispiel #53
0
 public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
 {
     return ReflectionAugments.ReflectionCoreCallbacks.GetFieldFromHandle(handle, declaringType);
 }
Beispiel #54
0
 public int GetTokenFor(RuntimeFieldHandle field, RuntimeTypeHandle typeContext)
 {
     m_tokens.Add(new GenericFieldInfo(field, typeContext));
     return(m_tokens.Count - 1 | (int)MetadataTokenType.FieldDef);
 }
    public bool PosTest3()
    {
        bool retVal = true;

        // Add your scenario description here
        TestLibrary.TestFramework.BeginScenario("PosTest3: Verify a struct RuntimeFieldHandle is not equals to a object.");

        try
        {
            RuntimeFieldHandle rfh = new RuntimeFieldHandle();
            object obj = new object();

            bool expected = false;
            bool actual = rfh.Equals(obj);

            if (actual != expected)
            {
                TestLibrary.TestFramework.LogError("003.1", "Method Equals Err.");
                TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actual = " + actual + ", expected = " + expected);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("003.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Beispiel #56
0
 internal GenericFieldInfo(RuntimeFieldHandle fieldHandle, RuntimeTypeHandle context)
 {
     m_fieldHandle = fieldHandle;
     m_context     = context;
 }
Beispiel #57
0
 public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle)
 {
     var field = FieldInfo.GetFieldFromHandle(fldHandle);
     PrimInitializeArray(array, field.Initialization);
 }
		public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle h, RuntimeTypeHandle x) { return null; }