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.

Dynamically loading assembly referencing Google.Cloud.Spanner.Data assembly results in binding redirect errors

See original GitHub issue

Environment details

  • OS: Windows 8.1/10
  • .NET version: 4.5.2
  • Package name and version: Google.Cloud.Spanner.Data v2.0.0 (beta8)

Steps to reproduce

  1. Create an assembly which references Google.Cloud.Spanner.Data v2.0.0 package from NuGet and opens a connection
  2. Dynamically load this assembly from a folder. This folder contains all assemblies (indirectly) referenced by Google.Cloud.Spanner.Data. The folder is added to the probing path of the application loading the assembly. (the application is a winforms application)

When doing so, you’ll get various binding redirect errors and you have to add binding redirects to your application’s app.config file.

This is inconvenient and IMHO also unnecessary: the nuget package for Google.Cloud.Spanner.Data v2.0.0 references other nuget packages which result in having assemblies on disk with higher version numbers for some assemblies than what they directly reference. This requires binding redirects to be applied. For a project that directly references Google.Cloud.Spanner.Data, you could add a AutoGenerateBindingRedirects element to the csproj, but for a dynamically loaded assembly this isn’t going to work.

Will this be corrected in GA/RTM? If so, then ignore my report. If not, could it be made so that the assemblies on disk reference the assemblies that are also on disk so no binding redirects are required?

TIA 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jskeetcommented, Mar 18, 2019

I suspect the Google.Protobuf “issue” is because we depend (indirectly) on Google.Api.CommonProtos, which depends on Google.Protobuf 3.6.1, but we also depend (indirectly) on Grpc.Gcp depends on Google.Protobuf 3.6.0.

I don’t know what depends on System.Interactive.Async 3.1.0, but I can see that Google.Api.Gax depends on 3.2.0.

I don’t get to rerelease every dependency to make sure that everything in the entire tree lines up. In this case I “control” some of the packages, but not all of them - I’m not responsible for Grpc.Gcp, for example. Yes, I could get in touch with the people who release that, but if they update to 3.6.1 then it would be causing exactly the same problem for a different library which was using 3.6.0.

Even if I could do that, it’s very unlikely that Spanner would be used entirely on its own - if it’s in an ASP.NET Core app for example, that almost guarantees that the version of Newtonsoft.Json that ends up on disk is a later one than the earliest one referenced in the tree.

Basically, this is a bigger problem than any one package can solve - it’s a platform issue. (And note that for the most part this is within a particular major version. We have a much bigger issue in terms of dependencies across major versions.)

I’m going to close this now as effectively infeasible. I’m sorry I don’t have a happier answer for you 😦

0reactions
FransBoumacommented, Mar 18, 2019

It’s ok 😃 At least assembly redirects are possible and they solve it. I understand why it’s not really solvable now and that’s enough. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Assembly binding redirect does not work
I encountered assembly binding redirect not working, because of a missing namespace on the assemblyBinding element. Correct
Read more >
Troubleshoot Cloud Functions
If you attempt to invoke a function that does not exist, Cloud Functions responds with an HTTP/2 302 redirect which takes you to...
Read more >
Python client library | Google Cloud
Fully managed database for MySQL, PostgreSQL, and SQL Server. ... Serverless, minimal downtime migrations to the cloud. ... Infrastructure to run specialized Oracle ......
Read more >
Troubleshooting Assembly Binding Issues in .NET - fuqua.io
As a first step, ensure that all projects in your solution reference the same version of the problematic DLL or NuGet package. This...
Read more >
Untitled
Eminds learning, Reference guide for word 2010, Ping g30 hybrid price, Riyadhoh khodam ayat ... Odontologija studijos forumas, Disprin dosage instructions, ...
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