[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()

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


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
in domain Test timed out.
in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x20)
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
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

see the documentation from MS:

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