microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.31k stars 3.13k forks source link

.Net: Bug: Hard dependency on Microsoft.Extensions.DependencyInjection.Abstractions 8.0.1 #7124

Closed johnholliday closed 1 week ago

johnholliday commented 2 months ago

Describe the bug The nuget package fails to resolve because of the hard dependency on the 8.0.1 version of the Microsoft.Extensions.DependencyInjection.Abstractions module, when even the Microsoft.Extensions.DependencyInjection module is declared as (>= 8.0.0).

To Reproduce Steps to reproduce the behavior:

  1. Create a project and add the Microsoft.Extensions.DependencyInjection module version 8.0.0.
  2. Create a separate dependent project and add the Microsoft.SemanticKernel module.
  3. Run the main project
  4. See error

Expected behavior The Microsoft.SemanticKernel module should depend on Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0) instead of (>= 8.0.1).

Screenshots If applicable, add screenshots to help explain your problem.

Platform

Additional context Add any other context about the problem here.

johnholliday commented 1 month ago

Has there been any progress on this issue? If not, then can someone suggest a workaround? The problem appears to be related to several packages. Although I'm able to manually redirect them, the prior versions somehow cause the ChatCompletionService to fail.

    private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
        if (args.Name.StartsWith("Microsoft.Extensions.DependencyInjection.Abstractions"))
        {
            return typeof(Microsoft.Extensions.DependencyInjection.ServiceCollection).Assembly;
        }
        else if (args.Name.StartsWith("Microsoft.Extensions.Logging.Abstractions"))
        {
            return typeof(Microsoft.Extensions.Logging.ILogger).Assembly;
        }
        else if (args.Name.StartsWith("System.Diagnostics.DiagnosticSource"))
        {
            return typeof(System.Diagnostics.DiagnosticSource).Assembly;
        }
        else if (args.Name.StartsWith("System.Text.Json"))
        {
            return typeof(System.Text.Json.JsonSerializer).Assembly;
        }
        return null!;
    }
markwallace-microsoft commented 2 weeks ago

@johnholliday I followed your instructions are tried to reproduce this with the very latest SK release. Things seem to work fine for me, can you take a look and let me know if you are doing something different?

image

markwallace-microsoft commented 1 week ago

Closing as the issue cannot be reproduced