You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varconfig=newConfigurationBuilder();vartempFilePath=System.IO.Path.GetTempPath()+Guid.NewGuid().ToString()+".json"
var tempFile = File.Create(tempFilePath);tempFile.Close();config.AddJsonFile(tempFilePath);
You'll get the following exception:
atSystem.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgumentargument,ExceptionResourceresource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Streamstream)
at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(IConfigurationProviderprovider)
at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilderconfigurationBuilder,Stringpath,Booleanoptional)
at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilderconfigurationBuilder,Stringpath)
Now I know that that's probably not the right way to use AddJsonFile but I would have expected a FormatException or something like that.
I'm using 1.0.0-rc2-15822, I attempted to add this as a unit test but I'm having issues with AddJsonFile being in a class that's not referenced by the unit test file I was editing.
Given the following code:
You'll get the following exception:
Now I know that that's probably not the right way to use AddJsonFile but I would have expected a FormatException or something like that.
I'm using 1.0.0-rc2-15822, I attempted to add this as a unit test but I'm having issues with AddJsonFile being in a class that's not referenced by the unit test file I was editing.