Problem with custom config sections
-
I have the following defined in my app.config file:
<configSections> <sectionGroup name="FeedServices"> <section name="SsnConfiguration" type="FeedLib.SsnConfigurationHandler" /> <section name="AgencyConfiguration" type="FeedLib.AgencyConfigurationHandler" /> <section name="CompConfiguration" type="FeedLib.CompConfigurationHandler" /> </sectionGroup> </configSections> <FeedServices> <SsnConfiguration type="FeedLib.SsnConfiguration"> ... </SsnConfiguration> <AgencyConfiguration type="FeedLib.AgencyConfiguration"> ... </AgencyConfiguration> <CompConfiguration type="FeedLib.CompConfiguration"> ... </CompConfiguration> </FeedServices>
I also have the following code in a .dll file:
config = (SsnConfiguration)ConfigurationManager.GetSection("FeedServices/SsnConfiguration");
I have a command line application with a reference to the .dll file above, and when the above line is called, config is set to null; it's not finding the configuration section. Any ideas? Thanks in advance. Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA
-
I have the following defined in my app.config file:
<configSections> <sectionGroup name="FeedServices"> <section name="SsnConfiguration" type="FeedLib.SsnConfigurationHandler" /> <section name="AgencyConfiguration" type="FeedLib.AgencyConfigurationHandler" /> <section name="CompConfiguration" type="FeedLib.CompConfigurationHandler" /> </sectionGroup> </configSections> <FeedServices> <SsnConfiguration type="FeedLib.SsnConfiguration"> ... </SsnConfiguration> <AgencyConfiguration type="FeedLib.AgencyConfiguration"> ... </AgencyConfiguration> <CompConfiguration type="FeedLib.CompConfiguration"> ... </CompConfiguration> </FeedServices>
I also have the following code in a .dll file:
config = (SsnConfiguration)ConfigurationManager.GetSection("FeedServices/SsnConfiguration");
I have a command line application with a reference to the .dll file above, and when the above line is called, config is set to null; it's not finding the configuration section. Any ideas? Thanks in advance. Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA
The value returned from GetSection() will be the object (if any) returned from your IConfigurationSectionHandler.Create() implementation. Put a breakpoint in your... FeedLib.SsnConfigurationHandler.Create() ...method - it should get hit and you can see any issues in there.