[Mono-dev] mkbundle + app.config

Alex Shulgin alexander.shulgin at yessoftware.com
Tue Sep 15 11:19:31 EDT 2009


Alex Shulgin wrote:
> Alex Shulgin wrote:
>> Later, then ConfigurationManager is trying to load .config file for the 
>> assembly, it uses the fake name and naturally doesn't see a file named 
>> data-xxx.config near the bundled assembly.
>>
>> I don't think it's possible to make use of bundled assemblies 
>> information buried in mono internals (mono/metadata/assebmbly.c).
> 
> I mean it's not possible to use that info _from 
> System.ConfigurationManager_.

There's also a problem with embedding machine config.

It was reported before and fixed[1], but now it's broken again.

The below patch is enough to resolve the problem for me.

--
Regards,
Alex

[1] https://bugzilla.novell.com/show_bug.cgi?id=325022


Index: mcs/class/System.Configuration/System.Configuration/Configuration.cs
===================================================================
--- 
mcs/class/System.Configuration/System.Configuration/Configuration.cs 
(revision 141143)
+++ 
mcs/class/System.Configuration/System.Configuration/Configuration.cs 
(working copy)
@@ -449,10 +449,14 @@
  			if (String.IsNullOrEmpty (streamName))
  				return true;

-			if (!File.Exists (streamName))
-				return false;
+			// Don't check if file exists here as this will cause
+			// bundled machine config to be skipped on machines w/o
+			// mono installed.

-			Stream stream = stream = system.Host.OpenStreamForRead (streamName);
+			//if (!File.Exists (streamName))
+			//	return false;
+
+			Stream stream = system.Host.OpenStreamForRead (streamName);
  			using (XmlTextReader reader = new ConfigXmlTextReader (stream, 
streamName)) {
  				ReadConfigFile (reader, streamName);
  			}


More information about the Mono-devel-list mailing list