public static void VsTextViewCreated(IVsTextView textViewAdapter, IWpfTextView textView) { var buffer = textView.TextBuffer; if (Buffers.ContainsKey(buffer)) { ++Buffers[buffer]; } else { Collectors.AddProperty(buffer, textView.ObtainOrAttachProperty(() => new SymbolCollector(textView))); Buffers[buffer] = 1; } WpfToVs[textView] = textViewAdapter; WpfToBuffer[textView] = buffer; textView.Closed += ViewClosed; }