Commit Graph
363 Commits
Author SHA1 Message Date
Atsushi Eno ccaecd8e26 Use xmlns-ignoring XmlDocument derivation for config files. Fixed bug #641935. 2011-04-21 17:45:35 +09:00
Miguel de Icaza 38253abf8c Add solution files 2011-02-12 22:09:49 -05:00
Marek Safar d86fc07959 Remove no longer used bootstrap profiles 2010-12-29 10:00:08 +00:00
Jonathan Pobst 0df612b813 Reverse #elif check since 4.0 profile defines NET_2_0. Fixes broken test. 2010-12-17 10:30:52 -06:00
Jonathan Pobst 9bc4f0d82f Fix some broken tests that check for assembly version 2.0.0.0 on the 4.0 profile. 2010-12-16 22:19:30 -06:00
Marek Habersack 833aab4906 [asp.net] Fix for bug #467221. Properly match location sub-paths for security trimming
When security trimming is requested for sub-path of a location specified in the config file,
make sure that we match such a request to its parent location.

Based on patch from Mike Morano <[email protected]>, thanks!
2010-12-14 10:07:24 +01:00
Marek Habersack 872c7d9a62 [configuration] Part of fix for bug #579837. CommaDelimitedStringCollection must properly note that it was modified.
When one manipulates the collection as an instance of StringCollection, the 'modified' field will not
be set (Add, Remove etc. from the underlying StringCollection type will be used). To work around it
a check has to be performed in IsModified whether the contents of the collection changed. It is done
by comparing string hash codes of the original vs current string.
CommaDelimitedStringCollectionConverter forces string hash code update on the new collection, so that IsModified
works correctly on collections converted from comma-delimited strings.
2010-10-04 15:39:29 +02:00
Laurent Etiemble 0f1b1c1988 Fix #560060 - Embedded "app.config" is not read when used inside a bundle.
* mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs: Add new internal call to retrieve embedded application config. First
	check if an embedded configuration exists before looking up on the
	filesystem.

	* mono/metadata/icall-def.h: Add entry for retrieving embedded application
	configuration.

	* mono/metadata/icall.c: Add function to retrieve embedded application
	configuration if one has been registered with the runtime.
2010-08-09 21:21:33 +02:00
Jonathan Pryor 90e8581201 Remove System.Configuration.ConfigurationErrorsExceptions from startup.
If an app uses e.g. System.Diagnostics.Trace (and the Trace methods are
actually invoked, e.g. by building with -d:TRACE and using Trace.WriteLine()),
at least one System.Configuration.ConfigurationErrorsException was being
generated as part of startup (one from parsing machine.config, and an optional
second exception from parsing AppName.exe.config).

The exception was caught, so it didn't break anything, but it was still
undesirable.

The cause of the exception is as follows: The <system.diagnostics/>
configuration section is processed by DiagnosticsConfigurationHandler, which
is an IConfigurationSectionHandler implementation.  In .NET 2.0, configuration
file processing was moved to use System.Configuration.ConfigurationSection
implementations, which would delegate to IConfigurationSectionHandlers if/when
specified.

However, before ConfigurationSection.GetRuntimeObject() calls into
DiagnosticsConfigurationHandler, it would indirectly call
ConfigurationElement.DeserializeElement() to process the e.g.
<system.diagnostics/> element, which would throw as ConfigurationElement was
hitting "unrecognized" XML elements (as ConfigurationElement doesn't know about
DiagnosticsConfigurationHandler-specific XML).  This would result in a
ConfigurationErrorsException, which would be caught in GetRuntimeObject(),
then DiagnosticsConfigurationHandler.Create() would be invoked (doing the
"actual" <system.diagnostics/> parsing, allowing Trace to work, etc.

The fix taken here is to avoid calling
ConfigurationElement.DeserializeElement() if there's an
IConfigurationSectionHandler present, as it doesn't make sense to parse the
same section with two different handlers.
2010-08-06 11:56:26 -04:00
Jb Evain b87bd5ff29 [Perf] avoid an exception when reading a non existent app configuration
Make implementors of IInternalConfigurationHost.OpenStreamForRead return null instead of throwing an exception when there's no usable configuration file and deal with null at the call site.
2010-08-06 17:27:40 +02:00
Atsushi Eno 035a58b8ab 2010-07-27 Atsushi Enomoto <[email protected]>
* ConfigurationPropertyCollection.cs, PropertyInformation.cs:
	  add null check to detect bogus configuration early.
2010-07-27 18:29:09 +09:00
Raja R Harinath cd51491631 Fix a few cases of mixed line-endings
This is a scripted conversion of mixed line-ending files to LF-only or CRLF-only
based on which patch is smaller.  I used a threshold of upto a quarter of the
lines to determine whether to keep the patch or not.
2010-07-26 02:20:13 +05:30
Raja R Harinath b293948fb7 EOL handling
This set of .gitattributes was automatically generated from the list of files
that GIT tried to normalize when I enabled automatic EOL conversion.

With this set of attributes, we prevent automated EOL conversion on files that
we know will cause trouble down the road.
2010-07-25 20:17:39 +05:30
Jonathan Chambers 37d8cf2f6b 2010-06-15 Jonathan Chambers <[email protected]>
* Add more projects for net_2_0 profile build.

svn path=/trunk/mcs/; revision=158981
2010-06-15 22:24:14 +00:00
Jonathan Pobst 8b7e0e32ea 2010-01-15 Jonathan Pobst <[email protected]>
* ConfigurationErrorsExceptionTest.cs: Mark 4 failing tests as NotWorking.
	Filed as bug #571226.

svn path=/trunk/mcs/; revision=149654
2010-01-15 23:01:01 +00:00
Marek Habersack 692b3e376b 2010-01-09 Marek Habersack <[email protected]>
* WebConfigurationManager.cs: GetSection properly handles looking
	up and caching of <location> instances. Part of fix for bug
	#568441

	* WebConfigurationHost.cs: GetConfigPathFromLocationSubPath
	calculatesthe path relative to the current config file path. Part
	of fix for bug #568441

2010-01-09  Marek Habersack  <[email protected]>

	* VirtualPathUtility.cs: small optimizations for GetDirectory

2010-01-09  Marek Habersack  <[email protected]>

	* ConfigurationLocation.cs: trailing / characters are removed from
	the path.

	* Configuration.cs: instances created for locations inherit
	ConfigPath from their containing document.
	Host.GetConfigPathFromLocationSubPath must be called with current
	instance's configPath, not LocationConfigPath.
	Locations are sought for using paths relative to the current
	instance's configPath, not to the root path.
	All of the above is part of fix for bug #568441

svn path=/trunk/mcs/; revision=149262
2010-01-09 00:29:25 +00:00
Carlos Alberto Cortez 0a3ea31a00 2009-12-14 Carlos Alberto Cortez <[email protected]>
* SectionInformation.cs: ConfigSource should never be null, but empty.
	Also, the Type property should throw an argument exception if the
	new value is null or empty.
	Fixes #458185.


svn path=/trunk/mcs/; revision=148408
2009-12-14 20:10:04 +00:00
Gonzalo Paniagua Javier 5cbeeee8c8 2009-10-23 Gonzalo Paniagua Javier <[email protected]>
* Configuration.cs: make this work again with bundled configuration
	files. Fixes bug #495957. Patch from Tor Lillqvist.


svn path=/trunk/mcs/; revision=144722
2009-10-23 09:53:24 +00:00
Gonzalo Paniagua Javier 72090fea58 2009-07-17 Gonzalo Paniagua Javier <[email protected]>
* ConfigurationElement.cs: don't skip xml nodes when reading 2
	ConfigurationElement in a row. Patch by Greg Smolyn that fixes bug
	#521231.


svn path=/trunk/mcs/; revision=138142
2009-07-17 17:58:53 +00:00
Marek Habersack 4a2ae0bb4f 2009-07-15 Marek Habersack <[email protected]>
* WebConfigurationManager.cs: another approach to suppressing
	application reloads after the app writes to its root web.config
	file. Leaving the previous code in place to get more
	protection. It's a kludge, but it's the best option to avoid
	all the races caused by System.Configuration+FileSystemWatcher
	without rewriting large parts of System.Configuration (and
	System.Web.Configuration). Fixes bug #522017

2009-07-15  Marek Habersack  <[email protected]>

	* Configuration.cs: explicitly flush the stream when writing XML
	data. Part of fix for bug #522017

2009-07-15  Marek Habersack  <[email protected]>

	* HttpApplicationFactory.cs: added internal methods to
	enable/disable specific watchers. Part of fix for bug #522017

svn path=/trunk/mcs/; revision=137951
2009-07-15 13:22:33 +00:00
Marek Habersack 01916d259e 2009-07-14 Marek Habersack <[email protected]>
* WebConfigurationManager.cs: added support for suppressing
	application reload when the main config file is written to from
	application.

	* WebConfigurationHost.cs: added minimal implementation of
	WriteCompleted, which checks if there's need to suppress
	application reload.

2009-07-14  Marek Habersack  <[email protected]>

	* ConfigurationSaveEventArgs.cs, ConfigurationSaveEventHandler.cs:
	added

	* Configuration.cs: added two internal events - SaveStart and
	SaveEnd. They are used by System.Web's configuration system to
	suppress application reloads when configuration is modified and
	saved from within a web application. It is necessary to use events
	since there is no guarantee the web application will use
	WebConfigurationManager (and thus WebConfigurationHost) for
	writing.

2009-07-14  Marek Habersack  <[email protected]>

	* System.Configuration.dll.sources: added
	System.Configuration/ConfigurationSaveEventArgs.cs
	System.Configuration/ConfigurationSaveEventHandler.cs

2009-07-14  Marek Habersack  <[email protected]>

	* AssemblyInfo.cs: added InternalsVisibleTo for System.Web

2009-07-14  Marek Habersack  <[email protected]>

	* HttpApplicationFactory.cs: OnFileChanged doesn't reload
	application if reload suppression is active.

svn path=/trunk/mcs/; revision=137847
2009-07-14 11:24:36 +00:00
Marek Habersack d74135a620 2009-06-08 Marek Habersack <[email protected]>
* ConfigurationLocation.cs: if the path passed to constructor
	starts with any of ' ' '.' '/' or '\', throw an exception. Fixes
	bug #510735

svn path=/trunk/mcs/; revision=135630
2009-06-08 07:19:41 +00:00
Marek Safar 6f1d5e5874 More work on 4.0 profile
svn path=/trunk/mcs/; revision=135454
2009-06-04 16:56:17 +00:00
Marek Safar 6f667408d9 Add handling of new net_4_0 profile
svn path=/trunk/mcs/; revision=135326
2009-06-03 17:46:12 +00:00
Gonzalo Paniagua Javier ea9d02d719 2008-12-22 Gonzalo Paniagua Javier <[email protected]>
* Configuration.cs: don't try to open the file if we know it does not
	exist. Also, don't hide the actual exception in case there's a problem
	opening the configuration file.


svn path=/trunk/mcs/; revision=122004
2008-12-22 20:31:49 +00:00
Marek Habersack 0195fb4796 Reverting r121536
svn path=/trunk/mcs/; revision=121552
2008-12-15 21:42:52 +00:00
Marek Habersack 7742230a75 2008-12-15 Marek Habersack <[email protected]>
* Configuration.cs: do not reset empty sections - it results in
	the elements from the parent sections being re-added to the
	current section with their default values which, in turn, can lead
	to duplicate keys being added to the collections in some cases.

svn path=/trunk/mcs/; revision=121536
2008-12-15 19:16:27 +00:00
Gonzalo Paniagua Javier 6814304afb 2008-11-15 Gonzalo Paniagua Javier <[email protected]>
* ConfigurationManager.cs: the config file name is arbitrary.
	(Standalone test t46)


svn path=/trunk/mcs/; revision=118939
2008-11-15 18:12:19 +00:00
Gonzalo Paniagua Javier d3c99dc19a 2008-11-10 Gonzalo Paniagua Javier <[email protected]>
* ConfigurationManager.cs: when we're dealing with an EXE hosted
	application, the configuration file is the one for the AppDomain,
	otherwise we might try to get a config file for a dll. Fixes the
	regression in 2.0 sys.config.


svn path=/trunk/mcs/; revision=118410
2008-11-10 20:46:00 +00:00
Gonzalo Paniagua Javier 01f4f3c0fa revert
svn path=/trunk/mcs/; revision=117575
2008-10-31 17:48:04 +00:00
Gonzalo Paniagua Javier 23a91b586e 2008-10-31 Gonzalo Paniagua Javier <[email protected]>
* System/System.Configuration/CustomizableFileSettingsProvider.cs:
	* System/System.Configuration/ApplicationSettingsBase.cs:
	* System.Configuration/System.Configuration/ClientConfigurationSystem.cs:
	* System.Configuration/System.Configuration/ConfigurationManager.cs:
	Generate the same file name for the local settings file and properly
	save the configuration to it. Not loading it yet.


svn path=/trunk/mcs/; revision=117573
2008-10-31 17:36:16 +00:00
Gert Driesen c52dbbeb8b * ConfigurationManagerTest.cs: Added test for bug #323622.
svn path=/trunk/mcs/; revision=112960
2008-09-14 16:57:52 +00:00
Gert Driesen 4323fbeaeb Moved ProviderCollectionTest.cs from System assembly to System.Configuration.
svn path=/trunk/mcs/; revision=112950
2008-09-14 12:17:43 +00:00
Gert Driesen cbe103cb5c added test for bug #413203.
svn path=/trunk/mcs/; revision=109501
2008-08-02 20:13:16 +00:00
Marek Safar 99f5f84f07 Warnings cleanup.
svn path=/trunk/mcs/; revision=107705
2008-07-11 08:42:47 +00:00
Marek Habersack e247418668 2008-07-09 Marek Habersack <[email protected]>
* ConfigurationManager.cs: implemented a work-around for
	OpenExeConfiguration ("") not working with ASP.NET apps properly.

svn path=/trunk/mcs/; revision=107569
2008-07-09 17:20:29 +00:00
Rodrigo Kumpera ce2a89b5fa 2008-07-07 Rodrigo Kumpera <[email protected]>
* ConfigurationManager.cs: Return the right path if the calling assembly is
	not null. This happens when ConfigurationSession::GetRuntimeObject() is
	called, SectionHandler != null and the handler itself calls
	OpenExeConfigurationInternal ("").


svn path=/trunk/mcs/; revision=107427
2008-07-07 22:29:35 +00:00
Rodrigo Kumpera a421cd3749 * ConfigurationManager.cs: Reaply the patch from Gert.
This change doesn't contain any fix to to not clutter
	the commit history.

2008-07-07  Rodrigo Kumpera  <[email protected]>

	* ClientConfigurationSystem.cs:

svn path=/trunk/mcs/; revision=107426
2008-07-07 22:25:55 +00:00
Rodrigo Kumpera 22ead8e533 In .:
2008-07-07  Rodrigo Kumpera  <[email protected]>

	* ClientConfigurationSystem.cs:
	* ConfigurationManager.cs: The previous patch since it
	causes a regression. It will remain reverted until we figure
	out what's wrong and how to fix it.


svn path=/trunk/mcs/; revision=107376
2008-07-07 12:51:19 +00:00
Gert Driesen 42d71e4219 * ConfigurationManagerTest.cs: Added/improved tests for
OpenExeConfiguration. Enabled tests that were previously failed. 
* ClientConfigurationSystem.cs: Moved logic for defaulting to
configuration file of AppDomain to OpenExeConfigurationInternal.
* ConfigurationManager.cs (OpenExeConfigurationInternal):
Allow calling_assembly and exePath to be null. When userLevel is None,
default to configuration file of AppDomain if exePath is null or empty.
When exePath is specified, resolve it to absolute path and throw
ConfigurationErrorsException if exePath does not exist and add
.config extension to get config file name if exePath does exist.

svn path=/trunk/mcs/; revision=107080
2008-07-02 18:02:18 +00:00
Gert Driesen 76894bdd86 * t46.cs: Improve test coverage.
svn path=/trunk/mcs/; revision=107050
2008-07-02 10:46:41 +00:00
Gert Driesen 37aab507c8 * Makefile: added test t46.
* t46.cs, t46-lib.cs: added test for bug #405574.
* t46.exe.config, t46.exe.config2: config files for t46.
* t46.exe.expected: expected result for t46.

svn path=/trunk/mcs/; revision=107049
2008-07-02 10:26:50 +00:00
Miguel de Icaza 2709c912f0 2008-07-01 Miguel de Icaza <[email protected]>
* ConfigurationManager.cs (OpenExeConfigurationInternal): if the
	string passed is empty, then we default to the startup assembly.

	Fixes: #405574

	Not entirely happy as there is no decent documentation for this
	behavior (the docs state nothing about empty strings). 

svn path=/trunk/mcs/; revision=107019
2008-07-02 00:28:35 +00:00
Atsushi Eno 5535c3f683 2008-06-27 Atsushi Enomoto <[email protected]>
* ConfigurationErrorsExceptionTest.cs : actually
          remove ignored tests.


svn path=/trunk/mcs/; revision=106790
2008-06-28 00:07:56 +00:00
Atsushi Eno 0c6f8225a7 2008-06-27 Atsushi Enomoto <[email protected]>
* SectionInfo.cs, Configuration.cs, ConfigInfo.cs,
          SectionGroupInfo.cs :
          eliminate XmlTextReader, first stage.


svn path=/trunk/mcs/; revision=106778
2008-06-27 21:03:18 +00:00
Atsushi Eno c9627ec868 2008-06-27 Atsushi Enomoto <[email protected]>
* ConfigurationErrorsException.cs : recover from
          silly change that tries to prevent debuggin by
          decreasing error location information.

        * ConfigurationErrorsExceptionTest.cs : mark couple
          of tests as [Ignore] that blocks us from decent
          implementation in the name of silly .NET compatibility.

        Maybe I'll remove more silliness later.


svn path=/trunk/mcs/; revision=106776
2008-06-27 20:45:49 +00:00
Gert Driesen 590868c044 * ConfigurationErrorsExceptionTest.cs: Added tests for ctors and
GetFilename/GetLineNumber overloads.
* System.Configuration_test.dll.sources: added
ConfigurationErrorsExceptionTest.cs.
* System.Configuration.dll.sources: added ConfigXmlTextReader.cs.
* ConfigurationElement.cs: Use ConfigurationErrorsException instead of
ConfigurationException, and pass reader to ConfigurationErrorsException
ctor to allow for file/linenumber info in exception message.
* ConfigurationErrorsException.cs: Removed local bareMessage field, and
use base.BareMessage field instead. Fixed Message property to only add
filename if not null or zero-length string, and only add line if not
zero. In GetFilename/GetLineNumber overloads, only try to get info if
node/reader implements IConfigErrorInfo.
* ConfigurationSection.cs: Use ConfigXmlTextReader instead of
XmlTextReader to allow for file/linenumber info in exception messages.
* ConfigXmlTextReader.cs: Added XmlTextReader that implements 
IConfigErrorInfo.
* ConfigurationLocation.cs: Use ConfigXmlTextReader instead of
XmlTextReader to allow for file/linenumber info in exception messages.
* ClientConfigurationSystem.cs: Perform lazy initialization and
wrap exceptions in ConfigurationErrorsException. Fixes standalone test
t28.
* Configuration.cs: Use ConfigXmlTextReader instead of XmlTextReader
to allow for file/linenumber info in exception messages.
* ConfigInfo.cs: Fixed ThrowException to use file/number info available
in XmlTextReader for exception message.
* AppSettingsSection.cs: Use ConfigXmlTextReader instead of
XmlTextReader to allow for file/linenumber info in exception messages.
* Assert.cs: added.
* Makefile: added Assert.cs, and explicitly specify output file.
* t28.cs: Improved test.

svn path=/trunk/mcs/; revision=106626
2008-06-26 10:31:07 +00:00
Jb Evain 3b0d913c99 2008-06-19 Jb Evain <[email protected]>
* ConfigurationPermissionAttribute.cs (CreatePermission): implement.


svn path=/trunk/mcs/; revision=106210
2008-06-19 14:26:12 +00:00
Marek Habersack 1cb04f74e9 2008-05-28 Marek Habersack <[email protected]>
* Configuration.cs: set the ConfigContext when getting
        and instance of a section. Fix for bug #325128.

        * ConfigurationSection.cs: added an internal property -
        ConfigContext used to supply the HttpContext to the Create
        method of SectionHandler when called from GetRuntimeObject.
        Fix for bug #325128.

        * InternalConfiguationHost.cs: changed CreateDeprecatedConfigContext
        to return null rather than throwing a NotImplementedException.
        Fix for bug #325128.

        * All patches above contributed by James Fitzsimons <[email protected]>,
          thanks!

svn path=/trunk/mcs/; revision=104331
2008-05-28 21:22:57 +00:00
Sebastien Pouliot 073c560cee 2008-05-18 Sebastien Pouliot <[email protected]>
* SectionGroupInfo.cs: Use String.IsNullOrEmpty inside 2.0 code.
	[Found using Gendarme]


svn path=/trunk/mcs/; revision=103422
2008-05-18 16:16:00 +00:00