launchdarkly / dotnet-client-sdk

LaunchDarkly Client-side SDK for .NET
Other
7 stars 8 forks source link

ClientSdk still referencing EventSource 5.0.1 which depends on Logging 1.0.1. #102

Open mchuong1 opened 4 weeks ago

mchuong1 commented 4 weeks ago

Describe the bug When installing LaunchDarkly.ClientSdk 5.2.1 and following the quickstart guide. Unable to get past client initialization because assembly keeps looking for LaunchDarkly.Logging 1.0.1 when 2.0.0 is installed. Even with assembly binding redirects it is unable to solve the issue

To reproduce Install nuget package LaunchDarkly.ClientSdk 5.2.1 and follow quickstart guide.

Expected behavior Return the flag value

Logs Exception thrown: 'System.IO.FileLoadException' in LaunchDarkly.InternalSdk.dll An exception of type 'System.IO.FileLoadException' occurred in LaunchDarkly.InternalSdk.dll but was not handled in user code Could not load file or assembly 'LaunchDarkly.Logging, Version=1.0.1.0, Culture=neutral, PublicKeyToken=d9182e4b0afd33e7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

SDK version 5.2.1

Language version, developer tools .Net 4.8 Visual Studio

OS/platform Windows 10

Additional Context Service

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

public class FeatureFlagService : IDisposable
{
    private static readonly Lazy<LdClient> _lazyClient = new Lazy<LdClient>(() =>
    {
        var context = Context.New("***");
        var timeSpan = TimeSpan.FromSeconds(10);
        var client = LdClient.Init(
            Configuration.Default("***", ConfigurationBuilder.AutoEnvAttributes.Enabled),
            context,
            timeSpan
        );

        if (!client.Initialized)
        {
            Console.WriteLine("SDK failed to initialize");
            Environment.Exit(1);
        }

        return client;
    });

    private static LdClient Client => _lazyClient.Value;

    public bool GetFeatureFlag(string flagKey, bool defaultValue)
    {
        return Client.BoolVariation(flagKey, defaultValue);
    }

    public void Dispose()
    {
        if (_lazyClient.IsValueCreated)
        {
            Client.Dispose();
        }
    }
}
tanderson-ld commented 4 weeks ago

Hello, thank you for reporting this. We will investigate. Tracked internally as 745.

tanderson-ld commented 3 weeks ago

I tried to reproduce this making a console app for .NET Framework 4.8 on Windows, but it resolved correctly to LaunchDarkly.Logging 2.0.0.

Are you able to generate a graph of the dependency resolution and post that here?