dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.55k stars 4.54k forks source link

ConfigurationRoot GetValue behavior changed #103353

Open vsfeedback opened 3 weeks ago

vsfeedback commented 3 weeks ago

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] [regression] The behavior of ConfigurationRoot.GetValue(type,string,object) seems to have changed regarding NULL values:

(public static object? GetValue( this IConfiguration configuration, [DynamicallyAccessedMembers( DynamicallyAccessedMemberTypes.All )] Type type, string key, object? defaultValue ))

When the JSON configuration contains a NULL value ("Dashboard": null,), an empty string is returned instead of NULL.

This is annoying; I expect the configuration system to retrieve values exactly as specified.

As far as I remember, this behavior was different and correct, before I updated VisualStudio to the latest release.

The NuGet manager shows version 8.0.0 for the configuration packages, with the exception of Binder, which has 8.0.1.

Microsoft Visual Studio Professional 2022 (64-bit) - Current - Version 17.10.1


Original Comments

Feedback Bot on 6/2/2024, 06:56 PM:

(private comment, text removed)


Original Solutions

(no solutions)

dotnet-policy-service[bot] commented 3 weeks ago

Tagging subscribers to this area: @dotnet/area-extensions-configuration See info in area-owners.md if you want to be subscribed.

tarekgh commented 3 weeks ago

Please provide some code samples to reproduce the issue. Thanks!

dotnet-policy-service[bot] commented 3 weeks ago

This issue has been marked needs-author-action and may be missing some important information.

dotnet-policy-service[bot] commented 1 week ago

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.