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

Dependency Conflict with System.Runtime.CompilerServices.Unsafe and MessagePack in a .NET Project #196

Open
JGProg opened this issue Nov 26, 2024 · 1 comment

Comments

@JGProg
Copy link

JGProg commented Nov 26, 2024

Hello everyone,

I am encountering an issue in my framework 4.8 C# project related to FitSharp and MessagePack. Here are the details:

  1. Project Context:

    • My project targets either .NET Framework 4.8
    • I am using FitSharp, and I am trying run tests using Runner.exe.
    • Dependencies are managed through NuGet.

  2. Specific Problem:

    • A dependency (possibly transitively through MessagePack or FitSharp) requires System.Runtime.CompilerServices.Unsafe version **>= 6.0.0`.
    • However, another dependency (or configuration) enforces version 4.0.0, which is incompatible.

3 . Exact Error Message:

__EXCEPTION__:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'MessagePackSerializerOptionsDefaultSettingsLazyInitializationHelper' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MessagePack.Resolvers.StandardResolver' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MessagePack.Internal.StandardResolverHelper' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MessagePack.Resolvers.DynamicUnionResolver' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MessagePack.MessagePackSecurity' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
  1. Observation:
    • If I write a standalone program and directly reference the DLLs, it works perfectly.
    • This suggests the issue is related to dependency resolution when using NuGet and not the DLL itself.

    Thank for help.

@sqeezy
Copy link
Collaborator

sqeezy commented Nov 28, 2024

Can you elaborate on your test setup? I don't quite understand how you manage the dependency management via Nuget while running the tests with Runner.exe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants