Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with custom config sections

Problem with custom config sections

Scheduled Pinned Locked Moved C#
helpquestionworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jamie Nordmeyer
    wrote on last edited by
    #1

    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

    P 1 Reply Last reply
    0
    • J Jamie Nordmeyer

      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

      P Offline
      P Offline
      PicklesTheClown
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups