How to set binding redirects?

261
2
09-16-2021 08:18 AM
mcamp1
by
New Contributor II

I am using npgsql with my add-in, but I ran into a bug that is preventing me from upgrading past version 4.0.11 (the latest npgsql version is 5.0.10). The suggested workaround is to use assembly binding redirects in the app.config, but the ArcGIS add-in does not seem to use app.config file.


Is there a way to configure the add-in to use the app.config file?
If not, is there another way to set binding redirects?

Thanks!

0 Kudos
2 Replies
mcamp1
by
New Contributor II

I wrote out some steps to reproduce the problem. Any help would be appreciated!
1. Open Visual Studio and create a new ArcGIS Pro Module Add-in
2. Run ‘Install-Package Npgsql’ in the Package Manager Console.
3. Run ‘Update-Package’ in the Package Manager Console.
4. Initialize a new NpgsqlConnection:

var conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;");

 

Error:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Threading.Channels, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'

0 Kudos
Vidar
by
Occasional Contributor II

Hi,

 

I have had the same problem - when I get to the code that starts to try  to connect to my DB, I get thrown the error: Exception thrown: 'System.IO.FileNotFoundException' in Npgsql.dll.

 

When I install an old version of npgsql - then it works. Esri need to fix this to work with the latest versions of npgsql.

0 Kudos