[Mono-dev] Embedding w/ Config Errors | No Entry Assembly

Matthew Metnetsky met at uberstats.com
Sat Sep 5 14:30:00 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

As some might have picked up I'm embedding Mono into a project and all
is mostly going well. While trying to tie together .NET objects with
GObject's via compiled MonoMethod thunks I hit a snag.

System.TypeInitializationException: An exception was thrown by the type
initializer for System.Xml.Serialization.XmlSerializer --->
System.Configuration.ConfigurationErrorsException: Error Initializing
the configuration system. ---> System.NullReferenceException: Object
reference not set to an instance of an object

After digging through a bit it looks like the static .ctor of
XmlSerializer calls ConfigurationSettings.GetConfig which triggers a
chain of methods getting called to find the configuration for the
Assembly.GetEntryAssembly().

Sadly the entry assembly is NULL so the whole system goes BOOM! Mono is
embedded so that I can instantiate classes and then some methods from C.
As there is no EXE how can I properly LIE to the framework so it'll
believe there is one?

Finally, I'm initializing the runtime like so:

  mono_config_parse(NULL);
  domain = mono_jit_init_version("Blox", "v2.0.50727");

And then calling mono_domain_assembly_open(domain, "Other.dll")
each time I load a new DLL.

I've tried mono_jit_init("../to/some/actual/dll") and that failed too.

Thoughts/suggestions anyone?

Thanks!

~ Matthew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqiriYACgkQLrcoBjlTBf0QHQCcD60sqkIL+LYWREYa9ZKaAWFN
U68An0bwkEdRZ5VZMzyX+VLTlFG3dL5K
=TEGX
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: config-stack.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090905/02028d4c/attachment.txt 


More information about the Mono-devel-list mailing list