[Mono-dev] [PATCH] System.Configuration.ConfigurationManager

Elliott Draper el at eldiablo.co.uk
Wed Jan 25 20:22:29 EST 2006

Hi guys,

Attached is a patch for the System.Configuration.ConfigurationManager class, that fixes a bug I've found when using the NET-2.0 profile with the new configuration objects in a web application. The problem appeared to be with how the configuration file name was worked out internally within the ConfigurationManager - it appeared to correctly find configuration files for console apps etc, but couldn't work out the path to the web.config file for a web application. This seemed to result in it simply returning a null for custom configuration sections and app settings within web apps.

The patch tidies that code up a bit, and uses AppDomain.CurrentDomain.SetupInformation.ConfigurationFile to retrieve the path to the configuration file. I've tested it with a test web app, which now can correctly retrieve custom configuration sections, app settings and the like. I've also tested a very simple console app to ensure that still works, which it does.

As always, comments welcome, I haven't supplied a test case for this bug as it's reproducable by simply trying to retrieve an app setting or configuration section when using the NET-2.0 profile (xsp2/mod-mono-server2) on the latest version of Mono from svn head, however if anyone really wants my test code then give me a shout and I'll wrap it up for use elsewhere.

Oh, and I'm aware that Chris Toshok is actively working on the Configuration 2.0 API, and so Chris, if your reading this, your probably the most knowledgable person when it comes to this particular bit of code - if you've got any comments, if I've missed the point, or if this was something that you knew was broken/was broken for a reason/you've fixed but haven't checked in yet, then let me know :-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20060125-System.Configuration.ConfigurationManager.patch
Type: application/octet-stream
Size: 3487 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060126/c126aa0c/attachment.obj 

More information about the Mono-devel-list mailing list