Explorar el Código

In System.Reflection.Emit:
2007-03-06 Rolf Bjarne Kvinge <[email protected]>

* MonoArrayMethod.cs: Use 'void' as return type in ToString when
the return type is null. Fixes #80435.

In Test/System.Reflection.Emit:
2007-03-06 Rolf Bjarne Kvinge <[email protected]>

* ModuleBuilderTest.cs: Added GetArrayMethodToStringTest () -#80435.


svn path=/trunk/mcs/; revision=73788

Rolf Bjarne Kvinge hace 19 años
padre
commit
e37d5c09cf

+ 5 - 0
mcs/class/corlib/System.Reflection.Emit/ChangeLog

@@ -1,3 +1,8 @@
+2007-03-06  Rolf Bjarne Kvinge  <[email protected]>
+
+	* MonoArrayMethod.cs: Use 'void' as return type in ToString when 
+	the return type is null. Fixes #80435.
+
 2007-03-06  Gert Driesen  <[email protected]>
 
 	* EnumBuilder.cs: On 2.0 profile, using current EnumBuilder as

+ 4 - 1
mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs

@@ -130,7 +130,10 @@ namespace System.Reflection {
 					parms = parms + ", ";
 				parms = parms + p [i].ParameterType.Name;
 			}
-			return ReturnType.Name+" "+Name+"("+parms+")";
+			if (ReturnType != null)
+				return ReturnType.Name+" "+Name+"("+parms+")";
+			else
+				return "void "+Name+"("+parms+")";
 		}
 	}
 }

+ 4 - 0
mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog

@@ -1,3 +1,7 @@
+2007-03-06  Rolf Bjarne Kvinge  <[email protected]>
+
+	* ModuleBuilderTest.cs: Added GetArrayMethodToStringTest () -#80435.
+
 2007-03-05  Gert Driesen  <[email protected]>
 
 	* EnumBuilderTest.cs: Added tests for bug #81007. Use Assert instead

+ 18 - 0
mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs

@@ -148,6 +148,24 @@ public class ModuleBuilderTest : Assertion
 							  SymLanguageType.ILAssembly,SymLanguageVendor.Microsoft);
 	}
 	
+	[Test] // Test case for #80435.
+	public void GetArrayMethodToStringTest ()
+	{
+		AssemblyName name = new AssemblyName ();
+		name.Name = "a";
+		AssemblyBuilder assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (name, AssemblyBuilderAccess.RunAndSave);
+
+		ModuleBuilder module = assembly.DefineDynamicModule ("m", "test.dll");
+
+		Type [] myArrayClass = new Type [1];
+		Type [] parameterTypes = { typeof (Array) };
+		MethodInfo myMethodInfo = module.GetArrayMethod (myArrayClass.GetType (), "Sort", CallingConventions.Standard, null, parameterTypes);
+
+		string str = myMethodInfo.ToString ();
+		// Don't compare string, since MS returns System.Reflection.Emit.SymbolMethod here 
+		// (they do not provide an implementation of ToString).
+	}
+	
     private static void AssertArrayEqualsSorted (Array o1, Array o2) {
 		Array s1 = (Array)o1.Clone ();
 		Array s2 = (Array)o2.Clone ();