Posts

Showing posts from February, 2024

Quick fix for 'Unrecognized configuration section system.diagnostics' error in .NET apps

.NET can be used to create a variety of different types of app, coming with various technologies such as WPF and Windows Forms to help you create them. .NET apps support providing a .config file with the app that can be used to store various bits of configuration information about the app. There is an issue, however, that you might encounter when adding this file to your project (either manually or automatically, such as when you create a .settings file). The issue is that this file can cause a System.Configuration.ConfigurationErrorsException exception, with an error message that starts with something like 'Unrecognized configuration section system.diagnostics'. Luckily, there is an easy fix for this issue which simply involves adding a single line of code to your config file. The Fix So, to fix the issue, first open your project's configuration file (it will probably be named app.config or something like that) and add the following line under <configSections>: <