Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
@Jeff_M hello!
I am reviewing this post because I am in the same scenario in my new app.
I use both events: DocumentActivated & DocumentToBeDeactivated.
I have a break point in both events, so when I change the current document, it seems that "DocumentToBeDeactivated" is fired before, but if I have a transaction in that event, I get the exception = NullReferenceException,
using (Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
The parameter WorkingDataBase = Null.
So, it just happens this for Civil Documents? not in AutoCAD documents?
I don´t know how to solve this.
Have you tried using the Document's database instead?
static void DocumentManager_DocumentToBeDeactivated(object sender, DocumentCollectionEventArgs e) { using (Transaction trans = e.Document.Database.TransactionManager.StartTransaction()) { ;;your code } }