[Mono-list] AppDomain Unload and references

Piyush Garyali Piyush Garyali" <piyush_garyali@rediffmail.com
9 Sep 2003 16:16:20 -0000


Hello,

I was trying the following C# snippet and it works fine on 
Windows-MSCLR but throws an exception on Windows-Cygwin-mono.

using System;
using System.Runtime.Remoting

[Serializable]
class test
{
     public int xxx = 10;
     static void Main()
     {
         AppDomain domain = AppDomain.CreateDomain("domain1");
         ObjectHandle oh = 
domain.CreateInstance(typeof(test).Assembly.FullName, 
typeof(test).FullName );

         test myObj =  (test)oh.Unwrap();

         AppDomain.Unload(domain);

         myObj.Print();
         int a =  myObj.xxx;

         Console.WriteLine(" Value : {0}", a);
         Console.WriteLine(" Value : {0}", myObj.xxx);
         Console.ReadLine();
     }
     void print()
     {
         Console.WriteLine(" AAA ");
     }
}

Am I doing something wrong here, for if this code works on MSCLR, 
why does it throw an exception with mono? Does it mean that the 
MS-CLR takes care of the refernces even after the AppDomain is 
Unloaded and mono can't ?

Thanks in advance,

Regards,
-pG-
___________________________________________________
Medicine meets Marketing; Dr. Swati Weds Jayaram.
Rediff Matchmaker strikes another interesting match !!
Visit http://rediff.com/matchmaker?2