Is LockDocument necessary since your using a transaction?
Further to my original simple response to this query ;
The primary keyword for further searches is 'Application Context'
Code that runs from the Menu, Toolbars, Palettes, and Modeless Forms runs in what is termed application context where the application is NOT aware of which document the code is meant to interact with, unlike commands originating from the command line which will be operating in 'Document Context'.
To make AutoCAD aware of the document the code intends to interact with the calling code should 'lock' the document so it can be targeted by the code instruction.
this is done by using the LockDocument method of the targeted document
IE
using (doc.LockDocument())
{
// do the mojo here
// <..>
} // the using mechanism unlocks the document.
Regards
Kerry