From 69e295298f6c97e3f11d503703311dcfaed594fc Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Thu, 9 Nov 2023 16:10:02 +0100 Subject: [PATCH] Add warning about the dangers of the blocking client methods --- src/ConfigCatClient/IConfigCatClient.cs | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/ConfigCatClient/IConfigCatClient.cs b/src/ConfigCatClient/IConfigCatClient.cs index 654425cf..be9fa214 100644 --- a/src/ConfigCatClient/IConfigCatClient.cs +++ b/src/ConfigCatClient/IConfigCatClient.cs @@ -23,6 +23,11 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable /// It is important to provide an argument for the parameter, specifically for the generic type parameter, /// that matches the type of the feature flag or setting you are evaluating.
/// Please refer to this table for the corresponding types. + /// + /// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching. + /// Otherwise execution may involve I/O-bound (e.g. network) operations, because of which the executing thread may be blocked for a longer period of time. This can result in an unresponsive application. + /// In the case of problematic setups, it is recommended to use either the async version of the method or snaphots (see ). + /// /// /// /// The type of the value. Only the following types are allowed: @@ -69,6 +74,11 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable /// It is important to provide an argument for the parameter, specifically for the generic type parameter, /// that matches the type of the feature flag or setting you are evaluating.
/// Please refer to this table for the corresponding types. + /// + /// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching. + /// Otherwise execution may involve I/O-bound (e.g. network) operations, because of which the executing thread may be blocked for a longer period of time. This can result in an unresponsive application. + /// In the case of problematic setups, it is recommended to use either the async version of the method or snaphots (see ). + /// /// /// /// The type of the value. Only the following types are allowed: @@ -111,6 +121,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable /// /// Returns all setting keys synchronously. /// + /// + /// + /// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching. + /// Otherwise execution may involve I/O-bound (e.g. network) operations, because of which the executing thread may be blocked for a longer period of time. This can result in an unresponsive application. + /// In the case of problematic setups, it is recommended to use either the async version of the method or snaphots (see ). + /// + /// /// The collection of keys. IReadOnlyCollection GetAllKeys(); @@ -124,6 +141,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable /// /// Returns the keys and values of all feature flags and settings synchronously. /// + /// + /// + /// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching. + /// Otherwise execution may involve I/O-bound (e.g. network) operations, because of which the executing thread may be blocked for a longer period of time. This can result in an unresponsive application. + /// In the case of problematic setups, it is recommended to use either the async version of the method or snaphots (see ). + /// + /// /// The User Object to use for evaluating targeting rules and percentage options. /// The dictionary containing the keys and values. IReadOnlyDictionary GetAllValues(User? user = null); @@ -139,6 +163,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable /// /// Returns the values along with evaluation details of all feature flags and settings synchronously. /// + /// + /// + /// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching. + /// Otherwise execution may involve I/O-bound (e.g. network) operations, because of which the executing thread may be blocked for a longer period of time. This can result in an unresponsive application. + /// In the case of problematic setups, it is recommended to use either the async version of the method or snaphots (see ). + /// + /// /// The User Object to use for evaluating targeting rules and percentage options. /// The list of values along with evaluation details. IReadOnlyList GetAllValueDetails(User? user = null); @@ -154,6 +185,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable /// /// Refreshes the locally cached config by fetching the latest version from the remote server synchronously. /// + /// + /// + /// Please be aware that calling this method on a thread pool thread or the main UI thread is not safe as + /// execution involves I/O-bound (e.g. network) operations, because of which the executing thread may be blocked for a longer period of time. This can result in an unresponsive application. + /// In the case of problematic setups, it is recommended to either use the async version of the method or call the method on a dedicated background thread. + /// + /// /// The refresh result. RefreshResult ForceRefresh();