So far this never has been an issue, and I never paid much attention to it. The Trimble sample macros also show it in mixed order.
I'm currently running 2025.10 and ran into an issue with one of my older macros that explodes text into linework, potentially creating thousands of linestrings and deleting thousands of texts.
If I use it in the following order, it nearly always locks up on executing the second line, sometimes it finishes quickly as well.
UIEvents.RaiseAfterDataProcessing(self, UIEventArgs())
self.currentProject.TransactionManager.AddEndMark(CommandGranularity.Command)
I let it be and maybe 10 minutes later it finally finished, whereas it finishes always nearly immediately when executed in reversed order.
And in addition, what should be the order at the beginning of the macro then.
self.currentProject.TransactionManager.AddBeginMark(CommandGranularity.Command, self.Caption)
UIEvents.RaiseBeforeDataProcessing(self, UIEventArgs())
or
UIEvents.RaiseBeforeDataProcessing(self, UIEventArgs())
self.currentProject.TransactionManager.AddBeginMark(CommandGranularity.Command, self.Caption)
------------------------------
Ronny Schneider
------------------------------