[Mono-list] OpenLDAP with mono

Amish Munshi lists@munshi.biz
Wed, 1 Dec 2004 13:47:14 +0530


Greetings,

I am using mono 1.0.4 on Novell Linux desktop, using the article available at 

http://www.novell.com/coolsolutions/cooldev/features/
a_net_cplus_ldap_library_cdev.html

I am trying to connect to OpenLDAP using the following code

using Novell.Directory.Ldap;
using System;
namespace Munshi.Amish.LDAP
{
	class amish
	{
		static void Main()
		{
			try {
			LdapConnection ldapConn = new LdapConnection();
			ldapConn.Connect("localhost",389);
			ldapConn.Bind("cn=Manager,ou=my-domain,o=com","secret");
			}
			catch(Exception e)
			{
				Console.WriteLine("Error : " + e.ToString());
			}
		}
	}
}

I get the following error and the program does not exit.

Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
in <0x00078> System.String:FormatHelper 
(System.Text.StringBuilder,System.IFormatProvider,string,object[])
in <0x0003d> System.String:Format (System.IFormatProvider,string,object[])
in <0x00175> Novell.Directory.Ldap.Utilclass.ResourcesHandler:getMessage 
(string,object[],System.Globalization.CultureInfo)
in <0x00013> Novell.Directory.Ldap.Utilclass.ResourcesHandler:getMessage 
(string,object[])
in <0x000bf> Novell.Directory.Ldap.LdapException:getExceptionString (string)
in <0x00013> Novell.Directory.Ldap.LdapException:ToString ()
in <0x00075> Munshi.Amish.LDAP.amish:Main ()



If I use anonymous bind 
                        ldapConn.Bind(null,null);
then the program just freezes and does not exit.

I tried this on mono 1.0.2 on SuSE 9.2 and the effect the same. What could be 
wrong?


Amish.