[Mono-bugs] [Bug 325022] system.diagnostics setting is not find in mkbundled machine.config

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Sep 17 08:55:38 EDT 2009


User alexander.shulgin at yessoftware.com added comment

--- Comment #5 from Alex Shulgin <alexander.shulgin at yessoftware.com>  2009-09-17 06:55:35 MDT ---
But did you try removing installed machine.config for the sake of testing? 
Remember, you are going to use mkbundle to run the app on machines w/o mono

I still experience the problem with both mono-2-4 and mono-2-4-2 branches
(updated to the latest revisions).

Well, I must admit, the issue at hand is a bit complicated.

First, in order to get a config file for a bundled assembly loaded correctly
another problem in mono needs to be fixed[1].

Apply patch #1:

mono-2-4/mono$ patch -p0 <fix-bundled-image-name.patch

Next, compile sample code:

$ gmcs test.cs -r:System.Configuration
$ mkbundle2 test.exe --machine-config /usr/local/etc/mono/2.0/machine.config

And run it:

$ ./a.out
AppSettings: 'ZZZ'

This is working only because /usr/local/etc/mono/2.0/machine.config is in
place.  Try removing it and you'll get:

Unhandled Exception: System.Configuration.ConfigurationErrorsException: Error
Initializing the configuration system. --->
System.Configuration.ConfigurationErrorsException: Unrecognized configuration
section <appSettings>
  at System.Configuration.ConfigInfo.ThrowException (System.String text,
System.Xml.XmlReader reader) [0x00000] 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader
reader, System.Configuration.Configuration config, Boolean overrideAllowed,
Boolean root) [0x00000]

To fix this, apply patch #2:

mono-2-4/mcs$ patch -p0 <fix-loading-bundled-machine-config.patch

Then recompile System.Configuration.dll (don't forget to put machine.config
back before compiling (-: ).

Finally, remove machine.config again and try running the bundled sample.  This
time it should be OK:

$ ./a.out
AppSettings: 'ZZZ'

PS: I'm attaching patches and sample code in the next comments.

[1] http://go-mono.com/forums/#nabble-td25438426

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list