From 80e04c343b974f3661bdd1f47606668ee182a149 Mon Sep 17 00:00:00 2001 From: Marty Tippin <120425148+tippmar-nr@users.noreply.github.com> Date: Fri, 16 Jun 2023 14:26:45 -0500 Subject: [PATCH 1/2] fix: Include config file path in the "Agent is disabled " message on all platforms. --- .../NewRelic/Agent/Core/NewRelic.Agent.Core/AgentManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Agent/NewRelic/Agent/Core/NewRelic.Agent.Core/AgentManager.cs b/src/Agent/NewRelic/Agent/Core/NewRelic.Agent.Core/AgentManager.cs index 5a765c329e..b280ad896f 100644 --- a/src/Agent/NewRelic/Agent/Core/NewRelic.Agent.Core/AgentManager.cs +++ b/src/Agent/NewRelic/Agent/Core/NewRelic.Agent.Core/AgentManager.cs @@ -152,7 +152,7 @@ private AgentManager() private void AssertAgentEnabled(configuration config) { if (!Configuration.AgentEnabled) - throw new Exception(string.Format("The New Relic agent is disabled. Update {0} to re-enable it.", config.AgentEnabledAt)); + throw new Exception(string.Format("The New Relic agent is disabled. Update {0} to re-enable it.", config.AgentEnabledAt ?? config.ConfigurationFileName)); if ("REPLACE_WITH_LICENSE_KEY".Equals(Configuration.AgentLicenseKey)) throw new Exception("Please set your license key."); From 9401817e3ced78e6334d225907fa3d0d1b51bae7 Mon Sep 17 00:00:00 2001 From: Marty Tippin <120425148+tippmar-nr@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:21:55 -0500 Subject: [PATCH 2/2] Add NETSTANDARD specific method for getting config setting with provenance. --- .../NewRelic/Agent/Core/Config/ConfigurationLoader.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Agent/NewRelic/Agent/Core/Config/ConfigurationLoader.cs b/src/Agent/NewRelic/Agent/Core/Config/ConfigurationLoader.cs index e4226ab8fd..66c7c7f24d 100644 --- a/src/Agent/NewRelic/Agent/Core/Config/ConfigurationLoader.cs +++ b/src/Agent/NewRelic/Agent/Core/Config/ConfigurationLoader.cs @@ -111,6 +111,14 @@ public static ValueWithProvenance GetConfigSetting(string key) value = new ValueWithProvenance(ConfigurationManager.AppSettings[key], "ConfigurationManager app setting"); } +#else + if (value?.Value == null) + { + var configMgrStatic = new ConfigurationManagerStatic(); + var configValue = configMgrStatic.GetAppSetting(key); + if (configValue != null) + value = new ValueWithProvenance(configValue, configMgrStatic.AppSettingsFilePath); + } #endif return value; }