Ent Lib 5 Configuration utility and the <remove> tag

Topics: Building and extending application blocks, Data Access Application Block
Aug 26, 2011 at 4:02 PM

Hi

 

We have just upgraded out core app from EL 3.1 to EL 5. This has mostly gone well. However, when I opened the app.config file in the Enterprise Library configuration utility to add in a new exception handling policy, i got an error:

 

Error Loading Section connectionStrings


Error message : Object reference not set to an instance of an object.

 

Although the configuration tool opens and reads the other blocks in, the data access block is not shown. It seems this comes down to the presence of some entries in the connection string section which are intended to stop our app picking up strings from the machine.config file as follows:

 

<remove name="LocalSqlServer" />

 <remove name="OraAspNewConString" />

 <remove name="OraAspNetConString" />

 

However these are also present in the config file we used with EL 3.1 and the configuration tool for 3.1 had no problem opening the config file and displaying the data access block (although the 'remove' entries themselves aren't shown which is fine). As far as I understand from http://msdn.microsoft.com/en-us/library/ms254494.aspx the remove element is a legitimate child of the connectionStrings element, so I don't see why I should be getting any errors at all from the configuration utility. It's most annoying because I have to manually remove those lines, then open the file in the utility to add the new policy and finally re-add the lines manually again which is a bit of a nuisance. I'm stumped - anyone seen this before or know what this behaviour is about?

 

Many thanks

 

Steve

Aug 30, 2011 at 6:50 AM

Hi Steve,

 

Have you verified if those connection strings are really present on your machine.config? Can you try to remove the <remove> tags and see if those connectionstrings will be loaded to the configuration editor? 

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

 

Aug 30, 2011 at 5:46 PM

Hi

 

I've just had a look and I can confirm that 2 of them do exist, the other doesn't: I suspect the OraAspNewConString entry is in fact a mis-type of the OraAspNetConString as I can find no other reference to it on Google other than this thread!! Removing the OraAspNewConString new string entry does indeed solve the problem, but I forsee a more important underlying issue.

 

Not all our developers have Oracle SQL developer installed as we are not yet fully supporting Oracle, but they may have to use the EL configuration tool. Thus is we leave in the OraAspNetConString entry then presumably they will get an error when trying to open the config file in the EL configuration tool, but if we remove the OraAspNetConString entry then it will start appearing as an option in various lists in our app (long story but we have to have the <remove> entries for historical and support reasons). It seems a bit daft that the EL config untility can't deal with it but never mind. Those of us who don't have Oracle installed will have to remember to remove that entry before trying to edit the config!!

 

Thanks for the help

 

Steve