https://www.growthbook.io/ logo
Join Slack
Powered by
# sdk-c-sharp
  • b

    brief-honey-45610

    09/21/2023, 4:02 AM
    set the channel topic: Ask questions here related to the C# SDK.
  • b

    brief-honey-45610

    09/21/2023, 4:02 AM
    set the channel description: Ask questions here related to the C# SDK.
  • b

    brief-honey-45610

    01/24/2024, 4:48 PM
    Hi there, Chris 👋🏻 I'm August from the GrowthBook team. We had a customer recently ask about the C# SDK and I wanted to post their question here in case you can answer it.
    I’m attempting to add the GrowthBook.dll into a Unity/C# project we have, it successfully builds in the Unity editor, however on Android builds it runs into problems.
    I’ve imported GrowthBook.dll in Assets/Plugins
    I reference the GrowthBook namespace and am able to access the types and classes in the GrowthBook.dll in the Unity editor, however as soon as it’s on a device it no longer works, is this dll compatible with Android/iOS?
    Do you have any other customers who’ve attempted something similar?
    https://www.nuget.org/packages/growthbook-c-sharp/0.2.0
    m
    • 2
    • 3
  • a

    adventurous-traffic-38037

    02/21/2024, 3:06 PM
    Hello everyone, I have a query regarding the
    GetFeatureValue
    method in GrowthBook when testing with C# in LINQPad. Executing the command ``gb.GetFeatureValue("test", default(bool?)).Dump();`` yields different outcomes depending on the default feature value. Specifically, if the feature's default is set to true, the result is as expected: true. However, when the default is set to false, the result is unexpectedly null, which seems illogical, especially since the production environment is active. Adding to the confusion, the response from the request indicates the default value as null, which contradicts the expected behavior. Here's the response snippet for clarity: ``{"status":200,"features":{"test":{"defaultValue":false},"gbdemo-checkout-layout":{"defaultValue":"current","rules":[{"condition":{"is_employee":true},"force":"dev"},{"coverage":1,"seed":"gbdemo-checkout-layout","hashVersion":2,"variations":["current","dev-compact","dev"],"weights":[0.3334,0.3333,0.3333],"key":"gbdemo-checkout-layout","meta":[{"key":"0","name":"Current"},{"key":"1","name":"Dev-Compact"},{"key":"2","name":"Dev"}],"phase":"0","name":"gbdemo-checkout-layout"}]}},"dateUpdated":"2024-02-21T145528.321Z"}``. This discrepancy is baffling and I'm looking for insights or explanations.
  • m

    modern-winter-76959

    02/22/2024, 9:19 AM
    Good morning all. I've been integrating the sdk with our codebase and wanted to get some clarity on whether there's an issue with our setup or an issue in the sdk itself. The situation is where we have a forcing rule and a tracking callback configured. This causes a null ref ex in this code due to rule.Tracks being null
  • m

    modern-winter-76959

    02/22/2024, 9:20 AM
    I can't see anywhere in the front end which would allow us to define this collection for a forced rule
  • m

    modern-winter-76959

    02/22/2024, 9:22 AM
    This is our configuration code for setting up the growthbook instance
  • m

    modern-winter-76959

    02/22/2024, 9:24 AM
    Adding a null check before rule.Tracks resolves this issue but it would be good to know how we would setup a rule with tracking information. Thanks!
  • f

    fresh-football-47124

    04/10/2024, 4:58 AM
    C# SDK has been updated - 1.0.5 https://github.com/growthbook/growthbook-c-sharp and https://www.nuget.org/packages/growthbook-c-sharp/ - Big thanks to @magnificent-twilight-21363 for his work on this!
  • b

    bulky-jackal-91808

    06/11/2024, 1:11 PM
    Dear Team, I am new to GrowthBook and am currently setting it up locally. We plan to use it with Sitecore CMS. I am trying to set it up in an ASP.NET framework using the pipeline. I have already installed the NuGet package with the following details:
    <package id="growthbook-c-sharp" version="1.0.5" targetFramework="net48" />
    . However, I am encountering an error stating that the relevant method cannot be found. Can you please help me resolve this issue?
    f
    • 2
    • 2
  • s

    silly-processor-16350

    06/25/2024, 2:40 AM
    Hello everyone, I integrated growthbook into my project. My backend is in .NET and my database is postgreSQL. When I released it to production, my response times went through the roof. Any recommendations you can give me? I think I skipped something in the documentation 😞
    r
    • 2
    • 2
  • g

    gray-keyboard-18541

    09/09/2024, 11:34 AM
    I have another question about the SDK: I have it set up in a way that it should receive the changes from the API, which I can see is happening in the logs. This config was not document anywhere so I may have set it up incorrectly. However, the value of the flag does not change, so it continues to evaluate to
    true
    even though I set it to
    false
    . I create a Singleton instance that I make available to DI:
    Copy code
    var context = new GrowthBook.Context
    {
       Enabled = true,
       ClientKey = "sdk-...",
       LoggerFactory = loggerFactory
    };
    
    _gb = new GrowthBook.GrowthBook(context);
    _gb.LoadFeatures();
    These are the logs indicating that it received the feature change.
    Copy code
    info: GrowthBook.Api.FeatureRefreshWorker[0]
          API response JSON contained no encrypted features, returning '1' unencrypted features
    info: GrowthBook.Api.FeatureRefreshWorker[0]
          Cache has been refreshed with server sent event features
    info: GrowthBook.Api.FeatureRefreshWorker[0]
          Making an HTTP request to server sent events endpoint '<https://cdn.growthbook.io/sub/sdk-...>'
    info: GrowthBook.Api.FeatureRefreshWorker[0]
          API response JSON contained no encrypted features, returning '1' unencrypted features
    info: GrowthBook.Api.FeatureRefreshWorker[0]
          Cache has been refreshed with server sent event features
    This is how I evaluate the flag on the GrowthBook instance injected via DI:
    Copy code
    _gb.Attributes["workspaceId"] = workspaceId.ToString();
     return _gb.IsOn(key);
    As I said, the value of the flag only changes after I restart the service.
    f
    • 2
    • 3
  • f

    flaky-noon-11399

    09/09/2024, 8:16 AM
    Hi Team, a customer is trying to set up the C# server side SDK. Do you have an example with the SDK fetching the flags from the API and refreshing them? This seems to be supported in code but not documented.
    g
    • 2
    • 2
  • f

    freezing-postman-69602

    09/12/2024, 7:30 PM
    Where do you see 1.0.2? In Growthbook portal, while creating a sdk connection?
    f
    g
    • 3
    • 4
  • f

    flaky-noon-11399

    10/29/2024, 4:00 PM
    Hey Team, what is the syntax for the trackingCallback in C#? I can't find it documented here or here. Customer query in screenshot
    f
    • 2
    • 3
  • l

    limited-businessperson-27008

    06/03/2025, 5:27 PM
    Hello, is anyone aware of how to fix this? https://github.com/growthbook/growthbook-c-sharp/issues/36
  • l

    limited-businessperson-27008

    06/09/2025, 3:01 PM
    is it possible to collaborate for the c# SDK? are you guys accepting pull-requests?
    f
    • 2
    • 1