All notable changes to the LaunchDarkly .NET Server-Side SDK will be documented in this file. This project adheres to Semantic Versioning.
- Added support for upcoming LaunchDarkly experimentation features. See
ILdClient.Track(string, User, LdValue, double)
.
- Fixed a bug due to incorrect use of a lock that could cause a read from
InMemoryFeatureStore
to fail if done at the same time as an update. (Thanks, JeffAshton!)
(The changes below were originally released in 5.7.0, but that release was broken; 5.7.1 is its replacement.)
This release includes new types and deprecations that correspond to upcoming changes in version 6.0.0. Developers are encouraged to start adopting these changes in their code now so that migrating to 6.0.0 in the future will be easier. Most of these changes are related to the use of mutable types, which are undesirable in a concurrent environment. User
and Configuration
are currently mutable types; they will be made immutable in the future, so there are now builders for them. Arbitrary JSON values are currently represented with the Newtonsoft.Json
type JToken
, which is mutable (if it contains an array or a JSON object); the new type LdValue
is safer, and will eventually completely replace JToken
in the public API.
Also, generated HTML documentation for all of the SDK's public types, properties, and methods is now available online at https://launchdarkly.github.io/dotnet-server-sdk/. Currently this will only show the latest released version.
Configuration.Builder
provides a fluent builder pattern for constructingConfiguration
objects. This is now the preferred method for building a user, rather than usingConfigurationExtension
methods likeWithStartWaitTime()
that modify the existing configuration object.Configuration.EventCapacity
andConfiguration.EventFlushInterval
(new names forEventQueueCapacity
andEventQueueFrequency
, for consistency with other LaunchDarkly SDKs).User.Builder
provides a fluent builder pattern for constructingUser
objects. This is now the preferred method for building a user, rather than settingUser
properties directly or usingUserExtension
methods likeAndName()
that modify the existing user object.User.IPAddress
is equivalent toUser.IpAddress
, but has the standard .NET capitalization for two-letter acronyms.- The new
LdValue
type is a better alternative to usingJToken
,JValue
,JArray
, etc. for arbitrary JSON values (such as the return value ofJsonVariation
, or a custom attribute for a user). - There is now more debug-level logging for stream connection state changes.
- XML documentation comments are now included in the package for all target frameworks. Previously they were only included for .NET Standard 1.4.
- Calls to flag evaluation methods such as
BoolVariation
are now somewhat more efficient because they no longer convert the default value to aJToken
internally; also, user attributes no longer need to be converted toJToken
internally when evaluating flag rules. If flag evaluations are very frequent, this reduces the number of ephemeral objects created on the heap.
- Due to the default parsing behavior of
Newtonsoft.Json
, strings in the date/time format "1970-01-01T00:00:01Z" or "1970-01-01T00:00:01.001Z" would not be considered equal to an identical string in a flag rule.
- All
ConfigurationExtension
methods are now deprecated. Configuration.SamplingInterval
. The intended use case for theSamplingInterval
feature was to reduce analytics event network usage in high-traffic applications. This feature is being deprecated in favor of summary counters, which are meant to track all events.Configuration.EventQueueCapacity
andConfiguration.EventQueueFrequency
(see new names above).User
constructors (useUser.WithKey
orUser.Builder
).User.IpAddress
(useIPAddress
).- All
UserExtension
methods are now deprecated. The setters for allUser
properties should also be considered deprecated, although C# does not allow these to be marked with[Obsolete]
. IBaseConfiguration
andICommonLdClient
interfaces.- The
InMemoryFeatureStore
constructor. UseComponents.InMemoryFeatureStore
.
- If streaming is disabled, polling requests could stop working if the client ever received an HTTP error from LaunchDarkly. This bug was introduced in the 5.6.3 release.
- The NuGet package name and assembly name have changed: they are now
LaunchDarkly.ServerSdk
instead ofLaunchDarkly.Client
. There are no other changes in this release; the namespace used in .NET code is stillLaunchDarkly.Client
. SubstitutingLaunchDarkly.Client
version 5.6.3 withLaunchDarkly.ServerSdk
version 5.6.4 will not affect functionality.
- If
Track
orIdentify
is called without a user, the SDK now will not send an analytics event to LaunchDarkly (since it would not be processed without a user).
The LaunchDarkly SDK repositories are being renamed for consistency. This repository is now dotnet-server-sdk
rather than dotnet-client
.
The NuGet package name and assembly name will also change. In the 5.6.3 release, it is still LaunchDarkly.Client
; in all releases after 5.6.3, it will be LaunchDarkly.ServerSdk
. No further updates to the LaunchDarkly.Client
package will be published after this release.
- The default value for the configuration property
capacity
(maximum number of events that can be stored at once) is now 10000, consistent with the other SDKs, rather than 500.
- Under some circumstances, a
CancellationTokenSource
might not be disposed of after making an HTTP request, which could cause a timer object to be leaked. (#100) - In polling mode, if the client received an HTTP error it would retry the same request one second later. This was inconsistent with the other SDKs; the correct behavior is for it to wait until the next scheduled poll.
- The
HttpClientTimeout
configuration property was being ignored when making HTTP requests to send analytics events.
- The assemblies in this package now have Authenticode signatures.
- There are now helper classes that make it much simpler to write a custom
IFeatureStore
implementation. See theLaunchDarkly.Client.Utils
namespace. - The new
FeatureStoreCaching
class will be used by database feature store integrations in the future. It is not used by the SDK client itself.
- Some support code has been moved into a separate assembly,
LaunchDarkly.Cache
. - The published assemblies are now built in Release configuration and no longer contain debug information.
- If you are building a copy of the SDK yourself, the Debug configuration no longer does any signing, so does not require a key file.
-
It is now possible to inject feature flags into the client from local JSON or YAML files, replacing the normal LaunchDarkly connection. This would typically be for testing purposes. See
LaunchDarkly.Client.Files.FileComponents
. -
The
AllFlagsState
method now accepts a new option,FlagsStateOption.DetailsOnlyForTrackedFlags
, which reduces the size of the JSON representation of the flag state by omitting some metadata. Specifically, it omits any data that is normally used for generating detailed evaluation events if a flag does not have event tracking or debugging turned on. -
The non-strong-named version of this library (
LaunchDarkly.Common
) can now be used with a non-strong-named version of LaunchDarkly.Client, which does not normally exist but could be built as part of a fork of the SDK.
- Previously, the delay before stream reconnect attempts would increase exponentially only if the previous connection could not be made at all or returned an HTTP error; if it received an HTTP 200 status, the delay would be reset to the minimum even if the connection then immediately failed. Now, if the stream connection fails after it has been up for less than a minute, the reconnect delay will continue to increase.
-
Fixed an unobserved exception that could occur following a stream timeout, which could cause a crash in .NET 4.0.
-
Fixed a
NullReferenceException
that could sometimes appear in the log if a stream connection failed. -
Fixed the documentation for
Configuration.StartWaitTime
to indicate that the default is 10 seconds, not 5 seconds. (Thanks, KimboTodd!) -
JSON data from
AllFlagsState
is now slightly smaller even if you do not use the new option described above, because it completely omits the flag property for event tracking unless that property is true.
- The new
LDClient
methodsBoolVariationDetail
,IntVariationDetail
,DoubleVariationDetail
,StringVariationDetail
, andJsonVariationDetail
allow you to evaluate a feature flag (using the same parameters as you would forBoolVariation
, etc.) and receive more information about how the value was calculated. This information is returned in anEvaluationDetail
object, which contains both the result value and anEvaluationReason
which will tell you, for instance, if the user was individually targeted for the flag or was matched by one of the flag's rules, or if the flag returned the default value due to an error.
- When evaluating a prerequisite feature flag, the analytics event for the evaluation did not include the result value if the prerequisite flag was off.
- Fixed a bug in streaming mode that prevented the client from reconnecting to the stream if it received an HTTP error status from the server (as opposed to simply losing the connection). (#88)
- Numeric flag values can now be queried with either
IntVariation
orFloatVariation
and the result will be coerced to the requested type, as long as it is numeric. Previously, if the type of value that came from LaunchDarkly in JSON (or, more specifically, the type that Newtonsoft.Json decided to decode the value as) was different, it was considered an error and the default value would be returned. This change makes the .NET SDK consistent with the Go and Java SDKs.
- The new
ILdClient
methodAllFlagsState()
should be used instead ofAllFlags()
if you are passing flag data to the front end for use with the JavaScript SDK. It preserves some flag metadata that the front end requires in order to send analytics events correctly. Versions 2.5.0 and above of the JavaScript SDK are able to use this metadata, but the output ofAllFlagsState()
will still work with older versions. - The
AllFlagsState()
method also allows you to select only client-side-enabled flags to pass to the front end, by using the optionFlagsStateOption.ClientSideOnly
.
ILdClient.AllFlags()
- In streaming mode, if the stream connection fails, there should be an increasing backoff interval before each reconnect attempt. Previously, it would log a message about waiting some number of milliseconds, but then not actually wait.
- The required package
LaunchDarkly.EventSource
no longer hasPackageReference
s to System assemblies.
- The internal classes representing feature flag and segment data were not JSON-serializable. This did not affect the SDK itself, but prevented any
IFeatureStore
implementation based on Json.Net serialization from working. - The event processor did not post to the correct URI if the base events URI was set to a custom value with a non-root path. This did not affect normal usage, but would be a problem if events were being redirected to some other service.
- New configuration property
UseLdd
allows the client to use the "LaunchDarkly Daemon", i.e. getting feature flag data from a store that is updated by anld-relay
instance. However, this will not be usable until the Redis feature store integration is released (soon).
- If you attempt to evaluate a flag before the client has established a connection, but you are using a feature store that has already been populated, the client will now use the last known values from the store instead of returning default values.
- The
LaunchDarkly.Common
package, which is used byLaunchDarkly.Client
, has been renamed toLaunchDarkly.Common.StrongName
. Note that you should not have to explicitly install this package; it will be imported automatically.
- The SDK was referencing several system assemblies via
<PackageReference>
, which could cause dependency conflicts. These have been changed to framework<Reference>
s. A redundant reference toSystem.Runtime
was removed. (#83) - The client was logging (at debug level) a lengthy exception stacktrace whenever a string comparison operator was applied to a user property that was null. It no longer does this.
- When targeting the .NET 4.5 framework, the dependency on Newtonsoft's JSON.Net framework has been changed: the minimum version is now 6.0.1 rather than 9.0.1. This was changed in order to support customer code that uses older versions of JSON.Net. For most applications, this change should have no effect since it is only a minimum version, which can be overridden by any higher version specified in your own dependencies. Note that when targeting .NET Standard, the minimum JSON.Net version is still 9.0.1 because earlier versions were not compatible with .NET Standard.
- The
Identify
method has been moved back intoILdClient
rather than being inILdCommonClient
.
- A new overload of
LDClient.Track
allows you to pass any kind of JSON value for the custom event data, not just a string. - The
User
class now implementsEquals
andGetHashCode
, and has a copy constructor.
- Some classes and interfaces have been moved into a separate assembly,
LaunchDarkly.Common
(source code here), because they will also be used by the LaunchDarkly Xamarin SDK. The names and namespaces have not changed, so you do not need to make any code changes.LaunchDarkly.Common
will be installed automatically when you upgradeLaunchDarkly.Client
; all other dependencies are unchanged. - The client now treats most HTTP 4xx errors as unrecoverable: that is, after receiving such an error, it will not make any more HTTP requests for the lifetime of the client instance, in effect taking the client offline. This is because such errors indicate either a configuration problem (invalid SDK key) or a bug, which is not likely to resolve without a restart or an upgrade. This does not apply if the error is 400, 408, 429, or any 5xx error.
- During initialization, if the client receives any of the unrecoverable errors described above, the client constructor will return immediately; previously it would continue waiting until a timeout. The
Initialized()
method will return false in this case.
- Ensured that all
HttpClient
instances managed by the client are disposed of immediately if you callDispose
on the client. - Passing
null
for user when callingIdentify
orTrack
no longer causes aNullReferenceException
. Instead, the appropriate event will be sent with no user.
- To reduce the network bandwidth used for analytics events, feature request events are now sent as counters rather than individual events, and user details are now sent only at intervals rather than in each event. These behaviors can be modified through the LaunchDarkly UI and with the new configuration option
InlineUsersInEvents
. For more details, see Analytics Data Stream Reference. - The
IStoreEvents
interface has been renamed toIEventProcessor
, has slightly different methods, and includesIDisposable
. Also, the properties of theEvent
classes have changed. This will only affect developers who created their own implementation ofIStoreEvents
.
- New extension methods on
Configuration
(WithUpdateProcessorFactory
,WithFeatureStoreFactory
,WithEventProcessorFactory
) allow you to specify different implementations of each of the main client subcomponents (receiving feature state, storing feature state, and sending analytics events) for testing or for any other purpose. TheComponents
class provides factories for all built-in implementations of these.
- The
WithFeatureStore
configuration method is deprecated, replaced by the new factory-based mechanism described above. - The
LdClient
constructor overload that takes anIEventProcessor
(formerlyIStoreEvents
) is deprecated, replaced byWithEventProcessorFactory
.
- Fixed a bug in the event sampling feature that was introduced in 4.1.0: sampling might not work correctly if events were generated from multiple threads.
Configuration
now has anEventSamplingInterval
property. If greater than zero, this causes a fraction of analytics events to be sent to LaunchDarkly: one per that number of events (pseudo-randomly). For instance, setting it to 5 would cause 20% of events to be sent on average.
ConfigurationExtensions.WithPollingInterval
will no longer throw an exception if the parameter is lower than the minimum. Instead, it will simply set the value to the minimum and log a warning.
- Support for a new LaunchDarkly feature: reusable user segments.
- The client now uses Common.Logging.
- The
FeatureStore
interface has been changed to support user segment data as well as feature flags. Existing code that usesInMemoryFeatureStore
orRedisFeatureStore
should work as before, but custom feature store implementations will need to be updated. - Some previously public classes that were not meant to be public are now internal.
- All previously undocumented methods now have documentation comments.
- Obsolete/deprecated methods have been removed.
- Removed
Configuration.WithLoggerFactory
since the logging framework has changed. For more details on setting up logging, see here.
- Improved performance of the semantic version operators by precompiling a regex.
- New property
LdClient.Version
returns the client's current version number. - Adds support for a future LaunchDarkly feature, coming soon: semantic version user attributes.
- Custom attributes can now have long integer values.
- It is now possible to compute rollouts based on an integer attribute of a user, not just a string attribute.
- Support for specifying private user attributes in order to prevent user attributes from being sent in analytics events back to LaunchDarkly. See the
AllAttributesPrivate
andPrivateAttributeNames
methods onConfiguration
as well as theAndPrivateX
methods onUser
.
- The stream connection will now restart when a large feature flag update fails repeatedly to ensure that the client is using most recent flag values.
- Client no longer reconnects after detecting an invalidated SDK key.
- Framework target for netstandard1.4 and netstandard2.0. Thanks @nolanblew and @ISkomorokh!
- Added the Apache 2.0 license to
LaunchDarkly.Client.csproj
- Fixed a bug causing ASP.NET applications to be blocked during client initialization.
- Removed unused and transitive dependencies.
- Improved logging. Thanks @MorganVergara and @JeffAshton!
- 🚀 Support for Streaming via Server-Sent Events as an alternative to Polling. HTTP-based streaming is favored over polling to reduce network traffic and propagate feature flag updates faster. 🚀
- New builder parameters to complement streaming functionality
WithIsStreamingEnabled
: Set whether streaming mode should be enabled,true
by default.WithStreamUri
: Set the base URL of the LaunchDarkly streaming server. May be used in conjunction with the LaunchDarkly Relay Proxy.WithReadTimeout
: The timeout when reading data from the streaming API. Defaults to 5 minutesWithReconnectTime
: The time to wait before attempting to reconnect to the streaming API. Defaults to 1 second
- Apache 2.0 License
- Streaming is now used to retrieve feature flag configurations by default.
- Minimum (and default) polling interval changed from 1 second to 30 seconds.
PollingProcessor
no longer retries failed feature flag polling attempts.
- Updated dependency versions. Thanks @ISkomorokh!
- Exceptions in
FeatureRequestor
are rethrown without replacing stack information
UserExtensions.AndName
updatesuser.Name
instead ofuser.LastName
- Config option to use custom implementation of IFeatureStore
- Artifact is now signed
- Removed NETStandard.Library from dependencies so it isn't brought in by non-.NET core projects.
- Project files migrated to current
*.csproj
standard - Fixed release that inadvertently removed the ability to set a custom HttpClientHandler
- Config option to use custom implementation of IFeatureStore
- Artifact is now signed
- Removed NETStandard.Library from dependencies so it isn't brought in by non-.NET core projects.
- Project files migrated to current
*.csproj
standard
- Improved error handling when sending events
- Configurable http request timeout
- Made http requests more resilient and logging more informative.
- Addresses Unnecesary Lock contention when polling: launchdarkly#18
- Logging framework: Now using Microsoft.Extensions.Logging
- No longer depending on ASP.NET: launchdarkly#8
- Support for .NET core: launchdarkly#9
- Http client now has a request timeout: launchdarkly#27
- File-based configuration override option has been removed
- Code cleanup
- Address launchdarkly#27
- Improve error logging- we're now logging messages from inner exceptions.
- Async http client code improvements.
- Support for multivariate feature flags. New methods
StringVariation
,JsonVariation
andIntVariation
andFloatVariation
for multivariates. - New
AllFlags
method returns all flag values for a specified user. - New
SecureModeHash
function computes a hash suitable for the new LaunchDarkly JavaScript client's secure mode feature.
- LdClient now implements a new interface: ILdClient
- The
Toggle
call has been deprecated in favor ofBoolVariation
.