當前位置: 首頁>>代碼示例>>C#>>正文


C# Diagnostics.AnalyzerReference類代碼示例

本文整理匯總了C#中Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference的典型用法代碼示例。如果您正苦於以下問題:C# AnalyzerReference類的具體用法?C# AnalyzerReference怎麽用?C# AnalyzerReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnalyzerReference類屬於Microsoft.CodeAnalysis.Diagnostics命名空間,在下文中一共展示了AnalyzerReference類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AnalyzerItem

 public AnalyzerItem(AnalyzersFolderItem analyzersFolder, AnalyzerReference analyzerReference, IContextMenuController contextMenuController)
     : base(GetNameText(analyzerReference))
 {
     _analyzersFolder = analyzersFolder;
     _analyzerReference = analyzerReference;
     _contextMenuController = contextMenuController;
 }
開發者ID:ehsansajjad465,項目名稱:roslyn,代碼行數:7,代碼來源:AnalyzerItem.cs

示例2: CreateChecksum

        public Checksum CreateChecksum(AnalyzerReference reference, CancellationToken cancellationToken)
        {
            using (var stream = SerializableBytes.CreateWritableStream())
            using (var writer = new ObjectWriter(stream, cancellationToken: cancellationToken))
            {
                WriteTo(reference, writer, cancellationToken);

                stream.Position = 0;
                return Checksum.Create(stream);
            }
        }
開發者ID:natidea,項目名稱:roslyn,代碼行數:11,代碼來源:AbstractReferenceSerializationService.cs

示例3: GetNameText

 private static string GetNameText(AnalyzerReference analyzerReference)
 {
     if (analyzerReference.IsUnresolved)
     {
         return analyzerReference.FullPath;
     }
     else
     {
         return analyzerReference.Display;
     }
 }
開發者ID:ehsansajjad465,項目名稱:roslyn,代碼行數:11,代碼來源:AnalyzerItem.cs

示例4: CreateChecksum

        private static Checksum CreateChecksum(AnalyzerReference reference)
        {
            using (var stream = SerializableBytes.CreateWritableStream())
            using (var objectWriter = new StreamObjectWriter(stream))
            {
                objectWriter.WriteString(WellKnownSynchronizationKinds.AnalyzerReference);
                objectWriter.WriteString(reference.FullPath);

                return Checksum.Create(stream);
            }
        }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:11,代碼來源:CustomAsset.cs

示例5: SonarAnalyzerManager_HasNoCollidingAnalyzerReference_SameNameVersion

        public void SonarAnalyzerManager_HasNoCollidingAnalyzerReference_SameNameVersion()
        {
            IEnumerable<AnalyzerReference> references = new AnalyzerReference[]
            {
                new ConfigurableAnalyzerReference(
                    new AssemblyIdentity(SonarAnalyzerManager.AnalyzerName, SonarAnalyzerManager.AnalyzerVersion),
                    SonarAnalyzerManager.AnalyzerName)
            };

            Assert.IsFalse(
                SonarAnalyzerManager.HasConflictingAnalyzerReference(
                    SonarAnalyzerManager.GetProjectAnalyzerConflictStatus(references)),
                "Same named and versioned analyzers should not be reported as conflicting ones");
        }
開發者ID:SonarSource-VisualStudio,項目名稱:sonarlint-visualstudio,代碼行數:14,代碼來源:SonarAnalyzerManagerTests.cs

示例6: GetReference

        public AnalyzerReference GetReference()
        {
            if (_analyzerReference == null)
            {
                if (File.Exists(_fullPath))
                {
                    _analyzerReference = new AnalyzerFileReference(_fullPath, _loader);
                    ((AnalyzerFileReference)_analyzerReference).AnalyzerLoadFailed += OnAnalyzerLoadError;
                }
                else
                {
                    _analyzerReference = new UnresolvedAnalyzerReference(_fullPath);
                }
            }

            return _analyzerReference;
        }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:17,代碼來源:VisualStudioAnalyzer.cs

示例7: GetReference

        public AnalyzerReference GetReference()
        {
            if (_analyzerReference == null)
            {
                if (File.Exists(_fullPath))
                {
                    _analyzerReference = new AnalyzerFileReference(_fullPath, InMemoryAssemblyProvider.GetAssembly);
                    ((AnalyzerFileReference)_analyzerReference).AnalyzerLoadFailed += OnAnalyzerLoadError;
                }
                else
                {
                    _analyzerReference = new UnresolvedAnalyzerReference(_fullPath);
                }
            }

            return _analyzerReference;
        }
開發者ID:ehsansajjad465,項目名稱:roslyn,代碼行數:17,代碼來源:VisualStudioAnalyzer.cs

示例8: SonarAnalyzerManager_HasCollidingAnalyzerReference

        public void SonarAnalyzerManager_HasCollidingAnalyzerReference()
        {
            var version = new Version("0.1.2.3");
            Assert.AreNotEqual(SonarAnalyzerManager.AnalyzerVersion, version,
                "Test input should be different from the expected analyzer version");

            IEnumerable<AnalyzerReference> references = new AnalyzerReference[]
            {
                new ConfigurableAnalyzerReference(
                    new AssemblyIdentity(SonarAnalyzerManager.AnalyzerName, version),
                    SonarAnalyzerManager.AnalyzerName)
            };

            Assert.IsTrue(
                SonarAnalyzerManager.HasConflictingAnalyzerReference(
                    SonarAnalyzerManager.GetProjectAnalyzerConflictStatus(references)),
                "Conflicting analyzer package not found");
        }
開發者ID:SonarSource-VisualStudio,項目名稱:sonarlint-visualstudio,代碼行數:18,代碼來源:SonarAnalyzerManagerTests.cs

示例9: SonarAnalyzerManager_GetIsBoundWithoutAnalyzer_Unbound_Conflicting

        public void SonarAnalyzerManager_GetIsBoundWithoutAnalyzer_Unbound_Conflicting()
        {
            this.activeSolutionBoundTracker.IsActiveSolutionBound = false;

            var version = new Version("0.1.2.3");
            Assert.AreNotEqual(SonarAnalyzerManager.AnalyzerVersion, version,
                "Test input should be different from the expected analyzer version");

            IEnumerable<AnalyzerReference> references = new AnalyzerReference[]
            {
                new ConfigurableAnalyzerReference(
                    new AssemblyIdentity(SonarAnalyzerManager.AnalyzerName, version),
                    SonarAnalyzerManager.AnalyzerName)
            };

            Assert.IsFalse(
                this.testSubject.GetIsBoundWithoutAnalyzer(
                    SonarAnalyzerManager.GetProjectAnalyzerConflictStatus(references)),
                "Unbound solution should never return true");
        }
開發者ID:SonarSource-VisualStudio,項目名稱:sonarlint-visualstudio,代碼行數:20,代碼來源:SonarAnalyzerManagerTests.ForBound.cs

示例10: CheckAnalyzerReferenceIdentity

        private bool CheckAnalyzerReferenceIdentity(AnalyzerReference reference)
        {
            if (reference == null)
            {
                return false;
            }

            return !_hostAnalyzerReferencesMap.ContainsKey(reference.Id);
        }
開發者ID:hbarve1,項目名稱:roslyn,代碼行數:9,代碼來源:HostAnalyzerManager.cs

示例11: GetAnalyzerReferenceIdentity

 /// <summary>
 /// It returns a string that can be used as a way to de-duplicate <see cref="AnalyzerReference"/>s.
 /// </summary>
 public object GetAnalyzerReferenceIdentity(AnalyzerReference reference)
 {
     return reference.Id;
 }
開發者ID:hbarve1,項目名稱:roslyn,代碼行數:7,代碼來源:HostAnalyzerManager.cs

示例12: WriteUnresolvedAnalyzerReferenceTo

 private static void WriteUnresolvedAnalyzerReferenceTo(AnalyzerReference reference, ObjectWriter writer)
 {
     writer.WriteString(nameof(UnresolvedAnalyzerReference));
     writer.WriteString(reference.FullPath);
 }
開發者ID:genlu,項目名稱:roslyn,代碼行數:5,代碼來源:AbstractReferenceSerializationService.cs

示例13: ApplyAnalyzerReferenceRemoved

 protected override void ApplyAnalyzerReferenceRemoved(ProjectId projectId, AnalyzerReference analyzerReference)
 {
     Debug.Assert(_applyChangesProjectFile != null);
     _applyChangesProjectFile.RemoveAnalyzerReference(analyzerReference);
     this.OnAnalyzerReferenceRemoved(projectId, analyzerReference);
 }
開發者ID:furesoft,項目名稱:roslyn,代碼行數:6,代碼來源:MSBuildWorkspace.cs

示例14: SonarAnalyzerManager_HasNoCollidingAnalyzerReference_SameVersionDifferentName

        public void SonarAnalyzerManager_HasNoCollidingAnalyzerReference_SameVersionDifferentName()
        {
            var name = "Some test name";
            Assert.AreNotEqual(SonarAnalyzerManager.AnalyzerName, name,
                "Test input should be different from the expected analyzer name");

            IEnumerable<AnalyzerReference> references = new AnalyzerReference[]
            {
                new ConfigurableAnalyzerReference(
                    new AssemblyIdentity(name, SonarAnalyzerManager.AnalyzerVersion), name)
            };

            Assert.IsFalse(
                SonarAnalyzerManager.HasConflictingAnalyzerReference(
                    SonarAnalyzerManager.GetProjectAnalyzerConflictStatus(references)),
                "Name is not considered in the confliction checking");
        }
開發者ID:SonarSource-VisualStudio,項目名稱:sonarlint-visualstudio,代碼行數:17,代碼來源:SonarAnalyzerManagerTests.cs

示例15: Build

 public CustomAsset Build(AnalyzerReference reference, CancellationToken cancellationToken)
 {
     return new WorkspaceAnalyzerReferenceAsset(reference, _serializer);
 }
開發者ID:jkotas,項目名稱:roslyn,代碼行數:4,代碼來源:CustomAssetBuilder.cs


注:本文中的Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。