Select to view content in your preferred language

System.Configuration.ConfigurationManager (my extension cant find it)

1165
5
09-30-2010 03:50 AM
AndrewDavis
Deactivated User
Hi,
I have an extension which I wrote on the dev net here where I work, and it worked last week.  However, there was a crash and now my code dies on this line

NameValueCollections appSettings = System.Configuration.ConfigurationManager.AppSettings;

I am sure that something did not get switched back on here (as in the network), and want to know where does ArcMap go to connect/bond or gain access to the "System".

My quick watches all die on "System" or any other derivation of the term.

Andy
0 Kudos
5 Replies
AndrewDavis
Deactivated User
Wrote a console app to roll through the System.Configuration.Configuration["AppSettings"]

I don't think that this is an ArcMap thing, but if anyone has any experience with this please let me know..
0 Kudos
AndrewDavis
Deactivated User
Wrote a console app to roll through the System.Configuration.Configuration["AppSettings"]

I don't think that this is an ArcMap thing, but if anyone has any experience with this please let me know..



Still Searching for the answer on this.  I am still not able to read information out of the ArcMap.exe.config file.  Just to check a possibility, I hard coded the values I read out of the config file and tested my code.

Everything works..

Does anyone know where and how ArcGIS makes connection to the config file for ArcMap?
0 Kudos
NeilClemmons
Honored Contributor
Have you tried accessing the config settings using the built-in .NET functionality?  The .NET runtime reads the application config file for you and provides an easy way to access the settings.  In VB.NET, you can access the config settings using My.Settings.<setting>, where <setting> is the name of the config setting you want.  In C#, this can be done using Properties.Settings.Default.<setting>.
0 Kudos
AndrewDavis
Deactivated User
Have you tried accessing the config settings using the built-in .NET functionality? The .NET runtime reads the application config file for you and provides an easy way to access the settings. In VB.NET, you can access the config settings using My.Settings.<setting>, where <setting> is the name of the config setting you want. In C#, this can be done using Properties.Settings.Default.<setting>.


Neil, Thanks for the reply.

Is what you are describing any different than:

Adding a Reference to the "System.Configuration.dll" to your project in VisStudio
putting a "using" statement in the beginning of your class "using System.Configuration;"

Then using this construct to read key values out of the ArcMap.exe.config?

All of this code does work on my production environment and is deployed for the users in my shop, it is just in my dev environment that the things have gone haywire after the App Server crashed.

I suspect that there is an environmental setting that did not get reset after the crash. Is there a place I should look to let my SysAdmins know about?

Andy
0 Kudos
AndrewDavis
Deactivated User
Hey folks,

It turned out that there was not anything "wrong" with my code. What had happened is that someone (possibly me, but I will not accept blame at this time) had inadvertently put a " " space in the opening line of the

ArcMap.exe.config

in front of the first line of the first tag. That threw the whole thing into a snit and it would not work at all.

Thank you Neil for your info,

I hope that if there is anyone else out there who runs into this problem, check the first line of your ArcMap.exe.config file for a space at the start of the first line outside to the left of the < character..

Andy
0 Kudos