This repository was archived by the owner on Feb 12, 2025. It is now read-only.
Section handlers deprecated implementation #306
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on Linux unit tests (#304), I came across the way the
xslFilessection is accessed.The current code is using
ConfigurationManager.GetSection("xslFiles")and casts it directly to anIListinstance. Unfortunately, for a reason that I could not identify, this always returnsnullunder Linux/Mono.However, using
ConfigurationManager.OpenExeConfigurationgives me a validfilePathalong with a non null value for theGetSectioncode.Unfortunately, the returned object is a
DefaultSectioninstance that does not cast toIListat all.This led me to review the code that "reads" this from the
.configfile and I discovered that it is implemented via theXslFilesSectionHandlerclass. It does so by implementing theIConfigurationSectionHandlerinterface which has been deprecated for a long time now.Changing the code to follow today's standards allows to get an instance of
XslFilesSectionHandlerreturned byGetSectionand as such access any code on it that could return a list of strings as expected by users of this section.This pull request implements the required changes and with those, I have solved failed tests 2, 3 and 4.
Note that there is another location where
GetSectionis called, insideCruiseServerFactory.CreateLocal, along with theServerConfigurationHandlersection handler that implementsIConfigurationSectionHandler. I believe the same set of changes is required there as well.There is one last usage of
IConfigurationSectionHandler, and it's inCruiseControlConfigSectionHandler. But I don't understand its usage as itsCreatemethod returnsnullin all cases. Maybe it should just be removed.