- Home /
PostgreSQL bugs
Hi
I'm using PostgreSQL in my project, so referenced Npgsql.dll, A .net wrapper for pgsql. What's more, I wrote a helper class, and it works fine under Visual Studio.
Then, in my code(Unity)
PostgresHelper pg = new PostgresHelper();
pg.conn.Open();
pg.conn.Close();
Verything is happy, Until, In my Helper Class
public void InsideCall() {
this.conn.Open();
this.conn.Close();
}
And Call it in Unity c# script
PostgresHelper pg = new PostgresHelper();
pg.InsideCall();
Then, Unity Crashed... I have no idea what's the difference and why it crashed(really weird). Sometimes Unity may not crash, showing me a error message like "Npgsql timeout" instead Can anyone help? Thanks!
p.s Unity 3.5.5f3
Helper Class is simple and looks like below
public class PostgresHelper { //Expose a prop public NpgsqlConnection conn = new NpgsqlConnection();
//Creator
public PostgresHelper()
{
string connectString = String.Format("Server={0};Port={1};" +
"User Id={2};Password={3};Database={4};",
D_SERVER, D_PORT, D_USER,
D_PASS, D_DATABASE);
conn = new NpgsqlConnection(connectString);
}
//This Call will cause Unity CRASH,but Conn.open()/Close() is fine
public void InsideCall() {
this.conn.Open();
this.conn.Close();
}
}
By the way, Npgsql timeout default is 15sec, and i'm quite sure Unity crashed within 2sec
Your answer
Follow this Question
Related Questions
Are coroutines freezing my game? 0 Answers
Unity freezes up completely without explanation 1 Answer
Unable to open existing project after crash 0 Answers
Stop Editor From Crashing 1 Answer