I've got a plug in that works through a large selection of MEP MultiViewParts, a few thousand. Data is taken from each part and added to a DataTable which I use to create reports (Bill of Materials and others). Everything works great until you run the program multiple times. It varies but around the fourth or fifth time I get an EMaxReaders exception. I can Audit the drawing and everything starts working again. I've checked to make sure I'm not leaving anything open and in this case everything is opened using a transaction so I'm assuming AutoCAD is closing everything. Any ideas?
Sounds like the transaction isn't being disposed...
example
Try
t = db.TransactionManager.StartTransaction
do something
save
t.Dispose()
All my transactions are contained within using statements, so they are automatically disposed.
Something is not allowing the transaction to dispose, if the appilication is consitently craching as 4-5 drawing the cache is max'n out. Kean has a posting the discusses reclaiming memory, you may want look into this.
Reclaiming memory from erased AutoCAD entities using .NET
or try
open the file
do something
close the trasaction(commit)
save the file
dispose
On another note: I have experience these types of errors in the past and have moved away from "using" as when your applications run into unstable files your applicationcan handles the error without hang'n AutoCAD(most of the time).