diff --git a/src/Cody.VisualStudio/Services/DocumentsSyncService.cs b/src/Cody.VisualStudio/Services/DocumentsSyncService.cs index bea346c..9bc5d12 100644 --- a/src/Cody.VisualStudio/Services/DocumentsSyncService.cs +++ b/src/Cody.VisualStudio/Services/DocumentsSyncService.cs @@ -10,6 +10,7 @@ using Microsoft.VisualStudio.TextManager.Interop; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; @@ -52,6 +53,7 @@ public void Initialize() try { uint activeCookie = 0; + AssertThatNoOpenedDocuments(); foreach (var frame in GetOpenDocuments()) { if (frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocCookie, out object cookie) != VSConstants.S_OK) continue; @@ -83,6 +85,12 @@ public void Initialize() }); } + private void AssertThatNoOpenedDocuments() + { + Debug.Assert(openNotificationSend.Count == 0, $"{nameof(openNotificationSend)} is {openNotificationSend}, but it should be ZERO!"); + Debug.Assert(isSubscribed.Count == 0, $"{nameof(isSubscribed)} is {isSubscribed}, but it should be ZERO!"); + } + private IVsTextView GetVsTextView(IVsWindowFrame windowFrame) { windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out var pvar);