.NET
Microsoft Technologies based on the .NET software framework.
2,284 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a .NET core solution for APIs catering to a mobile application.
In that I am using IConfiguration service to read the config (IConfiguration config = new ConfigurationBuilder().AddJsonFile(ModelConstants.SettingFile).Build();)
This is working but while running coverity test it is throwing an error with resource leak.
ConfigurationBuilder doesn't have Dispose.
If the config object must be disposed when it is disposable, try something like this:
IConfiguration config = new ConfigurationBuilder( ).AddJsonFile( ModelConstants.SettingFile ).Build( );
using( config as IDisposable )
{
. . .
}