- Home /
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.
Answer by Nicola-Patti · Oct 12, 2017 at 01:48 PM
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.
Answer by Randy-Lee · Apr 16, 2018 at 08:41 PM
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?
just found another thing here: https://github.com/alvyxaz/barebones-masterserver/issues/143 that talks about this as a namespace problem.
I haven't built the application to see if it'll work there or not but it does work in the IDE now
Answer by kalavinka13 · Jul 16, 2019 at 02:40 AM
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.
Your answer
Follow this Question
Related Questions
MonoDevelop - Uncaught Exceptions 2 Answers
In 5.2.1f1 Editor freezes in play mode 3 Answers
Unity crashing after a few minutes 3 Answers
What does the log tell me about editor crash on play? 1 Answer
Baking Realtime GI for very large worlds is crashing 0 Answers