TransactionManager.StartTransaction() throws NullReferenceException
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Inside of DB.Object_Modified event handler I'm examining the modified object. Sometimes I need to retrieve another object based on an ObjectId, thus I use transaction. 90% of times it works but sometimes TransactionManager.StartTransaction() method throws a NullReferenceExeption internally (stack trace below). Any idea how could I prevent this from happening (is there any property of DBObject, Document or anything else I could use to check if I can safely start a transaction?
System.NullReferenceException: Object reference not set to an instance of an object.
at Autodesk.AutoCAD.Runtime.Interop.CheckNull(IntPtr returnValue)
at Autodesk.AutoCAD.ApplicationServices.TransactionManager.StartTransaction()
Eventually I could use a try-catch block but I'm looking for a more efficient way.