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!
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.
* 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.
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.
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.
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.
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.
* 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
* 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
* Configuration.cs: make this work again with bundled configuration
files. Fixes bug #495957. Patch from Tor Lillqvist.
svn path=/trunk/mcs/; revision=144722
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* ConfigurationManager.cs: implemented a work-around for
OpenExeConfiguration ("") not working with ASP.NET apps properly.
svn path=/trunk/mcs/; revision=107569
* 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
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 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
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
* 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
* 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
* 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
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
* 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