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

Janne Rantala janne.rantala at gmail.com
Wed Jul 26 07:32:21 EDT 2006


Hi,

I've loaded assembly (compiled in 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.aspxsays
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.Stringsection
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.Stringcoun
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060726/76b07cb7/attachment.html 


More information about the Mono-devel-list mailing list