Saket
(Saket Ranjan)
August 18, 2021, 5:55am
1
APM Agent language and version : .NET Framework and 1.11.0
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant) :
The primary reference could not be resolved because it has an indirect dependency on the framework assembly "System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.7.2". To resolve this problem, either remove the reference or retarget your application to a framework version which contains "System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
Because of this we are not able to build the primary DLL. This is happening in CI/CD server with MSBuild but not with Visual Studio build in local system.
forloop
(Russ Cam)
August 18, 2021, 7:18am
2
This looks like a similar issue to
opened 08:17AM - 04 Oct 18 UTC
bug
area-Infrastructure-libraries
packaging
1. Create a new .NET Framework 4.7.1 console app project.
1. Install BenchmarkD… otNet NuGet package.
1. Observe that above resulted in `<package id="System.ValueTuple" version="4.3.0" targetFramework="net471" />` in `packages.config` due to some dependency.
1. Paste the following code into Program.cs and excute the app.
```cs
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace ConsoleApp3
{
internal class Program
{
private static void Main(string[] args)
{
BenchmarkRunner.Run<Foo>();
}
}
[ClrJob]
public class Foo
{
[Benchmark]
public void Bar()
{
}
}
}
```
Expected result: app executes and performs some no-op benchmarks.
Actual result:
```
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
--- End of inner exception stack trace ---
at BenchmarkDotNet.Running.BenchmarkConverter.GetParameterDefinitions(Type type)
at BenchmarkDotNet.Running.BenchmarkConverter.MethodsToBenchmarksWithFullConfig(Type containingType, MethodInfo[] benchmarkMethods, ReadOnlyConfig fullConfig)
at BenchmarkDotNet.Running.BenchmarkConverter.TypeToBenchmarks(Type type, IConfig config)
at BenchmarkDotNet.Running.BenchmarkRunner.Run[T](IConfig config)
at ConsoleApp3.Program.Main(String[] args) in C:\Source\ConsoleApp3\ConsoleApp3\Program.cs:line 15
```
I see the following automatically added to my app.config:
```
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
```
I do not see ValueTuple in my bin directory.
Do you have a binding redirect in web.config for System.ValueTuple
, similar to
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
If so, can you try removing it and recompiling?
Saket
(Saket Ranjan)
August 18, 2021, 10:03am
3
No I do not have this entry in the project that it is added.
I only have this in app.config.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Elastic.Apm" publicKeyToken="ae7400d2c189cf22" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.11.0.0" newVersion="1.11.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
system
(system)
Closed
September 8, 2021, 6:03am
4
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.