[Mono-dev] Assembly.GetEntryAssembly() returns null
Atsushi Eno
atsushi at ximian.com
Fri Jul 28 08:34:13 EDT 2006
Hi,
Janne Rantala wrote:
> 2006/7/27, Miguel de Icaza <miguel at ximian.com>:
>>
>> Hello,
>>
>> > 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".
>>
>> It sounds like you might be missing some call to initialize the embedded
>> runtime. I have seen that in the past, but I do not remember what it
>> was
>>
>
> Hi,
>
> That was it. I wrote in my previous post that I had to to
> mono_runtime_exec_main call also because entry assembly is only set
> there. I
> thought that this call was needed for calling Main -method only.
>
> It would be nice to be able to just create objects without having to call
> Main method as well.
I don't think it is always nice to allow that. If a user forgot
to run his or her code properly to prepare for loading configuration
like this case, he or she will never understand why his or her
configuration is not reflected at all.
But well, we could say that it's the user's fault. I would basically
like to allow allow code accessing configuration without entry
assembly setup.
So, if no further argument, the System.Configuration code would be
changed to allow entrypoint-less setup (especially considering
the case that an embedded runtime is used for running an ASP.NET
server).
Atsushi Eno
More information about the Mono-devel-list
mailing list