title: Log undo/redo actions in Visual Studio extension
body: <p>I have written a Visual Studio extension and I have it keep a log of user actions related to my extension. I want to be able to include undo/redo information for changes that my tool makes in the log, which I expect to be able to do by having an event listener called when an undo/redo occurs and check if the undo/redo object is the one corresponding to an action that my tool generated.</p>
  
  <p>Currently, I have code to get the <code>ITextUndoHistory</code> for the current <code>IWpfTextView</code>, which I get using an <code>ITextUndoHistoryRegistry</code> which I followed <a href="https://stackoverflow.com/q/2940745">this answer</a> to generate. Unfortunately, the <code>ITextUndoHistory</code> object I get does not implement enough of the functionality to be useful. Specifically, its <code>UndoRedoHappened</code> event gets called, but always has a transaction of <code>null</code>. Also, its <code>UndoStack</code>/<code>RedoStack</code> properties throw <code>System.NotSupportedException</code>. The only thing that does work is <code>CreateTransaction</code> does give me a transaction object and lets me set the name for the action displayed in Visual Studio's undo/redo list, although I don't need that to work.</p>
  
  <p>Is there some other way to access undo information in Visual Studio? Or maybe some more creative hack with what I have access to?</p>