Shape.UniqueID(visGetOrMakeGUIDWithUndo) making Undo/Redo unreliable

Started by Visisthebest, August 11, 2021, 09:42:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

While debugging a Visio VSTO add-in, I stumbled on to the following issue.

I don't know what Visio is doing internally when I use Shape.UniqueID(visGetOrMakeGUIDWithUndo), but clearly understanding this better is needed.

When defining Undo scopes, Visio Undo/Redo executes exactly as expected when I use Shape.UniqueID(visGetOrMakeGUID) within the Undo scope to add a GUID to a new shape on the page.

But when I change it to: Shape.UniqueID(visGetOrMakeGUIDWithUndo), Undo/Redo starts executing unreliably and I even get 'ghost shapes', meaning a Redo suddenly creates two shapes even though the original transaction created only one.

Obviously I need a better understanding of what happens when Shape.UniqueID(visGetOrMakeGUIDWithUndo) is used, hopefully someone has more insight into this. Thank you!
Visio 2021 Professional

Visisthebest

Please disregard this post for now, this issue is likely this behavior is related to other factors (as well).
Visio 2021 Professional