[Mono-patches] r77476 - trunk/mcs/class/corlib/System.Reflection.Emit

Zoltan Varga (vargaz AT gmail.com) mono-patches-list at lists.ximian.com
Wed May 16 08:54:36 EDT 2007


Author: zoltan
Date: 2007-05-16 08:54:35 -0400 (Wed, 16 May 2007)
New Revision: 77476

Modified:
   trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
   trunk/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
Log:
2007-05-16  Zoltan Varga  <vargaz at gmail.com>

	* FieldBuilder.cs: Support calling SetValue (). Fixes #81638.


Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog	2007-05-16 12:35:00 UTC (rev 77475)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog	2007-05-16 12:54:35 UTC (rev 77476)
@@ -1,3 +1,7 @@
+2007-05-16  Zoltan Varga  <vargaz at gmail.com>
+
+	* FieldBuilder.cs: Support calling SetValue (). Fixes #81638.
+
 2007-05-06  Zoltan Varga  <vargaz at gmail.com>
 
 	* TypeBuilder.cs (CreateType): Fix build.

Modified: trunk/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs	2007-05-16 12:35:00 UTC (rev 77475)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs	2007-05-16 12:54:35 UTC (rev 77476)
@@ -203,7 +203,12 @@
 		}
 
 		public override void SetValue( object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture) {
-			throw CreateNotSupportedException ();
+			// MS throws NotSupportedException here, but we sometimes return
+			// FieldBuilders instead of FieldInfos so we have to support this
+			if (typeb.is_created)
+				typeb.CreateType ().GetField (Name).SetValue (obj, val, invokeAttr, binder, culture);
+			else
+				throw CreateNotSupportedException ();
 		}
 
 		internal override UnmanagedMarshal UMarshal {



More information about the Mono-patches mailing list