Part of this issue is that it doesn't happen consitently. In one case my code was re-building some block definitions (my program is a rule based drawing system), where I was calling the same function in a long running loop. It ran through most then threw the error (maybee halfway through a list of 200). So my assumption would be that if I was accessing a disposed object or objects in a closed transaction, it would happen the first time every time, correct? Plus, my couple users are using these functions to insert our products into drawings, so they are hitting this code all day long, and very rarely getting the error (two occurences this week, and the one happend to me while testing). So I'm at a loss of what to look for.
I agree its probably not a missed dispose, in my experiences where I know I've forgotten to dispose of an object, AutoCAD usually just crashes and exists with no .NET exceptions.
It hasnt' happened alot but the few stack traces I have don't show anything in common. I've include a the tops of a few of the stack traces below, in case they might spark some insight (I only included the AutoCAD portions).
at Autodesk.AutoCAD.ApplicationServices.TransactionManager.FlushGraphics()
at Autodesk.AutoCAD.ApplicationServices.AppTransaction.Commit()
------------------------------------------------------------------------------------------------------------
at AcDbSpline.{ctor}(AcDbSpline* , Int32 , Int32 , Int32 , Int32 , AcArray<AcGePoint3d\,AcArrayMemCopyReallocator<AcGePoint3d> >* , AcArray<double\,AcArrayMemCopyReallocator<double> >* , AcArray<double\,AcArrayMemCopyReallocator<double> >* , Double , Double )
at Autodesk.AutoCAD.DatabaseServices.Spline..ctor(Int32 degree, Boolean rational, Boolean closed, Boolean periodic, Point3dCollection controlPoints, DoubleCollection knots, DoubleCollection weights, Double controlPointTolerance, Double knotTolerance)
------------------------------------------------------------------------------------------------------------
at Autodesk.AutoCAD.DatabaseServices.Transaction.DeleteUnmanagedObject()
at Autodesk.AutoCAD.Runtime.DisposableWrapper.!DisposableWrapper()
at Autodesk.AutoCAD.Runtime.DisposableWrapper.Dispose(Boolean )
at Autodesk.AutoCAD.Runtime.DisposableWrapper.Dispose()
------------------------------------------------------------------------------------------------------------
at AcEdJig.drag(AcEdJig* )
at Autodesk.AutoCAD.EditorInput.Jig.DoIt()
at Autodesk.AutoCAD.EditorInput.Editor.Drag(Jig jig)