Home > Mobile >  ConfigurationManager.GetSection does not inherit from System.Configuration.IConfigurationSectionHand
ConfigurationManager.GetSection does not inherit from System.Configuration.IConfigurationSectionHand

Time:08-09

in a project .netstandard 2.0 I receive this exception

System.Configuration.ConfigurationErrorsException: 'An error occurred creating the configuration section handler for mySection: Type 'Custom.Config.Configurator' does not inherit from 'System.Configuration.IConfigurationSectionHandler'.

when I use

System.Configuration.ConfigurationManager.GetSection("mySection");

The section is the following

<section name="mySection" type="Custom.Config.Configurator, Custom" />

It seems the System.Configuration.ConfigurationManager doesn't work as I expected, before the project was in .NET framework and it worked. I installed System.Configuration.ConfigurationManager 6.0.0.0 and the IConfigurationSectionHandler is implemented.

CodePudding user response:

After troubling two days I put the code of System.Configuration.ConfigurationManager.GetSection("mySection"); in .NET framework project.

Likely System.Configuration and System.Configuration.ConfigurationManager don't work together very well

  • Related