Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingMethodException System.Net.Http.SocketsHttpHandler.get_MeterFactory() with 2.1.0-beta2 on .NET 8.0 #297

Open
kaspermarstal opened this issue Nov 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kaspermarstal
Copy link

Service

OpenAI

Describe the bug

The explicit dependency on System.Diagnostic.DiagnosticSource results in System.Diagnostic.DiagnosticSource.dll being copied to build directory. When the program is started, two such dlls are loaded on my machine, one from build directory and one from system directory, and I get a MissingMethodException:

'EXCEL.EXE' (CoreCLR: clr_libhost): Loaded 'C:\Users\kaspe\source\repos\cellm\src\Cellm\bin\Debug\net8.0-windows\System.Diagnostics.DiagnosticSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EXCEL.EXE' (CoreCLR: clr_libhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.0\System.Diagnostics.DiagnosticSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
ExcelDna.Integration Error: 1 : DnaLibrary AutoOpen Invoke Error : MissingMethodException - Method not found: 'System.Diagnostics.Metrics.IMeterFactory System.Net.Http.SocketsHttpHandler.get_MeterFactory()'.

A workaround is to explicitly exclude this dependency from being copied to the build directory in my own csproj file:

    <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="9.0.0" >
      <ExcludeAssets>runtime</ExcludeAssets>
    </PackageReference>

This results in only the C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.0\System.Diagnostics.DiagnosticSource.dll being loaded and the program works fine.

Steps to reproduce

  1. Create a project
  2. Set net8.0-windows
  3. Add will depends on OpenAI 2.1.0-beta2
  4. Build and run

Code snippets

No response

OS

win

.NET version

8.0

Library version

2.1.0-beta2

@kaspermarstal kaspermarstal added the bug Something isn't working label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant