Author: gert
Date: 2007-11-07 05:58:10 -0500 (Wed, 07 Nov 2007)
New Revision: 89087

Added:
   trunk/gert/standalone/bug322435/
   trunk/gert/standalone/bug322435/default.build
   trunk/gert/standalone/bug322435/test.cs
Log:
Added test for bug #322435.


Added: trunk/gert/standalone/bug322435/default.build
===================================================================
--- trunk/gert/standalone/bug322435/default.build       2007-11-07 10:31:56 UTC 
(rev 89086)
+++ trunk/gert/standalone/bug322435/default.build       2007-11-07 10:58:10 UTC 
(rev 89087)
@@ -0,0 +1,58 @@
+<project name="bug322435" 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" define="${csc.defines}" output="test.exe" 
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/bug322435/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug322435/test.cs
===================================================================
--- trunk/gert/standalone/bug322435/test.cs     2007-11-07 10:31:56 UTC (rev 
89086)
+++ trunk/gert/standalone/bug322435/test.cs     2007-11-07 10:58:10 UTC (rev 
89087)
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.Remoting.Lifetime;
+
+public class Test
+{
+       static int Main ()
+       {
+               AppDomainSetup setup = new AppDomainSetup ();
+               setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
+               setup.ApplicationName = "test bug";
+
+               AppDomain newDomain = AppDomain.CreateDomain (
+                       setup.ApplicationName,
+                       AppDomain.CurrentDomain.Evidence, setup);
+               CrossDomainTesterA testerA = (CrossDomainTesterA)
+                       newDomain.CreateInstanceAndUnwrap (typeof 
(CrossDomainTesterA).Assembly.FullName,
+                       typeof (CrossDomainTesterA).FullName, false,
+                       BindingFlags.Public | BindingFlags.Instance, null,
+                       new object [] { new StringCollection () }, 
CultureInfo.InvariantCulture,
+                       new object [0], AppDomain.CurrentDomain.Evidence);
+               testerA.Do ();
+
+               return 0;
+       }
+
+       private class CrossDomainTesterA : MarshalByRefObject
+       {
+               public CrossDomainTesterA (StringCollection names)
+               {
+               }
+
+               public override Object InitializeLifetimeService ()
+               {
+                       ILease lease = (ILease) base.InitializeLifetimeService 
();
+                       if (lease.CurrentState == LeaseState.Initial) {
+                               lease.InitialLeaseTime = TimeSpan.Zero;
+                       }
+                       return lease;
+               }
+
+               public void Do ()
+               {
+                       AppDomainSetup setup = new AppDomainSetup ();
+                       setup.ApplicationBase = 
AppDomain.CurrentDomain.BaseDirectory;
+                       setup.ApplicationName = "test bug";
+
+                       AppDomain newDomain = AppDomain.CreateDomain (
+                               setup.ApplicationName,
+                               AppDomain.CurrentDomain.Evidence, setup);
+                       CrossDomainTesterB testerB = (CrossDomainTesterB)
+                               newDomain.CreateInstanceAndUnwrap (typeof 
(CrossDomainTesterB).Assembly.FullName,
+                               typeof (CrossDomainTesterB).FullName, false, 
BindingFlags.Public | BindingFlags.Instance,
+                               null, new object [] { new StringCollection () 
}, CultureInfo.InvariantCulture, new object [0],
+                               AppDomain.CurrentDomain.Evidence);
+                       testerB.GetTypedValue (new StringCollection (),
+                               new StringCollection (), null, null);
+               }
+       }
+
+       private class CrossDomainTesterB : MarshalByRefObject
+       {
+               public CrossDomainTesterB (StringCollection names)
+               {
+               }
+
+               public override Object InitializeLifetimeService ()
+               {
+                       ILease lease = (ILease) base.InitializeLifetimeService 
();
+                       if (lease.CurrentState == LeaseState.Initial) {
+                               lease.InitialLeaseTime = TimeSpan.Zero;
+                       }
+                       return lease;
+               }
+
+               public object GetTypedValue (StringCollection assemblies, 
StringCollection imports, string typename, string value)
+               {
+                       return assemblies.Count;
+               }
+       }
+}


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

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

Reply via email to