[CSHARP-1572] Assembly Binding from 1.9.2.235 to 2.2.3.3 Created: 17/Feb/16  Updated: 05/Apr/19  Resolved: 17/Feb/16

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: 2.2.3
Fix Version/s: None

Type: Task Priority: Critical - P2
Reporter: Aleksander [X] Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

Hey there.
We've recently updated mongo from 1.9.X to 2.2.X and we have runtime binding issues.

Assemblies build with 1.9.X wont work with 2.2.X redirection (looks like the old one is strongly signed and new its not).

The error is usual:
Could not load file or assembly 'MongoDB.Bson, Version=1.9.2.235, Culture=neutral, PublicKeyToken=f686731cfb9cc103' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Our web.config binding:
<dependentAssembly>
<assemblyIdentity name="MongoDB.Driver" publicKeyToken="f686731cfb9cc103" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.3.3" newVersion="2.2.3.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MongoDB.Bson" publicKeyToken="f686731cfb9cc103" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.3.3" newVersion="2.2.3.3" />
</dependentAssembly>

Any helper appreciated.
Thanks



 Comments   
Comment by Craig Wilson [ 17/Feb/16 ]

You can try, but I'm confident that dropping these libraries in will not work.

Comment by Aleksander [X] [ 17/Feb/16 ]

I see.
No... no GAC we drop new assemblies in the new package folder so I guess that I will have to release all DLL's build with new driver and distribute them forcing clients to update.
No chance that some of them build with 1.9.X can work with others build with 2.X+ as they finish up is same /bin folder.

Comment by Craig Wilson [ 17/Feb/16 ]

So, are you adding these assemblies to the GAC? Otherwise, you are just replacing the libraries in the folder.

This is a major upgrade. We mostly kept compile-time compatibility with the old API, but I think there is about a 0 percent chance that dropping in a new dll will work with an application that wasn't compiled with the new version. As I'm not familiar with what you are doing or how your product is distributed, I can't suggest anything that might make sense other than to rebuild and redistribute your "assemblies built with 1.9.X".

Comment by Aleksander [X] [ 17/Feb/16 ]

Ouch
Thanks for reply Craig.

I have already distributed assemblies built with 1.9.X and now we distribute DLL's with new version that finish up in same web apps.
Do you have any idea how to deal with this issue without breaking my clients not rolling back new packages to old Mongo Driver?

Thanks again.

Comment by Craig Wilson [ 17/Feb/16 ]

Hi Aleksander,

We do not sign the 2.x series of the driver. I suggest you look at this to strong name the assemblies.

In addition, I'll be surprised if this works. The functionality that used to be present in MongoDB.Driver is now located in MongoDB.Driver.Legacy. I'd suggest you not do any binding redirects and recompile any existing libraries with the new binaries.

Craig

Generated at Wed Feb 07 21:40:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.