using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
-
-#if NET_2_0
using System.Runtime.ConstrainedExecution;
-#endif
+using System.Runtime.CompilerServices;
namespace System
{
-#if NET_2_0
[ComVisible (true)]
-#endif
- [MonoTODO ("Serialization needs tests")]
[Serializable]
public struct RuntimeFieldHandle : ISerializable
{
if (info == null)
throw new ArgumentNullException ("info");
+ if (value == IntPtr.Zero)
+ throw new SerializationException ("Object fields may not be properly initialized");
+
info.AddValue ("FieldObj", (MonoField) FieldInfo.GetFieldFromHandle (this), typeof (MonoField));
}
-#if NET_2_0
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
public override bool Equals (object obj)
{
{
return !left.Equals (right);
}
-#endif
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern void SetValueInternal (FieldInfo fi, object obj, object value);
+
+ internal static void SetValue (RtFieldInfo field, Object obj, Object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized)
+ {
+ SetValueInternal (field, obj, value);
+ }
+
+ unsafe internal static Object GetValueDirect (RtFieldInfo field, RuntimeType fieldType, void *pTypedRef, RuntimeType contextType)
+ {
+ throw new NotImplementedException ("GetValueDirect");
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static unsafe extern internal void SetValueDirect (RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, Object value, RuntimeType contextType);
}
}