This project has moved and is read-only. For the latest updates, please go here.

Cannot access a disposed object.

Sep 23, 2016 at 4:30 PM
Edited Sep 23, 2016 at 10:20 PM
Hi all

I'm using PersistentDisctionary(String, string)
And sometimes getting the following error:
Error: Cannot access a disposed object.
Object name: 'PersistentDictionary'. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'PersistentDictionary'.
at Microsoft.Isam.Esent.Collections.Generic.PersistentDictionary2.CheckObjectDisposed() in c:\codeplex\EsentCollections\PersistentDictionary.cs:line 1314
at Microsoft.Isam.Esent.Collections.Generic.PersistentDictionary
2.ReturnReadLockedOperation[TReturn](Func1 action) in c:\codeplex\EsentCollections\PersistentDictionary.cs:line 1007
at Microsoft.Isam.Esent.Collections.Generic.PersistentDictionary
2.get_Count() in c:\codeplex\EsentCollections\PersistentDictionary.cs:line 337
at ..?()
--- End of inner exception stack trace ---
The app uses PersistentDictionary as a cache for processing input files, each input file processed creates a new PersistentDisctionary and cleans it at the end of each file, and the folder is deleted.
Sometimes after creating and closing several PersistenDcitionaries the error happens, and because we retry the file when an exception occurs the next time it runs it works correctly.

FYI: the only weird thing I can thought is that we have a DLL that calls manually the GarbageCollector, I don't know if this may affect PersistentDictionary in some way.

Any thoughts ??