This method
public static T GetAppSetting(string key, T defaultValue, DataverseTraceLogger logSink = null)
has catch { ... } section
But method
public static TimeSpan GetAppSettingTimeSpan(string key , TimeSpanFromKey format , TimeSpan defaultValue, DataverseTraceLogger logSink = null)
doesn't have catch { ... } section and when ConfigurationManager raise an Exception then Microsoft.PowerPlatform.Dataverse.Client.ServiceClient will crash when trying to initialize this property:
Total crash when ConfigurationManager can't be initialized.
namespace Microsoft.PowerPlatform.Dataverse.Client.Utils
class AppSettingsHelper
This method public static T GetAppSetting(string key, T defaultValue, DataverseTraceLogger logSink = null)
has catch { ... } section
But method public static TimeSpan GetAppSettingTimeSpan(string key , TimeSpanFromKey format , TimeSpan defaultValue, DataverseTraceLogger logSink = null) doesn't have catch { ... } section and when ConfigurationManager raise an Exception then Microsoft.PowerPlatform.Dataverse.Client.ServiceClient will crash when trying to initialize this property:
public static TimeSpan InMemoryLogCollectionTimeOutMinutes { get; set; } = Utils.AppSettingsHelper.GetAppSettingTimeSpan("InMemoryLogCollectionTimeOutMinutes", Utils.AppSettingsHelper.TimeSpanFromKey.Minutes, TimeSpan.FromMinutes(5));
To resolve this issue you should add catch { ... } section to the GetAppSettingTimeSpan method.