[Mono-devel-list] native to managed calls & domains

Bernie Solomon bernard at ugs.com
Thu Aug 26 11:14:48 EDT 2004


I have noticed that currently native to managed calls do not ensure that the
managed code is executing properly in the domain of the delegate as they
should. I believe the wrapper should set the domain before executing the
managed code and reset it afterwards. Otherwise managed callbacks in
multiple domains that get registered to listen to native events don't
execute properly.

Before trying to fix this I thought I'd check my approach is plausible. When
creating a managed wrapper this would become per domain and the wrapper
would save the current domain, set the domain of the delegate, do what it
does now and then restore the domain with suitable exception handling added.
The cache of such wrappers would then be per domain and not per image as it
currently is.

Also it might be convenient if when embedding that mono_runtime_invoke also
ensured that execution was in the correct domain - at least for instance
methods - though of course if arguments are objects the caller must ensure
that they are in the correct domain too. Or perhaps a new
mono_runtime_invoke_in_domain function might work too as this allows static
methods to be invoked correctly as well.

Anyone have comments?

Bernie Solomon




More information about the Mono-devel-list mailing list