[Mono-list] AppDomain Unload and references

Varga Zoltan vargaz@freemail.hu
Tue, 9 Sep 2003 18:46:30 +0200 (CEST)


=20
                                            Hi,

   Appdomain unloading does not work under mono at the moment. I
think it would be best to make Unload () throw a
NotImplementedException, because otherwise people think that
this method works, when it isn't.

                                    Zoltan


Piyush  Garyali <piyush_garyali@rediffmail.com> =EDrta:

> Hello,
>=20
> I was trying the following C# snippet and it works fine on=20
> Windows-MSCLR but throws an exception on Windows-Cygwin-mono.
>=20
> using System;
> using System.Runtime.Remoting
>=20
> [Serializable]
> class test
> {
>      public int xxx =3D 10;
>      static void Main()
>      {
>          AppDomain domain =3D AppDomain.CreateDomain("domain1");
>          ObjectHandle oh =3D=20
> domain.CreateInstance(typeof(test).Assembly.FullName,=20
> typeof(test).FullName );
>=20
>          test myObj =3D  (test)oh.Unwrap();
>=20
>          AppDomain.Unload(domain);
>=20
>          myObj.Print();
>          int a =3D  myObj.xxx;
>=20
>          Console.WriteLine(" Value : {0}", a);
>          Console.WriteLine(" Value : {0}", myObj.xxx);
>          Console.ReadLine();
>      }
>      void print()
>      {
>          Console.WriteLine(" AAA ");
>      }
> }
>=20
> Am I doing something wrong here, for if this code works on
MSCLR,=20
> why does it throw an exception with mono? Does it mean
that the=20
> MS-CLR takes care of the refernces even after the
AppDomain is=20
> Unloaded and mono can't ?
>=20
> Thanks in advance,
>=20
> Regards,
> -pG-
> ___________________________________________________
> Medicine meets Marketing; Dr. Swati Weds Jayaram.
> Rediff Matchmaker strikes another interesting match !!
> Visit http://rediff.com/matchmaker?2
>=20
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>=20
>=20
>=20