[Mono-devel-list] Re: Assembly Unloading

Jim Purbrick jimpurbrick at yahoo.co.uk
Thu May 26 12:43:47 EDT 2005

Hi Zoltan,

> Appdomains should be unloaded using
> mono_domain_unload (), not
> mono_domain_free (). 

mono_domain_unload() only seems to be declared and
defined within appdomain.c, is there any reason for
this, or could it be declared in appdomain.h so I can
call it?

When I removed all the calls to mono_domain_free the
application ran fine, just as when I was running it
with a single appdomain (but obviously not unloading
anything). So, the calls to mono_domain_free seem to
be the problem.

> The current domain of the
> current thread can be set
> using mono_domain_set ().

When I try calling mono_domain_set () immediately
after creating the new domains with mono_domain_create
(), I get a crash the first time I try to save a
thread to disk. Is this becuase I need to set the new
domains up somehow? Is this because it's looking for
types in the new domain when it serializes and can't
find them? Am I right in thinking the current domain
is used to load assemblues when deserializing objects?
What else is the current domain used for? 



The call stack I get when trying to serialize the
thread after calling mono_domain_set is shown below.

System.NullReferenceException: Object reference not
set to an instance of an obj
in <0x0023d>
teMetadataType (System.Type type, StreamingContext
in <0x00037>
emberTypeMetadata (System.Type type)
in <0x00587>
ctData (System.Object obj,
tadata metadata, System.Object data)
in <0x0003f>
ject (System.IO.BinaryWriter writer, Int64 id,
System.Object obj)
in <0x0014d>
jectInstance (System.IO.BinaryWriter writer,
System.Object obj, Boolean isValueO
in <0x00039>
euedObjects (System.IO.BinaryWriter writer)
in <0x00049>
jectGraph (System.IO.BinaryWriter writer,
System.Object obj, System.Runtime.Remo
ting.Messaging.Header[] headers)
in <0x002ce>
alize (System.IO.Stream serializationStream,
System.Object graph, System.Runtime
.Remoting.Messaging.Header[] headers)
in <0x00015>
alize (System.IO.Stream serializationStream,
System.Object graph)
in <0x000b5> UThread.UThread:Save (System.String filename)

Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

More information about the Mono-devel-list mailing list