[Mono-dev] Assembly.GetEntryAssembly() returns null
Michał Ziemski
rook at roo.k.pl
Tue Nov 7 09:19:45 EST 2006
Hi!
I've just tripped on this one.
This time under mod_mono.
This is very bad as it crashes WaitHandle.WaitAll under mod_mono.
Filed a bug #79859.
Cheers!
Michał Ziemski
Janne Rantala napisał(a):
> Hi,
>
> I've loaded assembly (compiled in VS.NET <http://VS.NET>) in embedded
> environment. This assembly is supposed to work as a client for web
> service. However this does not work because Assembly.GetEntryAssembly
> returns null when called from managed code. This causes
> ConfigurationManager to throw ArgumentException stating that "exePath
> must be specified when not running inside a stand alone exe".
>
> MSDN
> http://msdn2.microsoft.com/en-us/library/system.reflection.assembly.getentryassembly.aspx
> says that
>
> "Return Value
> The Assembly that is the process executable in the default application
> domain, or the first executable that was executed by
> AppDomain.ExecuteAssembly. Can return a null reference (Nothing in
> Visual Basic) when called from unmanaged code."
>
> But since this call is made from managed code it should return
> something else than null? Both Assembly.GetCallingAssembly() and
> Assembly.GetExecutingAssembly return the assembly I've loaded.
>
> Is this a bug?
>
> Here's the full stack trace if it's any help:
>
> Unhandled Exception: System.TypeInitializationException : An exception
> was thrown
> by the type initializer for System.Net.WebRequest --->
> System.ArgumentException
>
> : exePath must be specified when not running inside a stand alone exe.
> at
> System.Configuration.ConfigurationManager.OpenExeConfigurationInternal
> (Con
> figurationUserLevel userLevel, System.Reflection.Assembly
> calling_assembly, Syst
> em.String exePath) [0x00000]
> at
> System.Configuration.ClientConfigurationSystem.System.Configuration.Interna
>
> l.IInternalConfigSystem.GetSection (System.String configKey) [0x00000]
> at System.Configuration.ConfigurationManager.GetSection
> (System.String section
> Name) [0x00000]
> at System.Net.WebRequest..cctor () [0x00000] --- End of inner
> exception stack
> trace ---
>
> at <0x00000> <unknown method>
> at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest
> (System.Uri u
> ri) [0x00000]
> at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest
> (System.U
> ri uri) [0x00000]
> at
> System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest
> (System.
> Uri uri) [0x00000]
> at
> System.Web.Services.Protocols.SoapHttpClientProtocol.GetRequestForMessage
> (
> System.Uri uri, System.Web.Services.Protocols.SoapClientMessage
> message) [0x0000
> 0]
> at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
> (System.String
> method_name, System.Object[] parameters) [0x00000]
> at WSTest.net.xmethods.www.CurrencyExchangeService.getRate
> (System.String coun
> try1, System.String country2) [0x00000]
> at (wrapper remoting-invoke-with-check)
> WSTest.net.xmethods.www.CurrencyExchan
> geService:getRate (string,string)
> at WSTest.Class1.WebServiceTest () [0x00000]
>
> Cheers,
>
> Janne
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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