googleapis / google-cloud-dotnet

Google Cloud Client Libraries for .NET
https://cloud.google.com/dotnet/docs/reference/
Apache License 2.0
928 stars 365 forks source link

System.IO.FileLoadException: Could not load file or assembly 'Google.Api.Gax.Grpc, Version=2.1.0.0' #1744

Closed NPSF3000 closed 6 years ago

NPSF3000 commented 6 years ago

System.IO.FileLoadException: Could not load file or assembly 'Google.Api.Gax.Grpc, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

.Net 4.6.1 Error occurs when trying to execute Google.Cloud.PubSub.V1 (1.0.0-beta13) code.

We do have binding redirects (that have correct versions):

      <dependentAssembly>
        <assemblyIdentity name="Google.Api.Gax" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Google.Api.Gax.Grpc" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Google.Api.Gax.Rest" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
      </dependentAssembly>
jskeet commented 6 years ago

Could you give us the context of what kind of app this is? What other dependencies do you have? (If we could reproduce this, it'll make it much easier to fix.)

If you update to beta15 does that work? (I'd still expect this to work with beta13, but it would be good to know.)

NPSF3000 commented 6 years ago

@jskeet It's an ASP.NET web service (ASMX). We have quite a few dependencies including Cloud IAM, Storage, Plus as well as AWS and non google libraries.

Beta15 does appear to work (I didn't see it due to it being a pre-release) - thanks!

jskeet commented 6 years ago

Beta13 is a pre-release too, of course :) I wonder whether the issue is that Beta13 relied on a pre-release of Google.Api.Gax.Grpc. It's possible that there was a breaking change from beta to GA there.

I'll try Beta13 + Storage latest + IAM latest. If you can give me details of the IAM/Storage versions, that would be even better.

NPSF3000 commented 6 years ago

Looks like we have:

 <package id="Google.Api.CommonProtos" version="1.1.0" targetFramework="net461" />
  <package id="Google.Api.Gax" version="2.2.1" targetFramework="net461" />
  <package id="Google.Api.Gax.Grpc" version="2.2.1" targetFramework="net461" />
  <package id="Google.Api.Gax.Rest" version="2.2.1" targetFramework="net461" />
  <package id="Google.Apis" version="1.30.0" targetFramework="net461" />
  <package id="Google.Apis.Auth" version="1.30.0" targetFramework="net461" />
  <package id="Google.Apis.Bigquery.v2" version="1.29.1.983" targetFramework="net461" />
  <package id="Google.Apis.Core" version="1.30.0" targetFramework="net461" />
  <package id="Google.Apis.DLP.v2beta1" version="1.29.1.991" targetFramework="net461" />
  <package id="Google.Apis.Oauth2.v2" version="1.24.1.672" targetFramework="net452" />
  <package id="Google.Apis.Plus.v1" version="1.29.1.970" targetFramework="net461" />
  <package id="Google.Apis.Storage.v1" version="1.29.1.988" targetFramework="net461" />
  <package id="Google.Cloud.Iam.V1" version="1.0.0-beta13" targetFramework="net461" />
  <package id="Google.Cloud.PubSub.V1" version="1.0.0-beta15" targetFramework="net461" />
  <package id="Google.Cloud.Storage.V1" version="2.0.0" targetFramework="net461" />
  <package id="Google.Protobuf" version="3.3.0" targetFramework="net461" />
  <package id="Grpc.Auth" version="1.7.0" targetFramework="net461" />
  <package id="Grpc.Core" version="1.7.1" targetFramework="net461" />

At least you know your work is appreciated ;)

jskeet commented 6 years ago

Okay - I'd expect the Google.Apis parts to be irrelevant, but I'll try that combination of IAM, Storage, PubSub and Gax.Grpc.

NPSF3000 commented 6 years ago

Awesome. Just so you know having beta15 work is good enough for us at this time, so I consider this resolved.

I hope this info helps you understand the root cause.

jskeet commented 6 years ago

Hmm - I've just tried this, and I can't reproduce the problem. If you can easily reproduce it in a way that I'd be able to take a look at, I'd be interested to see that - but otherwise, it's probably worth closing until we see this again. (It's possible that mixtures of prereleases for support libraries could cause issues. That may be what's wrong here, but it's hard to know for sure.)

(As an aside, we have Google.Cloud packages for BigQuery and DLP that you may want to try too...)

NPSF3000 commented 6 years ago

Agreed. I might be able to create a reproducible case... but it's not worth our time at this moment. If we see this again we'll let you know.

jskeet commented 6 years ago

Sounds good to me, thanks - I completely appreciate that reproducing it now you've got an alternative isn't a priority :)