[Mono-dev] Embedded mono bug "The 'ExeConfigFilename' argument cannot be null"

Tim Matthews tim.matthews7 at gmail.com
Thu Jun 13 09:19:03 UTC 2013


I've submitted this bug: https://bugzilla.xamarin.com/show_bug.cgi?id=12669


On Sat, Jun 8, 2013 at 3:17 PM, Tim Matthews <tim.matthews7 at gmail.com>wrote:

> Hi I noticed a bug that was introduced in Mono 3 for embedding mono:
>
> #include <glib.h>
> #include <mono/jit/jit.h>
> #include <mono/metadata/assembly.h>
> #include <mono/metadata/debug-helpers.h>
> #include <mono/metadata/object.h>
>
> #include <stdio.h>
>
> int
> main (int argc, char* argv[]) {
>     MonoDomain *domain;
>     MonoImage *image;
>   MonoAssemblyName *assemName;
>   MonoAssembly *assem;
>   MonoMethodDesc* desc;
>   MonoMethod* method;
>
>   mono_config_parse(NULL);
>     domain = mono_jit_init (argv [0]);
>
>   assemName = mono_assembly_name_new("System.Windows.Forms,
> Culture=neutral, PublicKeyToken=b77a5c561934e089");
>   assem = mono_assembly_load(assemName, NULL, NULL);
>   image = mono_assembly_get_image(assem);
>   desc =
> mono_method_desc_new("System.Windows.Forms.Application:EnableVisualStyles()",
> 1);
>   method = mono_method_desc_search_in_image(desc, image);
>
>   printf("About to crash\n");
>
>   mono_runtime_invoke(method, NULL, NULL, NULL);  //crash
>
>     mono_jit_cleanup (domain);
>     return 0;
> }
>
>
>
>
> Produces the following output:
>
> % ./a.out
> About to crash
>
> Unhandled Exception:
> System.TypeInitializationException: An exception was thrown by the type
> initializer for System.Windows.Forms.XplatUI --->
> System.TypeInitializationException: An exception was thrown by the type
> initializer for System.Net.Sockets.Socket --->
> System.Configuration.ConfigurationErrorsException: Error Initializing the
> configuration system. ---> System.ArgumentException: The
> 'ExeConfigFilename' argument cannot be null.
>   at System.Configuration.ExeConfigurationHost.CheckFileMap
> (ConfigurationUserLevel level, System.Configuration.ExeConfigurationFileMap
> map) [0x00000] in <filename unknown>:0
>   at System.Configuration.ExeConfigurationHost.InitForConfiguration
> (System.String& locationSubPath, System.String& configPath, System.String&
> locationConfigPath, IInternalConfigRoot root, System.Object[]
> hostInitConfigurationParams) [0x00000] in <filename unknown>:0
>   at System.Configuration.InternalConfigurationSystem.InitForConfiguration
> (System.String& locationConfigPath, System.String& parentConfigPath,
> System.String& parentLocationConfigPath) [0x00000] in <filename unknown>:0
>   at System.Configuration.Configuration..ctor
> (System.Configuration.InternalConfigurationSystem system, System.String
> locationSubPath) [0x00000] in <filename unknown>:0
>   at System.Configuration.InternalConfigurationFactory.Create (System.Type
> typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in
> <filename unknown>:0
>   at
> System.Configuration.ConfigurationManager.OpenExeConfigurationInternal
> (ConfigurationUserLevel userLevel, System.Reflection.Assembly
> calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0
>   at System.Configuration.ClientConfigurationSystem.get_Configuration ()
> [0x00000] in <filename unknown>:0
>   --- End of inner exception stack trace ---
>   at System.Configuration.ClientConfigurationSystem.get_Configuration ()
> [0x00000] in <filename unknown>:0
>   at
> System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
> (System.String configKey) [0x00000] in <filename unknown>:0
>   at System.Configuration.ConfigurationManager.GetSection (System.String
> sectionName) [0x00000] in <filename unknown>:0
>   at System.Net.Sockets.Socket.CheckProtocolSupport () [0x00000] in
> <filename unknown>:0
>   at System.Net.Sockets.Socket..cctor () [0x00000] in <filename unknown>:0
>   --- End of inner exception stack trace ---
>   at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle)
> [0x00000] in <filename unknown>:0
>   at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename
> unknown>:0
>   at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename
> unknown>:0
>   at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename
> unknown>:0
>   --- End of inner exception stack trace ---
>   at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in
> <filename unknown>:0
> [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An
> exception was thrown by the type initializer for
> System.Windows.Forms.XplatUI ---> System.TypeInitializationException: An
> exception was thrown by the type initializer for System.Net.Sockets.Socket
> ---> System.Configuration.ConfigurationErrorsException: Error Initializing
> the configuration system. ---> System.ArgumentException: The
> 'ExeConfigFilename' argument cannot be null.
>   at System.Configuration.ExeConfigurationHost.CheckFileMap
> (ConfigurationUserLevel level, System.Configuration.ExeConfigurationFileMap
> map) [0x00000] in <filename unknown>:0
>   at System.Configuration.ExeConfigurationHost.InitForConfiguration
> (System.String& locationSubPath, System.String& configPath, System.String&
> locationConfigPath, IInternalConfigRoot root, System.Object[]
> hostInitConfigurationParams) [0x00000] in <filename unknown>:0
>   at System.Configuration.InternalConfigurationSystem.InitForConfiguration
> (System.String& locationConfigPath, System.String& parentConfigPath,
> System.String& parentLocationConfigPath) [0x00000] in <filename unknown>:0
>   at System.Configuration.Configuration..ctor
> (System.Configuration.InternalConfigurationSystem system, System.String
> locationSubPath) [0x00000] in <filename unknown>:0
>   at System.Configuration.InternalConfigurationFactory.Create (System.Type
> typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in
> <filename unknown>:0
>   at
> System.Configuration.ConfigurationManager.OpenExeConfigurationInternal
> (ConfigurationUserLevel userLevel, System.Reflection.Assembly
> calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0
>   at System.Configuration.ClientConfigurationSystem.get_Configuration ()
> [0x00000] in <filename unknown>:0
>   --- End of inner exception stack trace ---
>   at System.Configuration.ClientConfigurationSystem.get_Configuration ()
> [0x00000] in <filename unknown>:0
>   at
> System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
> (System.String configKey) [0x00000] in <filename unknown>:0
>   at System.Configuration.ConfigurationManager.GetSection (System.String
> sectionName) [0x00000] in <filename unknown>:0
>   at System.Net.Sockets.Socket.CheckProtocolSupport () [0x00000] in
> <filename unknown>:0
>   at System.Net.Sockets.Socket..cctor () [0x00000] in <filename unknown>:0
>   --- End of inner exception stack trace ---
>   at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle)
> [0x00000] in <filename unknown>:0
>   at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename
> unknown>:0
>   at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename
> unknown>:0
>   at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename
> unknown>:0
>   --- End of inner exception stack trace ---
>   at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in
> <filename unknown>:0
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130613/88e2cfef/attachment.html>


More information about the Mono-devel-list mailing list