Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Could not load assembly Thrift under .net framework 4 #212

Closed
rechkalov opened this issue May 25, 2021 · 2 comments · Fixed by #213
Closed

Could not load assembly Thrift under .net framework 4 #212

rechkalov opened this issue May 25, 2021 · 2 comments · Fixed by #213
Assignees
Labels
bug Something isn't working discussion A discussion about some topic
Milestone

Comments

@rechkalov
Copy link

rechkalov commented May 25, 2021

Describe the bug
When a project targeting framework net472 initializes Jaeger.Senders.Thrift.UdpSender it gets exception "System.IO.FileLoadException: Could not load file or assembly 'Thrift, Version=0.13.0.0, Culture=neutral, PublicKeyToken=5792536a45833b9f' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

To Reproduce
Please check example project: https://github.com/rechkalov/JaegerDemo/
It works with TargetFramework "netcoreapp3.1" or "net5.0", but not with "net472" or "net48".

Version (please complete the following information):

  • Jaeger versions: 1.0.0 to 0.4.0

Additional context
Looks like that the problem is with ApacheThrift package version 0.13.0.1. It contains assembly for .net 4.5 with name Thrift45.dll (not Thrift.dll like versions for net35 or netstandart2.0). Probably updating to next version will fix the issue.
It can not be solved by referencing newer ApacheThrift version on client side because of they changed some signatures (#211)

@rechkalov rechkalov added the bug Something isn't working label May 25, 2021
@Falco20019
Copy link
Collaborator

Hi @rechkalov,

this issue was discussed in #178 in the past and seemed to be solved but reappeared. I will use that issue for continuing the discussion.

The problem with ApacheThrift seems to be, that the DLLs have different names for net45 and netstandard20 targets. Jaeger expects to get the netstandard variant (since it‘s netstandard itself).

I have seen some workarounds on forcing the correct variant, but would prefer to find out why this is happening in the first place.

One solution would be to have a net45 build included in the package which would use the net45 library. Not too sure yet if I like this or the workaround better since it adds another possible source of error…

@Falco20019 Falco20019 self-assigned this May 26, 2021
@Falco20019 Falco20019 added discussion A discussion about some topic bug Something isn't working and removed bug Something isn't working labels May 26, 2021
@Falco20019 Falco20019 added this to the v1.0.1 milestone May 27, 2021
@Falco20019
Copy link
Collaborator

Falco20019 commented May 27, 2021

@rechkalov I just looked into it and tried different solutions. It was sadly not possible to solve this with ApacheThrift in version 0.13 and we had to update to 0.14. The issue is, that the net45 version is not intended for use by netstandard and vice-versa. NuGet itself does not allow to pin a version as it always uses nearest fit. There are some workarounds to pin a version like discussed on #178, but this is not transient and would have needed to be applied in the end-project. Version 0.14 is dropping support for the old .NET Framework generator and only has the .NET Standard one in there (which supports 4.6.1 and newer).

Feel free to try it out using the artifacts from here (using a local nuget repo): https://ci.appveyor.com/project/jaegertracing/jaeger-client-csharp/builds/39350102/artifacts

This version will be released as 1.0.1 even though it also includes newer version of Microsoft.Extensions.Logging (update from 2.2 to 3.1) which shouldn't be a problem for anyone, since .NET Core 2.2 is Out of Support and the 3.1 package should be supported by the 2.1 target.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working discussion A discussion about some topic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants