* bug-322722_patch_bx.2.cs : Added test for bug #322722.
* bug-322722_dyn_method_throw.2.cs: Same.
* Makefile.am: Added the two tests for bug #322722.
svn path=/trunk/mono/; revision=89488
+2007-11-12 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * bug-322722_patch_bx.2.cs : Added test for bug #322722.
+
+ * bug-322722_dyn_method_throw.2.cs: Same.
+
+ * Makefile.am: Added the two tests for bug #322722.
+
2007-11-07 Zoltan Varga <vargaz@gmail.com>
* Makefile.am: Removed bug-318677 since the corresponding patch was reverted.
generic_type_definition.2.cs \
bug-333798.2.cs \
bug-333798-tb.2.cs \
- bug-335131.2.cs
+ bug-335131.2.cs \
+ bug-322722_patch_bx.2.cs \
+ bug-322722_dyn_method_throw.2.cs
TEST_IL2_SRC = find-method.2.il \
bug-79215.2.il \
--- /dev/null
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+public class MyException : Exception {
+
+}
+
+class Driver {
+ public static int Main()
+ {
+ DynamicMethod method_builder = new DynamicMethod ("ThrowException" , typeof (void), new Type[0], typeof (Driver));
+ ILGenerator ilg = method_builder.GetILGenerator ();
+
+
+ ilg.Emit (OpCodes.Newobj, typeof (MyException).GetConstructor (new Type[0]));
+ ilg.Emit (OpCodes.Throw);
+
+ try {
+ method_builder.Invoke (null, null);
+ return 2;
+ } catch (TargetInvocationException tie) {
+ if(! (tie.InnerException is MyException))
+ return 3;
+ }
+
+ return 0;
+ }
+}
--- /dev/null
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+
+class Driver {
+ public void AvoidInlining()
+ {
+ }
+
+ public int Foo()
+ {
+ AvoidInlining();
+ return -99;
+ }
+
+ public static int Main()
+ {
+
+ DynamicMethod method_builder = new DynamicMethod ("WriteHello" , typeof (int), new Type[] {typeof (Driver)}, typeof (Driver));
+ ILGenerator ilg = method_builder.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldarg_0);
+ ilg.Emit (OpCodes.Call, typeof (Driver).GetMethod ("Foo"));
+ ilg.Emit (OpCodes.Ret);
+
+ int res = (int) method_builder.Invoke (null, new object[] {new Driver()});
+ return res == -99 ? 0 : 1;
+ }
+}