Select to view content in your preferred language

Npgsql does not work with add-ins

3065
11
10-03-2022 03:33 AM
Vidar
by
Frequent Contributor

I have added to my add-in a nuget package for Npgsql.

I am working with Pro 2.6.2

The latest verison i.e. 

NuGet\Install-Package Npgsql -Version 6.0.7

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.

 

Can you please look into this.

It may have something to do with this error - that it can't find the correct version assembly for System.Runtime.CompilerServices.Unsafe, I believe the one installed by default is version 6: 

 

 

 

System.AggregateException
  HResult=0x80131500
  Message=A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
  Source=mscorlib
  StackTrace:
   at System.Threading.Tasks.TaskExceptionHolder.Finalize()

Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

 

 

 

As an update to this - it just looks like it doesn't work with ESRI add-in projects. I tried many different versions of Npgsql and all failed. Here are the results for the various versions:

  • Version Npgsql 2.0.11 - "The authentication or decryption has failed."
  • Version Npgsql 3.2.7 - "Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified."
  • Version Npgsql 4.1.9 - "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
  • Version Npgsql 4.1.8 - "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
  • Version Npgsql 5.0 - "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."
  • Version Npgsql 5.0.5 - "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."
  • Version Npgsql 5.0.2 - "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."
  • Version Npgsql 6.06 - "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
  • Version Npgsql 6.03 - "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
Tags (1)
0 Kudos
11 Replies
CharlesMacleod
Esri Regular Contributor

I did a google on "Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.1.0.0". Quite a bit of chatter about getting the version right, etc,etc.

Leads me to wonder if u have the correct version of the System.Threading.Tasks.Extensions and  System.Runtime.CompilerServices.Unsafe Nugets installed in addition? 

0 Kudos
Vidar
by
Frequent Contributor

If only it were that simple - you just end up screwing up the whole project.  There is some dependency conflict going on here - and I've spent far too long trying to find out what's going on here.

0 Kudos