By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,266 Members | 1,862 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,266 IT Pros & Developers. It's quick & easy.

Getting Null Reference Exception when having two config section

P: n/a
Hi,

I am two config section with same config section handler like follow.
<section name="Myformatters"
type="MyFramework.Configuration.FileHandlers.MyCon figFileHandler,
MyFramework"/>
<section name="Myserviceproxies"
type=MyFramework.Configuration.FileHandlers.MyConf igFileHandler,
MyFramework"/>

And my sections looks like the following,

<Myserviceproxies>
<proxies>
<proxy name="1" type="MyServiceProxy.Class1,MyServiceProxy"/>
</proxies>
</Myserviceproxies>
<Myformatters>
<formatters>
<formatter name="1"type="MyServiceProxy.Class1,VinServiceProx y"/>
</formatters>
</Myformatters>

When I am trying to access the config settings through
ConfigurationSettings.GetConfig method passing the config section name, it
is working fine for Myserviceproxies config section. But for the second
config section Myformatters the method returns null. Implementatin of
IConfigurationSectionHandler.Create method is not called for Myformatters
section. For Myserviceproxies everything is working fine.

What could be the problem?

with regds,
Vasu
Jul 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Vasu,

Just by looking at your xml I noticed that the "<formatter>" element has a
"name" attribute and a "type" attribute, but you seem to be missing a space
between them. try adding a space and see if your code works.

Instead of:
<Myformatters>
<formatters>
<formatter name="1"type="MyServiceProxy.Class1,VinServiceProx y"/>
</formatters>
</Myformatters>

Try:
<Myformatters>
<formatters>
<formatter name="1" type="MyServiceProxy.Class1,VinServiceProxy"/>
</formatters>
</Myformatters>

"vasu devan via DotNetMonster.com" wrote:
Hi,

I am two config section with same config section handler like follow.
<section name="Myformatters"
type="MyFramework.Configuration.FileHandlers.MyCon figFileHandler,
MyFramework"/>
<section name="Myserviceproxies"
type=MyFramework.Configuration.FileHandlers.MyConf igFileHandler,
MyFramework"/>

And my sections looks like the following,

<Myserviceproxies>
<proxies>
<proxy name="1" type="MyServiceProxy.Class1,MyServiceProxy"/>
</proxies>
</Myserviceproxies>
<Myformatters>
<formatters>
<formatter name="1"type="MyServiceProxy.Class1,VinServiceProx y"/>
</formatters>
</Myformatters>

When I am trying to access the config settings through
ConfigurationSettings.GetConfig method passing the config section name, it
is working fine for Myserviceproxies config section. But for the second
config section Myformatters the method returns null. Implementatin of
IConfigurationSectionHandler.Create method is not called for Myformatters
section. For Myserviceproxies everything is working fine.

What could be the problem?

with regds,
Vasu

Jul 21 '05 #2

P: n/a
Jorge,

I tried that. Still I am getting the same error message.For me it seems the
problem lies in ConfigurationSettings class. But I am not sure. This
behaviour due to the caching nature of ConfigurationSettings class.

with regds,
Vasu

--
Message posted via http://www.dotnetmonster.com
Jul 21 '05 #3

P: n/a
I could review your code if you email me or post it to the news group.

"vasu devan via DotNetMonster.com" wrote:
Jorge,

I tried that. Still I am getting the same error message.For me it seems the
problem lies in ConfigurationSettings class. But I am not sure. This
behaviour due to the caching nature of ConfigurationSettings class.

with regds,
Vasu

--
Message posted via http://www.dotnetmonster.com

Jul 21 '05 #4

P: n/a
Pls let me know your email id

alex

*** Sent via Developersdex http://www.developersdex.com ***
Jul 21 '05 #5

P: n/a
Remove the NOSPAM below when you email me.

ma***************@Hotmail.com

"Alex" wrote:
Pls let me know your email id

alex

*** Sent via Developersdex http://www.developersdex.com ***

Jul 21 '05 #6

P: n/a
I have mailed you the source.

with regds,
Vasu

--
Message posted via http://www.dotnetmonster.com
Jul 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.