public SccDocumentLock(OpenDocumentTracker tracker, HybridCollection<string> locked, HybridCollection<string> ignoring, HybridCollection<string> readOnly) { if (tracker == null) throw new ArgumentNullException("tracker"); else if (locked == null) throw new ArgumentNullException("locked"); else if (ignoring == null) throw new ArgumentNullException("ignoring"); else if (readOnly == null) throw new ArgumentNullException("readOnly"); _tracker = tracker; _locked = locked; _ignoring = ignoring; _readonly = readOnly; _fsIgnored = new HybridCollection<string>(StringComparer.OrdinalIgnoreCase); _changedPaths = new HybridCollection<string>(StringComparer.OrdinalIgnoreCase); _monitor = new Dictionary<uint, string>(); _altMonitor = new Dictionary<string, FileInfo>(); _change = tracker.GetService<IVsFileChangeEx>(typeof(SVsFileChangeEx)); foreach (string file in locked) { // This files auto reload could not be suspended by calling Ignore on the document // We must therefore stop posting messages to it by stopping it in the change monitor // But to be able to tell if there are changes.. We keep some stats ourselves if (!ignoring.Contains(file) && ErrorHandler.Succeeded(_change.IgnoreFile(0, file, 1))) { _fsIgnored.Add(file); FileInfo info = new FileInfo(file); info.Refresh(); if (info.Exists) { GC.KeepAlive(info.LastWriteTime); GC.KeepAlive(info.CreationTime); GC.KeepAlive(info.Length); } _altMonitor.Add(file, info); } } }