question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google.Cloud.Datastore.V1 reference to Google.Apis.Auth

See original GitHub issue

Hi! When I try to use DatastoreDb.Create(projectId); I get System.IO.FileLoadException with Google.Apis.Auth, Version=1.21.0.0. When I install 1.21.0, then the same problem appears, but with 1.41.1 version. When I update to 1.41.1, it wants 1.21.0 again. I use Google.Cloud.Datastore.V1 version 2.2.0, but I checked that after upgrading my apps from .net 4.5.2 to 4.7.2, the problem still exists in 3.0.0-beta1 of library. The assembly binding doesn’t help and I think I’ve tried installing every possible additional “Grpc” and “Apis”, but with no effect. Is there some workaround for this issue or should I wait for the finalization of the plan below to be able to use the library? https://googleapis.github.io/google-cloud-dotnet/docs/guides/gax-dependencies.html

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
jskeetcommented, Feb 25, 2020

I’ve just tried this with a minimal example myself:

  • .NET Framework class library targeting .NET 4.5.2
  • .NET Framework console application targeting .NET 4.5.2 and referencing the library
  • Library project has a package reference to Google.Cloud.Datastore.V1
  • Library project has a public static method that calls DatastoreDb.Create and then allocates an ID to prove that we can make an RPC
  • Console project calls that static method

It all worked fine. The console project has an autogenerated set of assembly binding redirects:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.41.1.0" newVersion="1.41.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Google.Apis.Auth.PlatformServices" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.41.1.0" newVersion="1.41.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Interestingly, when testing the zip file I’ve attached here, I did find it initially failed due to a lack of gRPC libraries - but that’s not the error you’ve got. That’s fixed by adding a direct dependency from the application (the console app in this case) to Grpc.Core version 1.22.1 (or 2.27.0 for the GAX v3 libraries). Unfortunately the “old style” .NET project system isn’t terribly good at transitive dependencies - I’d expect an “SDK-style” project to work better on that front. Please try this zip file though, and see whether that works for you - if it does, we’ll need to work out the difference between this project and your one that can’t load Google.Apis.Auth.

Issue4415.zip

0reactions
jskeetcommented, Feb 26, 2020

Thanks for confirming. I still don’t properly understand why I only needed to add the extra package to my console app after cleaning the project - things are a little mysterious in the old school world. (As a side-note, if you get the chance to upgrade to SDK-style projects, I’d strongly encourage that 😃 Glad it’s working for you now though!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google.Cloud.Datastore.V1
V1 is a.NET client library for the Google Cloud Datastore API. Note: This documentation is for version 4.5.0 of the library. Some samples...
Read more >
Package google.datastore.v1
Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted. Requires one of the following OAuth...
Read more >
Cloud Datastore API Client Library for .NET
Browse the .NET reference documentation for the Cloud Datastore API. · Read the Developer's guide for the Google API Client Library for .NET....
Read more >
Google Cloud Client Libraries for .NET
Available APIs. This repository contains code for the following client libraries. Each package name links to the documentation for that package. Package, Latest ......
Read more >
@google-cloud/datastore 4.1.0 » Home
Google Cloud Datastore Node.js Client API Reference ... Set up authentication with a service account so you can access the API from ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found