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

Warning about wrong version of System.Memory when building with Grpc.HealthCheck #22061

Closed
Science-and-Motion-Sports opened this issue Feb 18, 2020 · 4 comments

Comments

@Science-and-Motion-Sports

How to reproduce:

  1. Create a new C# console app (.NET Framework v4.5)
  2. Add a reference to the NuGet package Grpc.HealthCheck v2.27.0
  3. Rebuild all
  4. Build output contains a warning:

1>------ Rebuild All started: Project: WindowsFormsApp1, Configuration: Debug Any CPU ------
1> Consider app.config remapping of assembly "System.Memory, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.1.0" [] to Version "4.0.1.1" [C:\Users\Andre.nuget\packages\system.memory\4.5.3\lib\netstandard1.1\System.Memory.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
1> WindowsFormsApp1 -> C:\dev_tests\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

The warning disappears when downgrading to Grpc.HealthCheck v2.26.0

@Science-and-Motion-Sports
Copy link
Author

@jtattermusch This issue still occurs with the NuGet package Grpc.HealthCheck Version 2.28.1.

The conflicting dependency graphs look as follows:
Grpc.HealthCheck (2.28.1) --> Google.Protobuf (3.11.2) --> System.Memory (4.5.2)
BUT ALSO:
Grpc.HealthCheck (2.28.1) --> Grpc.Core.Api (2.28.1) --> System.Memory (4.5.3)

@Science-and-Motion-Sports
Copy link
Author

Here is a workaround. Add the following lines to your app.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Memory"
                          publicKeyToken="cc7b13ffcd2ddd51"
                          culture="neutral" />
        <bindingRedirect oldVersion="4.0.1.0"
                         newVersion="4.0.1.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

@robcecil
Copy link

@jtattermusch I tried upgrading my c# solution from

Grpc: 1.20.0
Google Protobuf: 3.7.0

to

Grpc: 2.32.0
Google Protobuf: 3.13.0

And I am running into this exact problem. I tried:

  • Making sure my build configuration for all projects is x64, NOT Any CPU.
  • Add bindingIndirects like above ^ to my app.config files.

Nothing seems to remove the conflict between Protobuf's reference to a lower version of System.Memory compared to Grpc's.

@jtattermusch
Copy link
Contributor

Looks like you're basically facing this:
protocolbuffers/protobuf#7848

Two solutions:
This will be fixed once protocolbuffers/protobuf#7940 is merged. Alternatively, it can be solved without needing to upgrade anything by adding this line to your .csproj:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

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

No branches or pull requests

4 participants