[Mono-dev] Assembly.GetEntryAssembly() returns null

Sebastien Pouliot sebastien.pouliot at gmail.com
Tue Nov 7 15:22:40 EST 2006


On Tue, 2006-11-07 at 21:13 +0100, Michał Ziemski wrote:
> Hi!
> 
> The code I posted originally in the bug report might have been a little 
> misleading.
> I did an additional comment with more appropriate code later.
> 
> I wasn't realy sure where the real bug belonged 
> System.Reflection.Assembly or System.Runtime.WaitHandle.
> There seems to ba a patch posted for that already (great job guys!!) for 
> System.Runtime.WaitHandle,
> so I assume the problem was there.
> 
> But IMHNRBOAIKO (in my humble, not really based on any indepth 
> knwoledge, opinion)
> Assembly.GetEntryAssembly shouldn't be null inside an assembly loaded by 
> mod_mono.

Assembly.GetEntryAssembly() is documented (MSDN) to return null is
called outside the default appdomain (*) or if the assembly was loaded
from an unmanaged host application.

(*) the entry assembly may not be loaded in the current appdomain

Again this looks like an easy Gendarme rule that would be useful for
library writers ;-)

> MS Docs state that this could be null if loaded from an unmanaged code 
> and mod-mono-server2 doesn't count as such.
> 
> The thread I followed up was in fact about a different bug.
> I've relied too much on the title. Sorry for confusing that and thank 
> you for pointing it out.
> 
> Cheers!
> Michał Ziemski
> Atsushi Eno napisał(a):
> > Hi,
> >
> > If WaitHandle.WaitAll itself or its internal expects that the entry
> > assembly must not be null, then it is likely a bug. However, to my 
> > understanding your bug #79859 expects its existence at *your* code.
> > So, it is your code which is buggy since it should consider null
> > entry assembly.
> >
> > Also notice that this thread is basically about different bug (it
> > is rather about ConfigurationManager, which should not always expect 
> > entry assembly existence).
> >
> > Atsushi Eno
> >   
> 
> _______________________________________________
> 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