From ab3799f65115dcee3bbd6cdce785813b40f7e994 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Wed, 2 Sep 2020 17:19:13 +0100 Subject: [PATCH] Make CertificateConfig linker friendly (#25515) --- .../Core/src/Internal/ConfigurationReader.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/ConfigurationReader.cs b/src/Servers/Kestrel/Core/src/Internal/ConfigurationReader.cs index 06ca82a8a9..d749de79f8 100644 --- a/src/Servers/Kestrel/Core/src/Internal/ConfigurationReader.cs +++ b/src/Servers/Kestrel/Core/src/Internal/ConfigurationReader.cs @@ -353,7 +353,19 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal public CertificateConfig(IConfigurationSection configSection) { ConfigSection = configSection; - ConfigSection.Bind(this); + + // Bind explictly to preserve linkability + Path = configSection[nameof(Path)]; + KeyPath = configSection[nameof(KeyPath)]; + Password = configSection[nameof(Password)]; + Subject = configSection[nameof(Subject)]; + Store = configSection[nameof(Store)]; + Location = configSection[nameof(Location)]; + + if (bool.TryParse(configSection[nameof(AllowInvalid)], out var value)) + { + AllowInvalid = value; + } } // For testing