This project has moved. For the latest updates, please go here.

Section singleton instance returns null if section within group

Feb 17, 2010 at 3:32 PM


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.



<myCompany xmlns="myCompany.Configuration">
        <environment name="Test1" >
          <location url=""/>
          <login enabled="true" username="user" password="password"/>

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.


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.