Section singleton instance returns null if section within group

Feb 17, 2010 at 3:32 PM

Hi,

Loving your work, by the way!

I found that the section.Instance property returns null if the section is nested within groups.  This is because you need to pass the path including groups to the GetSection method.

e.g.

for

<myCompany xmlns="myCompany.Configuration">
    <Web>
      <UITesting>
        <environment name="Test1" >
          <location url="http://host.domain.com/app.html"/>
          <login enabled="true" username="user" password="password"/>
        </environment>
      </UITesting>
    </Web>
  </myCompany>

You need to call ConfigurationManager.GetSection("myCompany/Web/UITesting/environment");

(It took me ages to track this down, rubbish documentation by microsoft!)

For now I don't generate the singleton and just instatiate the sections myself.

Thanks!

Coordinator
Feb 18, 2010 at 8:43 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.