Skip to content

Total crash when ConfigurationManager can't be initialized #326

Closed

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.

Activity

  1. added a commit that references this issue on Oct 21, 2022
  2. MattB-msft commented on Oct 21, 2022

    @MattB-msft
    Member

    matkov - Thanks for your contribution!, We will accept this PR into our primary repository and close this when completed.

  3. added
    bug
    on Oct 21, 2022
  4. added a commit that references this issue on Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions