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
{{ message }}
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Should the json source have been interpreted that as a null rather than empty string?
System.InvalidOperationException: Failed to convert '' to type 'System.Int32'. ---> System.Exception: is not a valid value for Int32. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at Microsoft.Extensions.Configuration.ConfigurationBinder.ConvertValue(Type type, String value)
--- End of inner exception stack trace ---
at Microsoft.Extensions.Configuration.ConfigurationBinder.ConvertValue(Type type, String value)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindProperty(PropertyInfo property, Object instance, IConfiguration config)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindNonScalar(IConfiguration configuration, Object instance)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config)
The text was updated successfully, but these errors were encountered:
When trying to use a json configuration source with a null value
and we are using Options to bind that to a class with a property as int?. An error "Failed to convert '' to type 'System.Int32'." occurs.
It appears that https://github.com/aspnet/Configuration/blob/dev/src/Microsoft.Extensions.Configuration.Json/JsonConfigurationFileParser.cs#L98 converts to an empty string rather than null. When the Options framework comes along, it see's the empty string and tries to convert it, which it wouldn't if it was null as per the json string.
Should the json source have been interpreted that as a null rather than empty string?
The text was updated successfully, but these errors were encountered: