I am using IconfigurationRoot service using Build() function.
IConfigurationBuilder builder = new ConfigurationBuilder();
builder.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"));
var configservice = builder.Build();
Now this works, but the problem is since Configuration service cannot be treated as IDisposable, how do I prevent the resource leak happening in Static Analysis Security Test? How to dispose of configservice
?
I tried 'using' method or using Dispose() but it can't be used as such methods can only be used with Idisposable or IdisposableAsync.