LaunchDarkly.DemoObservability 0.55.0

Prefix Reserved
dotnet add package LaunchDarkly.DemoObservability --version 0.55.0
                    
NuGet\Install-Package LaunchDarkly.DemoObservability -Version 0.55.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LaunchDarkly.DemoObservability" Version="0.55.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LaunchDarkly.DemoObservability" Version="0.55.0" />
                    
Directory.Packages.props
<PackageReference Include="LaunchDarkly.DemoObservability" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LaunchDarkly.DemoObservability --version 0.55.0
                    
#r "nuget: LaunchDarkly.DemoObservability, 0.55.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LaunchDarkly.DemoObservability@0.55.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LaunchDarkly.DemoObservability&version=0.55.0
                    
Install as a Cake Addin
#tool nuget:?package=LaunchDarkly.DemoObservability&version=0.55.0
                    
Install as a Cake Tool

LaunchDarkly Observability SDK for .NET MAUI

The LaunchDarkly Observability SDK for .NET MAUI provides automatic and manual instrumentation for your mobile application, including metrics, logs, error reporting, and session replay.

Early Access Preview

NB: APIs are subject to change until a 1.x version is released.

Features

Automatic Instrumentation

The .NET MAUI observability plugin automatically instruments:

  • HTTP Requests: Outgoing HTTP requests
  • Crash Reporting: Automatic crash reporting and stack traces
  • Feature Flag Evaluations: Evaluation events added to your spans
  • Session Management: User session tracking and background timeout handling

Prerequisites

  • .NET 9.0 or higher is required.
  • MAUI support for iOS and Android.

Example Application

A complete example application is available in the sample directory.

Usage

Basic Setup

In your MauiProgram.cs (or wherever you initialize your application), register the ObservabilityPlugin via LdClient:

using LaunchDarkly.Observability;
using LaunchDarkly.Sdk;
using LaunchDarkly.Sdk.Client;
using LaunchDarkly.Sdk.Client.Integrations;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();

        // ... other configuration ...

        var mobileKey = "your-mobile-key";

        var ldConfig = Configuration.Builder(mobileKey, ConfigurationBuilder.AutoEnvAttributes.Enabled)
            .Plugins(new PluginConfigurationBuilder()
                .Add(new ObservabilityPlugin(new ObservabilityOptions(
                    isEnabled: true,
                    serviceName: "maui-sample-app"
                )))
            ).Build();

        var context = Context.New("maui-user-key");
        var client = LdClient.Init(ldConfig, context, TimeSpan.FromSeconds(10));

        return builder.Build();
    }
}

Recording Observability Data

After initialization of the LaunchDarkly client, use LDObserve to record metrics, logs, and errors:

using LaunchDarkly.Observability;

// Record metrics
LDObserve.RecordMetric("user_actions", 1.0);
LDObserve.RecordCount("api_calls", 1.0);
LDObserve.RecordIncr("page_views", 1.0);
LDObserve.RecordHistogram("response_time", 150.0);
LDObserve.RecordUpDownCounter("active_connections", 1.0);

// Record logs with severity and optional attributes
LDObserve.RecordLog(
    "User performed action",
    LDObserve.Severity.Info,
    new Dictionary<string, object?>
    {
        { "user_id", "12345" },
        { "action", "button_click" }
    }
);

// Record errors with an optional cause
LDObserve.RecordError("Something went wrong", "The underlying cause of the error.");
Metrics
Method Description
RecordMetric(name, value) Record a gauge metric
RecordCount(name, value) Record a count metric
RecordIncr(name, value) Record an incremental counter metric
RecordHistogram(name, value) Record a histogram metric
RecordUpDownCounter(name, value) Record an up-down counter metric
Logs

Use RecordLog to emit structured log records with a severity level and optional attributes:

LDObserve.RecordLog(
    "Checkout completed",
    LDObserve.Severity.Info,
    new Dictionary<string, object?>
    {
        { "order_id", "ORD-9876" },
        { "total", 42.99 }
    }
);

Supported severity levels: Trace, Debug, Info, Warn, Error, Fatal.

Errors

Use RecordError to capture error events. The optional second parameter provides the underlying cause:

LDObserve.RecordError("Payment failed", "Timeout connecting to payment gateway.");

Identifying Users

Use the LaunchDarkly client to identify or switch user contexts. This ties observability data to the correct user:

using LaunchDarkly.Sdk;
using LaunchDarkly.Sdk.Client;

// Single context
var userContext = Context.Builder("user-key")
    .Name("Bob Bobberson")
    .Build();
await LdClient.Instance.IdentifyAsync(userContext);

// Multi-context
var userContext = Context.Builder("user-key")
    .Name("Bob Bobberson")
    .Build();
var deviceContext = Context.Builder(ContextKind.Of("device"), "iphone")
    .Name("iphone")
    .Build();
var multiContext = Context.MultiBuilder()
    .Add(userContext)
    .Add(deviceContext)
    .Build();
LdClient.Instance.Identify(multiContext, TimeSpan.FromSeconds(5));

// Anonymous context
var anonContext = Context.Builder("anonymous-key")
    .Anonymous(true)
    .Build();
LdClient.Instance.Identify(anonContext, TimeSpan.FromSeconds(5));

Session Replay

Session Replay captures user interactions and screen recordings to help you understand how users interact with your application. To enable Session Replay, add the SessionReplayPlugin alongside the ObservabilityPlugin:

using LaunchDarkly.SessionReplay;
using LaunchDarkly.Observability;
using LaunchDarkly.Sdk;
using LaunchDarkly.Sdk.Client;
using LaunchDarkly.Sdk.Client.Integrations;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();

        // ... other configuration ...

        var mobileKey = "your-mobile-key";

        var ldConfig = Configuration.Builder(mobileKey, ConfigurationBuilder.AutoEnvAttributes.Enabled)
            .Plugins(new PluginConfigurationBuilder()
                .Add(new ObservabilityPlugin(new ObservabilityOptions(
                    isEnabled: true,
                    serviceName: "maui-sample-app"
                )))
                .Add(new SessionReplayPlugin(new SessionReplayOptions(
                    isEnabled: true,
                    privacy: new SessionReplayOptions.PrivacyOptions(
                        maskTextInputs: true,
                        maskWebViews: false,
                        maskLabels: false
                    )
                )))
            ).Build();

        var context = Context.New("maui-user-key");
        var client = LdClient.Init(ldConfig, context, TimeSpan.FromSeconds(10));

        return builder.Build();
    }
}

Privacy Options

You can control what information is captured during a session using PrivacyOptions:

  • MaskTextInputs: (Default: true) Masks all text input fields.
  • MaskWebViews: (Default: false) Masks all web view content.
  • MaskLabels: (Default: false) Masks all text labels.
  • MaskImages: (Default: false) Masks all images.

Manual Masking

You can manually mask or unmask specific UI components using the provided extension methods on any MAUI View.

using LaunchDarkly.SessionReplay;

// Mask a specific view
mySensitiveView.LDMask();

// Unmask a specific view
myPublicView.LDUnmask();

Contributing

We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the 'gold' plan get access to more features than users in the 'silver' plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read our documentation for a complete list.
  • Explore LaunchDarkly
Product Compatible and additional computed target framework versions.
.NET net9.0-android35.0 is compatible.  net9.0-ios18.0 is compatible.  net10.0-android was computed.  net10.0-ios was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.55.0 77 3/18/2026
0.54.0 72 3/18/2026
0.53.0 72 3/18/2026
0.52.0 80 3/12/2026
0.50.0 84 3/12/2026
0.49.0 84 3/12/2026
0.47.0 90 3/12/2026
0.46.0 84 3/12/2026
0.43.0 77 3/3/2026
0.42.0 121 1/28/2026 0.42.0 is deprecated because it is no longer maintained.
0.4.0 82 3/11/2026