How to debug configuration files in .NET?

I have a Visual Studio project that recently started throwing a ConfigurationErrorsException and I can't figure out where it came from. I hunted high and low, I can not find anything like this error, and it does not appear for any of my teammates when they run the project on their PCs.

Does anyone have any specific recommendations regarding debugging loading and analyzing configuration files? Since the ConfigurationManager is the framework code, I don’t have a source and can’t enter it using the Visual Studio debugger, so I hunt in the dark.

I would really like to at least find out which files are downloaded, which partitions, keys, etc. retrieved and what values ​​are overridden when loading subsequent configuration files.

Just FYI, the project is an InfoPath form project edited in Visual Studio 2008 using .NET 3.5. An exception occurs when the form is first loaded; The method tries to get the web service URL from the configuration file:

_clmWebSrvc.Url = System.Configuration.ConfigurationSettings.AppSettings["CLMUtilityWebServiceUrl"];

which fails (just for me!) with:

System.Configuration.ConfigurationErrorsException
The configuration section 'connectionStrings' has an unexpected declaration.
   at System.Configuration.ConfigurationManager.get_ConnectionStrings()

connectionStrings ; machine.config , , -. Infopath.exe.config , , . -, IIS. VS2008, InfoPath, InfoCath FormCache, , , .

, , , . , , - , , . ?

!

+3
3

Process Monitor System Internals (MSFT). , , , .

Red Gate.NET Reflector, .NET, ConfigurationManager, .

+2

, , , , - .NET(, , Configuration).

, Debug 2008 , Hanselman : . .NET Framework

+1

, connectionStrings.

connectionStrings machine.config - .NET Framework , .

machine.config. , ,

<connectionStrings>
    <clear/>
</connectionStrings>

, machine.config.

+1

Source: https://habr.com/ru/post/1751835/


All Articles