I'm using these pacakges:

PackageReference Include="Polly" Version="7.2.2"
PackageReference Include="Polly.Caching.Memory" Version="3.0.2" 

I have a testproject that uses these packages and the code works. When I try to integrate my code in an existing application with lots of other nuget packages, suddenly I get a TypeLoadException.

The method TryGet in the type Polly.Caching.Memory.MemoryCacheProvider from the assembly Polly.Caching.Memory, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc doesn't have an implementation.

I have been checking everything, but I can't find the cause of this.

The versions of Polly and Polly.Caching.Memory are aligned across all projects involved. In the bin folder the correct version appears.

I looked at the code of the assembly and the code has an implementation for TryGet

Any suggestion on what I can do to further investigate this?

1

There are 1 best solutions below

0
On

The packages were all correctly configured.

I got on the right track when I saw that the method was returning a tuple. I figured that perhaps this second application was not using the correct versions of the same packages.

I changed :

 <HintPath>..\Solutions\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>

To

<HintPath>..\Solutions\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>

Bingo!