Author: gert
Date: 2007-10-12 10:57:13 -0400 (Fri, 12 Oct 2007)
New Revision: 87396
Added:
trunk/gert/standalone/bug333342/
trunk/gert/standalone/bug333342/default.build
trunk/gert/standalone/bug333342/test1.cs
trunk/gert/standalone/bug333342/test2.cs
Modified:
trunk/gert/standalone/known-issues
Log:
Added tests for bug #333342.
Added: trunk/gert/standalone/bug333342/default.build
===================================================================
--- trunk/gert/standalone/bug333342/default.build 2007-10-12 14:29:06 UTC
(rev 87395)
+++ trunk/gert/standalone/bug333342/default.build 2007-10-12 14:57:13 UTC
(rev 87396)
@@ -0,0 +1,68 @@
+<project name="bug332409" 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="test1.exe" />
+ <include name="test2.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" define="${csc.defines}" output="test1.exe"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="test1.cs" />
+ </sources>
+ </csc>
+ <csc target="exe" define="${csc.defines}" output="test2.exe"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="test2.cs" />
+ </sources>
+ </csc>
+ </target>
+
+ <target name="run" depends="compile">
+ <exec program="test1.exe" managed="true" output="out" />
+ <fail if="${file::exists('out')}">#1</fail>
+ <exec program="test2.exe" managed="true" output="out"
resultproperty="test2.result" failonerror="false" />
+ <fail if="${int::parse(test2.result) == 0}">#2</fail>
+ <loadfile file="out" property="out" />
+ <fail unless="${string::index-of(out,'Unhandled Exception:
System.TypeLoadException: Synchronized Method in Value Type.') != -1}">#3</fail>
+ </target>
+
+ <target name="rebuild" depends="clean, build" />
+</project>
Property changes on: trunk/gert/standalone/bug333342/default.build
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug333342/test1.cs
===================================================================
--- trunk/gert/standalone/bug333342/test1.cs 2007-10-12 14:29:06 UTC (rev
87395)
+++ trunk/gert/standalone/bug333342/test1.cs 2007-10-12 14:57:13 UTC (rev
87396)
@@ -0,0 +1,36 @@
+using System;
+using System.Reflection;
+
+struct T
+{
+ public delegate void Do ();
+ public event Do MyDo2;
+
+ static int Main ()
+ {
+ T t = new T ();
+ B.test (ref t);
+ t.MyDo2 ();
+
+ MethodInfo m = typeof (T).GetMethod ("add_MyDo2",
BindingFlags.Public | BindingFlags.Instance);
+ MethodImplAttributes implAttr = m.GetMethodImplementationFlags
();
+ if (implAttr != MethodImplAttributes.Managed)
+ return 1;
+
+ m = typeof (T).GetMethod ("remove_MyDo2", BindingFlags.Public |
BindingFlags.Instance);
+ implAttr = m.GetMethodImplementationFlags ();
+ if (implAttr != MethodImplAttributes.Managed)
+ return 2;
+
+ return 0;
+ }
+}
+
+class B
+{
+ static void p () { }
+ public static void test (ref T t)
+ {
+ t.MyDo2 += p;
+ }
+}
Property changes on: trunk/gert/standalone/bug333342/test1.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug333342/test2.cs
===================================================================
--- trunk/gert/standalone/bug333342/test2.cs 2007-10-12 14:29:06 UTC (rev
87395)
+++ trunk/gert/standalone/bug333342/test2.cs 2007-10-12 14:57:13 UTC (rev
87396)
@@ -0,0 +1,18 @@
+using System.Runtime.CompilerServices;
+
+struct Test
+{
+ [MethodImplAttribute (MethodImplOptions.Synchronized)]
+ public int test ()
+ {
+ return 2 + 2;
+ }
+
+ static int Main (string [] args)
+ {
+ Test b = new Test ();
+ int res = b.test ();
+
+ return 0;
+ }
+}
Property changes on: trunk/gert/standalone/bug333342/test2.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues 2007-10-12 14:29:06 UTC (rev 87395)
+++ trunk/gert/standalone/known-issues 2007-10-12 14:57:13 UTC (rev 87396)
@@ -89,3 +89,4 @@
bug332163/**
bug332206/**
bug332409/**
+bug333342/**
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches