Created attachment 11910 [details]
c sharp file and dll reference to be compiled
I created a simple C# library that will login a user into Active Directory and check if user is a member of a specific group.
Running this application with mono on Linux Ubuntu 14.04 usually works fine for the first time, but after running it multiple times I receive:
System.ObjectDisposedException: The object was used after being disposed.
at System.Net.Sockets.NetworkStream.CheckDisposed () [0x00000] in <filename unknown>:0
at System.Net.Sockets.NetworkStream.Read (System.Byte buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at System.IO.Stream.ReadByte () [0x00000] in <filename unknown>:0
at Novell.Directory.Ldap.Asn1.Asn1Identifier..ctor (System.IO.Stream in_Renamed) [0x00000] in <filename unknown>:0
at Novell.Directory.Ldap.Connection+ReaderThread.Run () [0x00000] in <filename unknown>:0
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
Original Exception: at System.Net.Sockets.NetworkStream.CheckDisposed () <IL 0x0001d, 0x00047>
at System.Net.Sockets.NetworkStream.Read (byte,int,int) <IL 0x00001, 0x00037>
at System.IO.Stream.ReadByte () <0x0003d>
at Novell.Directory.Ldap.Asn1.Asn1Identifier..ctor (System.IO.Stream) <IL 0x00007, 0x00023>
at Novell.Directory.Ldap.Connection/ReaderThread.Run () <IL 0x0003c, 0x0019b>
at System.Threading.Thread.StartInternal () <0x000c2>
Running this application with mono on Windows7 works as expected.
Steps to Reproduce:
1) Unpack attached compressed file, open Program.cs, search for TODO and update fields with your own information e.g. LDAP server address, username, password.
2) Compile using: csc.exe Program.cs /r:System.DirectoryServices.AccountManagement.dll
3) Run Program.exe on Ubuntu 14.04
Actual Results: Application may work as expected for the first few times, but after running for multiple times exception described above is thrown.
Expected Results: Application should not be crashing even after running for multiple times
Build Date & Platform: 07/07/2014 Windows7 x64
Additional Builds and Platforms:
Only occurs in Linux
From my understanding it looks like something in Novell.Directory.Ldap namespace is not getting properly disposed on application exit.
did you ever get any further information about this error? I currently struggle with a closed source mono-software, which give exactly this error maybe every 50th ldap-connect.
Please use https://www.nuget.org/packages/Novell.Directory.Ldap.NETStandard/ package which is the more actual version