[Mono-list] Npgsql doesn't work anymore

Jaroslaw Kowalski jaak@zd.com.pl
Fri, 19 Mar 2004 08:30:17 +0100


I'm using Fedora Core 1 with "postgresql-server-7.3.4-11" installed from RPM
and Npgsql (from Mono/CVS) doesn't work for me (while it used to work
properly about one month ago).

I get "System.NullReferenceException : Object reference not set to an
instance of an object" when connecting. The problem seems to occur in
NpgsqlConnection.ProcessServerVersion().

I've made the following patch to this function.

Index: NpgsqlConnection.cs
===================================================================
RCS file: /mono/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs,v
retrieving revision 1.16
diff -u -r1.16 NpgsqlConnection.cs
--- NpgsqlConnection.cs 13 Mar 2004 14:15:23 -0000      1.16
+++ NpgsqlConnection.cs 19 Mar 2004 08:29:04 -0000
@@ -633,6 +633,11 @@
             NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME,
"ProcessServerVersion");
             // FIXME: Do a better parsing of server version to avoid
             // hardcode version numbers.
+                       //
+                       if (_serverVersion == null)
+                       {
+                               Console.WriteLine("_serverVersion is null");
+                       }

             if (BackendProtocolVersion == ProtocolVersion.Version2)
             {


and it prints "_serverVersion is null". It obviously fails on
_serverVersion.IndexOf() right after that.

My ConnectionString is:

'Server=fw.home.lan;Initial Catalog=SoodaUnitTests;User
Id=mono;Password=mono'

I can provide more debug info but I don't know what exactly is needed here.
Any ideas?

Jarek