Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dot net core 客户端2.0版 GetProperty除string类型外其他类型只能返回defaultValue,代码没有返回类型转换后的值 #2372

Closed
19279217 opened this issue Jun 22, 2019 · 4 comments
Labels

Comments

@19279217
Copy link

    public static bool? GetProperty([NotNull]this IConfig config, string key, bool? defaultValue)
    {
        if (config == null) throw new ArgumentNullException(nameof(config));

        if (!config.TryGetProperty(key, out var str) || str == null) return defaultValue;

        if (!bool.TryParse(str, out var value))
            Logger().Error(new ApolloConfigException($"GetBooleanProperty for {key} failed, return default value {defaultValue}"));

        return defaultValue;
    }

在bool.TryParse 成功的情况下应该return value

@nobodyiam
Copy link
Member

看上去确实是有这个问题

@pengweiqhca
Copy link
Contributor

问题已经修复,请更新包

@stale
Copy link

stale bot commented Dec 2, 2019

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 2, 2019
@stale
Copy link

stale bot commented Dec 16, 2019

This issue has been automatically closed because it has not had activity in the last 14 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants