Npgsql dll working in Standalone Build but not in Editor

Hello. I’m currently using an Npgsql.dll which I have placed in my Plugins folder. I’m using it in two different projects.
Both my projects work fine when built. The dll does its job and allows me to change my PostgreSQL database . The problem lies when I try to run the same scenes in the Editor.

For the first project, I get a MissingMethodException : Method not found : 'NpgsqlParameterCollection.AddWithValue . The weird thing is that a few lines before, sever methods from the Npgsql library have been called and they never produced an error.

For the second project, I got the same error if I use the same method. The game completely crashes though when I’m trying to read from the database.

As you can see, the problem is probably caused by the Editor being unable to access parts of the library.
For anyone wondering, the import settings for the dll are at default to all platforms and it’s targeting .NET 3.5. If you have any ideas on why this is caused, I’d greatly appreciate it since it’s quite nerve-wracking not being able to easily check a debug.

Hello Xontros,
I had the same problem as yours. I Tried almost everything to figure out what caused the issue.
At the end, I found a solution but I don’t know why it works (maybe someone can tell us).
To fix the problem let’s take the Npgsql.dll and put it into the Asset folder (so you have the file into \Asset\Npgsql.dll). In my case, I’ve copied even the System.Data.dll for another error (I’m trying to use Postgre DB on the Master Server Framework).
Now everything works fine in my case.

Let me know if the tip resolved your problem.

I’ve got a similar problem right now: Using npgsdql 2.2.3 and Unity 2017.3… When I build out a project in 32bit it runs (and also on a MAC oddly enough) but when I attempt to do anything with this DLL in the editor it causes the entire IDE to crash.

I’m assuming this is a 64bit vs 32bit thing but I don’t see how since this is built in C# which should be platform independent.

Anyone have any ideas of how to get this to run?

I currently had a same problem as Nicola-Patti describes that the application requires Npgsql.dll and System.Data.dll in /Asset, and I had to add dlls by drag-and-drop from my working version of UnityEditor.
For example I used 2018.2.16 and dlls were from C:\Program Files\Unity\Hub\Editor\2018.2.16f1\Editor\Data\Mono\lib\mono\2.0 .
When I added dlls by “Import new Asset”, or used Npgsql downloaded from web or System.Data from other similar version of Unity Editor accidentaly, more and more files were required and never worked well.
I hope it might help somebody else.