[Mono-bugs] [Bug 77436][Nor] New - Appdomain unloading doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Feb 1 10:42:16 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by joe at otee.dk.

http://bugzilla.ximian.com/show_bug.cgi?id=77436

--- shadow/77436	2006-02-01 10:42:16.000000000 -0500
+++ shadow/77436.tmp.8006	2006-02-01 10:42:16.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 77436
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: joe at otee.dk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Appdomain unloading doesn't work
+
+Appdomains don't seem to be unloaded correctly.
+When i create a domain, execute an assembly in it, then unload it again, the executed assembly 
+will not get unloaded.
+
+When i create a new app domain and try to load the executable at the same path again, but in 
+between have modified the assembly, then i will still get the old assembly i loaded earlier.
+
+
+Run the following code
+mcs AssemblyStressTest.cs
+mono AssemblyStressTest.exe
+
+If you are not running this code from Mac OS X you will have to modify the paths to mcs and 
+libMonoPosixHelper.
+
+C# code:
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.IO;
+using System.Runtime.InteropServices;
+
+/*
+ This should print 
+ 0
+ 1
+ 2
+ 3
+ 3
+ 4
+*/
+
+class Test
+{
+	[DllImport ("/Library/Frameworks/Mono.framework/Libraries/libMonoPosixHelper.dylib", 
+CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+	public static extern int system (string @string);
+
+	static void Main (string[] commands)
+	{
+		for (int i=0;i<5;i++)
+		{
+			StreamWriter sw = new StreamWriter("GeneratedAssembly.cs");
+			sw.Write("public class AssemblyStress { static void Main()  
+{ System.Console.WriteLine(");
+			sw.Write(i.ToString());
+			sw.Write("); } }\n");
+			sw.Close();
+			system("/Library/Frameworks/Mono.framework/Commands/mcs 
+GeneratedAssembly.cs");
+
+			AppDomain tempDomain = AppDomain.CreateDomain("TempDomain");
+			tempDomain.ExecuteAssembly("GeneratedAssembly.exe");
+			
+			AppDomain.Unload(tempDomain);
+		}
+	}
+}


More information about the mono-bugs mailing list