Skip to content

Total crash when ConfigurationManager can't be initialized #326

@matkov

Description

@matkov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions