open-feature / dotnet-sdk

.NET implementation of the OpenFeature SDK
https://openfeature.dev
Apache License 2.0
68 stars 19 forks source link

Metadata is getting lost #281

Closed askpt closed 3 months ago

askpt commented 3 months ago

Discussed in https://github.com/open-feature/dotnet-sdk/discussions/280

Originally posted by **apatenge** July 24, 2024 Hi OpenFeature .NET team, I am wondering if there is a bug in the handling of the meta data between the resolver and the feature client interface. I have created an own provider for my system and when I handover the metadata to the **_ResolutionDetails_** in the resolver it disappears on the way to the feature client. I guess I found the reason for it. In the **_ResolutionDetailsExtensions_** the meta data is not passed through. It seems it is forgotten be added to the parameters of the **_FlagEvaluationDetails_** there. See here: [https://github.com/open-feature/dotnet-sdk/blob/main/src/OpenFeature/Extension/ResolutionDetailsExtensions.cs](https://github.com/open-feature/dotnet-sdk/blob/main/src/OpenFeature/Extension/ResolutionDetailsExtensions.cs) I got me the source code of the latest release 1.5.1 and changed it as the following: From: `return new FlagEvaluationDetails(details.FlagKey, details.Value, details.ErrorType, details.Reason, details.Variant, details.ErrorMessage);` To: `return new FlagEvaluationDetails(details.FlagKey, details.Value, details.ErrorType, details.Reason, details.Variant, details.ErrorMessage, details.FlagMetadata);` With that change it seems to work properly. Could you please check for this and prove my change? Maybe I am wrong and my way to use it is wrong. If not and this is correct, would there be a possibility to release a new version (1.5.2 ?!) with that change and provide this as Nuget package? I would like to use the official package instead of my custom version. Many thanks. Regards, André