473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting Null Reference Exception when having two config section

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
6 1419
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
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
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
Pls let me know your email id

alex

*** Sent via Developersdex http://www.developersdex.com ***
Jul 21 '05 #5
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
I have mailed you the source.

with regds,
Vasu

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
5
by: Matt | last post by:
Hi all, I'm having a very strange problem. The third line in the following code gives me a null reference exception when used in an ASP.Net web page. The code is called on the click of a...
1
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a...
6
by: vasu devan via DotNetMonster.com | last post by:
Hi, I am two config section with same config section handler like follow. <section name="Myformatters" type="MyFramework.Configuration.FileHandlers.MyConfigFileHandler, MyFramework"/> <section...
13
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
2
by: Simon Rigby | last post by:
Hi folks, A bizarre problem I am having. I have a treeview which is bound to an XmlDataSource. The XMLDataSource.Data property is set to the result of a function that generates an XML...
6
by: David Lozzi | last post by:
Hello there, I'm getting the following error System.NullReferenceException: Object reference not set to an instance of an object. at shopping_bag.GetBagTotals()
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
0
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.