[Mono-list] AppDomain problems

RoBiK robik@mailbox.sk
17 May 2004 14:21:23 +0200


Hi, i try to use an AppDomain, but have serious problems. I'm using RH9
wirt mono beta 1 instaleld from the rpms.

Test program:

using System;

class Test : MarshalByRefObject
{
	public void DoTest()
	{
		Console.WriteLine("DoTest()");
	}
}

class MainClass
{
	public static void Main(string[] args)
	{
		AppDomain ad = AppDomain.CreateDomain("Test");
		Test t = (Test)ad.CreateInstanceAndUnwrap("AppDomainTest", "Test");
		t.DoTest();
		t = null;
		AppDomain.Unload(ad);
	}
}

Output:

DoTest()
 
Unhandled Exception: System.NullReferenceException: Object reference not
set to
an instance of an object
 
** (AppDomainTest.exe:5828): WARNING **: : error looking up thread
handle 0x84c91c4
 
** (AppDomainTest.exe:5828): WARNING **: Aborting of threads in domain
Test timed out.
 
Unhandled Exception: System.CannotUnloadAppDomainException: Aborting of
threads
in domain Test timed out.
in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x20)
[0x400c3ad8]
in (unmanaged) /usr/lib/libmono.so.0 [0x400ec901]
in (unmanaged) /usr/lib/libmono.so.0 [0x400ec19f]
in [0x00017] (at /cvs/mcs/class/corlib/System/AppDomain.cs:635)
System.AppDomain:Unload (System.AppDomain)
in [0x0002a] (at
/root/.local/share/MonoDevelopProjects/AppDomainTest/Main.cs:21)
MainClass:Main (string[])



Is this a serious bug or am i missing something?

The second (not so big) problem is the setting of private paths for the
AppDomain. I use AppDomainSetup.PrivateBinPath property to set the value
before i create the domain. It works fine, when using single search
path, but when i try to use semicolon separated list of paths, AppDomain
treats this as single path instead of parsing this string to get the
list.

see the documentation from MS:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemappdomainsetupclassprivatebinpathtopic.asp

The workaround is to create the appdomain and then use the
AppendPrivatePath method.

Robert