private void EnsureReShaprerVersion(Type type)
        {
            if (_reSharperVersion.HasValue)
            {
                Contract.Requires(_reSharperEditTagDetector != null);
                return;
            }

            SetReSharperVersion(ResharperVersionUtility.DetectFromAssembly(type.Assembly));
        }
        /// <summary>
        /// The various JetBrains products reuse at a code base level certain constructs
        /// such as ITagger<T> implementations.  For example both R# and dotTrace and
        /// dotCover use the VsDocumentMarkerTaggerProvider.  If multiple products are
        /// installed then MEF composition will return them in a non-deterministic
        /// order.  They all have the same fully qualified name.  The only way to
        /// distinguish them is to look at the assembly name containing the type
        /// </summary>
        private bool TryGetSpecificTagger(ITextBuffer textBuffer, out bool sawName, out ITagger <ITag> tagger)
        {
            sawName = false;
            tagger  = null;

            foreach (var pair in TaggerProviders)
            {
                var provider     = pair.Value;
                var providerType = provider.GetType();

                // First step is to check the name of the tagger.  The ReSharper taggers we care
                // about all have the same name
                if (providerType.Name == ResharperTaggerProviderName)
                {
                    // Next we need to make sure this is actually a ReSharper tagger.  Both dotCover
                    // and ReSharper use the same tagger name.  The only way to differentiate them is
                    // to look at the assembly version
                    var version = ResharperVersionUtility.DetectFromAssembly(providerType.Assembly);
                    if (version != ReSharperVersion.Unknown)
                    {
                        SetReSharperVersion(version);
                        var taggerResult = provider.SafeCreateTagger <ITag>(textBuffer);
                        if (taggerResult.IsSuccess)
                        {
                            tagger = taggerResult.Value;
                            return(true);
                        }
                    }
                    else
                    {
                        sawName = true;
                    }
                }
            }

            return(false);
        }