[Mono-dev] NullReferenceException on a callvirt... with a non-null reference? (please help!)

Zoltan Varga vargaz at gmail.com
Fri Jun 16 05:04:03 EDT 2006


  The fact that new appdomains have all assemblies loaded is clearly a bug, but
it can't be fixed easily because certain parts of the runtime, most notably the
remoting infrastructure seem to depend on this broken behaviour. Most likely
because the same assembly will be loaded separately into the two appdomains,
confusing the remoting code which expects them to be the same (ie. the same
MonoAssembly structure).


On 6/16/06, Brian Crowell <mono-devel at fluggo.com> wrote:
> Okay, while dealing with the whole AppDomains-should-be-empty-bug, I came across
> a strange phenomenon. After making sure that new AppDomains carry only the
> corlib, cross-domain calls to that AppDomain fail with a NullReferenceException.
> After careful examination, I've determined that this exception occurs inside the
> xdomain-wrapper method created in metadata/marshal.c. Specifically, it occurs
> during the callvirt instruction that *would* carry out the last step of the
> cross-domain call-- calling the method on the object in the next domain.
> Yet, by injecting Console.WriteLine calls into this code, I can show that the
> reference to the target object is, in fact, not null. So, I guess what I need to
> know is-- under what other conditions could a NullReferenceException occur on a
> callvirt (in x86)?
> I have a feeling this may have to do with the fact that the called method and
> the calling method come from two instances of the same assembly. Example: I have
> one AppDomain which pulls its assemblies from /foo, and the second which pulls
> it assemblies from /bar. Under the original implementation, these AppDomains
> would carry the same assemblies; that is, the ones that come from the original
> AppDomain. Under the new implementation, the assemblies are separately loaded
> from /foo and /bar, like they should be. So maybe the call-wrapping doesn't take
> this into account?
> I'm still working through this, but any help on this particular point would be
> appreciated.
> --Brian
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list