未验证 提交 0aa95756 编写于 作者: G Gen Lu 提交者: GitHub

Merge pull request #32684 from genlu/fix443515

Handled exception from a COM call to `IOleUndoManager`
......@@ -218,18 +218,22 @@ private IOleUndoManager GetUndoManager(ITextBuffer subjectBuffer)
private IEnumerable<IOleUndoUnit> GetUndoUnits(IOleUndoManager undoManager)
{
// Unfortunately, EnumUndoable returns the units in oldest-first order.
undoManager.EnumUndoable(out var undoUnitEnumerator);
if (undoUnitEnumerator == null)
IEnumOleUndoUnits undoUnitEnumerator;
try
{
// Unfortunately, EnumUndoable returns the units in oldest-first order.
undoManager.EnumUndoable(out undoUnitEnumerator);
}
catch (COMException)
{
yield break;
}
const int BatchSize = 100;
IOleUndoUnit[] fetchedUndoUnits = new IOleUndoUnit[BatchSize];
while (true)
{
IOleUndoUnit[] fetchedUndoUnits = new IOleUndoUnit[BatchSize];
undoUnitEnumerator.Next(BatchSize, fetchedUndoUnits, out var fetchedCount);
for (int i = 0; i < fetchedCount; i++)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册