microsoft / semantic-kernel

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

.Net: Bug: Unable to add the Microsoft.SemanticKernel NuGet package (version 1.31.0) to an Azure Function App targeting .NET 8 #9854

Open MuraliM opened 2 days ago

MuraliM commented 2 days ago

Describe the bug When adding the Microsoft.SemanticKernel NuGet package (version 1.31.0) to an Azure Function App targeting .NET 8, the application fails to process the blob when its uploaded. Failing to load Azure.Core: Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0

Azure Function

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.3.2" />
        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.5.0" />
    </ItemGroup>
    <ItemGroup>
      <PackageReference Include="Microsoft.SemanticKernel" Version="1.31.0" />
      <PackageReference Include="System.Memory.Data" Version="9.0.0" />
    </ItemGroup>
    <ItemGroup>
        <None Update="host.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Update="local.settings.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
            <CopyToPublishDirectory>Never</CopyToPublishDirectory>
        </None>
    </ItemGroup>
</Project>

Function trigger

public class Function1
{
    [FunctionName("Function1")]
    public void Run([BlobTrigger("loandocuments/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");

    }
}

Error

For detailed output, run func with --verbose flag. [2024-12-01T18:40:41.485Z] An unhandled exception has occurred. Host is shutting down. [2024-12-01T18:40:41.486Z] Azure.Core: Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Additional information I have tried updating System.Memory.Data to version 8.0.0 as well to 9.0.0 and no luck.. I think the issue https://github.com/microsoft/semantic-kernel/issues/5226 is still occuring with System.Memory.Data. When I run dotnet list package --include-transitive Image

evchaki commented 1 day ago

@MuraliM - thanks for trying this out. @markwallace-microsoft is going to take a look and see why this is not working.