[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? 

Cheers,

Jim.

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
ect
in <0x0023d>
System.Runtime.Serialization.Formatters.Binary.CodeGenerator:Genera
teMetadataType (System.Type type, StreamingContext
context)
in <0x00037>
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:CreateM
emberTypeMetadata (System.Type type)
in <0x00587>
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:GetObje
ctData (System.Object obj,
System.Runtime.Serialization.Formatters.Binary.TypeMe
tadata metadata, System.Object data)
in <0x0003f>
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteOb
ject (System.IO.BinaryWriter writer, Int64 id,
System.Object obj)
in <0x0014d>
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteOb
jectInstance (System.IO.BinaryWriter writer,
System.Object obj, Boolean isValueO
bject)
in <0x00039>
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteQu
euedObjects (System.IO.BinaryWriter writer)
in <0x00049>
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteOb
jectGraph (System.IO.BinaryWriter writer,
System.Object obj, System.Runtime.Remo
ting.Messaging.Header[] headers)
in <0x002ce>
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Seri
alize (System.IO.Stream serializationStream,
System.Object graph, System.Runtime
.Remoting.Messaging.Header[] headers)
in <0x00015>
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Seri
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