Our addin cannot load `Newtonsoft.Json.dll` due to error in Inventor's app.config
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Inventor dev community,
we are having a problem with an Inventor addin we are developing using the .NET Inventor API.
Our addin tries to load `Newtonsoft.Json.dll` version 6, which we ship together with our addin.
However, Inventor ships its own (newer) version of this DLL in its application folder:
C:\Program Files\Autodesk\Inventor 2022\Bin\Newtonsoft.Json.dll
Inventor also defines a .NET `bindingRedirect` to this newer DLL version in its `app.config` file:
C:\Program Files\Autodesk\Inventor 2022\Bin\Inventor.exe.config
This is all fine, except that in certain Inventor versions, the `app.config` points its `bindingRedirect` to a different DLL version than the DLL that Inventor actually provides:
Inventor 2022: `bindingRedirect` to DLL version 10, and ships DLL version 10 --> OK.
Inventor 2022.3.1: `bindingRedirect` to DLL version 10, but ships DLL version 12 --> ERROR!
Inventor 2022.4: `bindingRedirect` to DLL version 10, but ships DLL version 12 --> ERROR!
Inventor 2022.5: `bindingRedirect` to DLL version 10, but ships DLL version 12 --> ERROR!
Inventor 2023: `bindingRedirect` to DLL version 12, and ships DLL version 12 --> OK.
What happens in the Inventor versions with the mismatch, is that .NET sees the `bindingRedirect`, and therefore flat-out refuses to load our addin's version 6 of the DLL, and instead goes looking for a version 10 - but then can't find this version anywhere. So we get a `FileNotFoundException`, and our addin becomes non-functional.
Is there any possible valid reason for some Inventor versions have this DLL version mismatch?
It seems like a bug to me, like the Inventor devs updated the DLL but forgot to update their `app.config` accordingly.
Our addin can't be the only code affected by this, right? There must be a reason why Inventor ships its own copy of this DLL - some AutoDesk functionality or addin must need it (no idea what though), and that functionality would also be broken by this mismatch in the same way that our addin is.
How should we procede?