Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR
As part of our official support for ConfigCat OpenFeatures providers, I revised the .NET provider and am proposing the following improvements and corrections:
InitializeAsync
(so feature flag evaluation after awaitingSetProviderAsync
will certainly succeed) andShutdownAsync
(so the underlying client is disposed, i.e. the polling loop is stopped as soon as it's not needed any more).UserBuilder
made some unnecessary heap memory allocations (e.g. when converting attribute keys to upper case). Let's eliminate these. (As feature flag evaluation can occur on hot paths, we should aim to minimize allocations to put as little pressure on the GC as possible.)id
oridentifier
is not specified in the evaluation context, a random user id is generated (a guid). I advise against this as it can lead to confusing user experience for such contexts, especially in the case of percentage option rules (which are based on user id by default). I suggest some constant string like"<n/a>"
for such cases.SetProviderAsync
) and exercises all of its parts (evaluation with context, user attribute translation, user object building, etc).