Author: gert
Date: 2007-11-08 14:17:20 -0500 (Thu, 08 Nov 2007)
New Revision: 89234

Added:
   trunk/gert/standalone/bug317488/
   trunk/gert/standalone/bug317488/default.build
   trunk/gert/standalone/bug317488/test.cs
Modified:
   trunk/gert/standalone/known-issues
Log:
Added test for bug #317448.


Added: trunk/gert/standalone/bug317488/default.build
===================================================================
--- trunk/gert/standalone/bug317488/default.build       2007-11-08 19:12:42 UTC 
(rev 89233)
+++ trunk/gert/standalone/bug317488/default.build       2007-11-08 19:17:20 UTC 
(rev 89234)
@@ -0,0 +1,58 @@
+<project name="bug317488" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+       </target>
+
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="out" />
+                               <include name="test.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="build">
+               <property name="original.targetframework" 
value="${nant.settings.currentframework}" />
+
+               <foreach property="framework" item="String" in="${frameworks}" 
delim=",">
+                       <if test="${framework::exists(framework)}">
+                               <property name="nant.settings.currentframework" 
value="${framework}" />
+                               <call 
target="${nant.settings.currentframework}" />
+                               <call target="run" />
+                               <call target="clean" />
+                       </if>
+               </foreach>
+
+               <property name="nant.settings.currentframework" 
value="${original.targetframework}" />
+       </target>
+
+       <target name="compile">
+               <csc target="exe" output="test.exe" define="${csc.defines}" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="test.cs" />
+                       </sources>
+               </csc>
+       </target>
+
+       <target name="run" depends="compile">
+               <exec program="test.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+       </target>
+
+       <target name="rebuild" depends="clean, build" />
+</project>


Property changes on: trunk/gert/standalone/bug317488/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug317488/test.cs
===================================================================
--- trunk/gert/standalone/bug317488/test.cs     2007-11-08 19:12:42 UTC (rev 
89233)
+++ trunk/gert/standalone/bug317488/test.cs     2007-11-08 19:17:20 UTC (rev 
89234)
@@ -0,0 +1,63 @@
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Reflection.Emit;
+
+public class Program
+{
+       static int Main ()
+       {
+               AssemblyName assemblyName = new AssemblyName ();
+               assemblyName.Name = "customMod";
+               assemblyName.Version = new Version (1, 2, 3, 4);
+
+               AssemblyBuilder assembly
+                       = Thread.GetDomain ().DefineDynamicAssembly (
+                                 assemblyName, 
AssemblyBuilderAccess.RunAndSave);
+
+               ModuleBuilder module = assembly.DefineDynamicModule ("res", 
"res.dll");
+
+               TypeBuilder tb = module.DefineType ("Test2", 
TypeAttributes.Public, typeof (object));
+
+               {
+                       MethodBuilder mb =
+                               tb.DefineMethod ("test", 
MethodAttributes.Public | MethodAttributes.Static,
+                                                                typeof 
(object), null);
+                       ILGenerator il = mb.GetILGenerator ();
+
+                       il.Emit (OpCodes.Newobj, typeof (Bar).GetConstructor 
(new Type [] { }));
+                       il.Emit (OpCodes.Ldftn, typeof (FOO).GetMethod 
("handler"));
+                       il.Emit (OpCodes.Newobj, typeof 
(ResolveEventHandler).GetConstructor (new Type [] { typeof (object), typeof 
(IntPtr) }));
+                       il.Emit (OpCodes.Ldnull);
+                       il.Emit (OpCodes.Ldnull);
+                       il.Emit (OpCodes.Call, typeof 
(ResolveEventHandler).GetMethod ("Invoke"));
+                       il.Emit (OpCodes.Ret);
+               }
+
+               Type t = tb.CreateType ();
+
+               Object obj = Activator.CreateInstance (t, new object [0] { });
+
+               Assembly a = (Assembly) t.GetMethod ("test").Invoke (obj, null);
+               if (a != typeof (int).Assembly)
+                       return 1;
+               return 0;
+       }
+
+       public interface FOO
+       {
+               Assembly handler (object sender, ResolveEventArgs e);
+       }
+
+       public class Bar : FOO
+       {
+               public Bar ()
+               {
+               }
+
+               public Assembly handler (object sender, ResolveEventArgs e)
+               {
+                       return typeof (int).Assembly;
+               }
+       }
+}


Property changes on: trunk/gert/standalone/bug317488/test.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues  2007-11-08 19:12:42 UTC (rev 89233)
+++ trunk/gert/standalone/known-issues  2007-11-08 19:17:20 UTC (rev 89234)
@@ -76,6 +76,7 @@
 bug82796/**
 bug82799/**
 bug315969/**
+bug317448/**
 bug319456/**
 bug319992/**
 bug321615/**
@@ -112,4 +113,5 @@
 bug338242/**
 bug338782/**
 bug339330/**
+bug339538/**
 bug339934/**

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to