本文整理汇总了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;
}
示例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);
}
}
示例3: GetNameText
private static string GetNameText(AnalyzerReference analyzerReference)
{
if (analyzerReference.IsUnresolved)
{
return analyzerReference.FullPath;
}
else
{
return analyzerReference.Display;
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例12: WriteUnresolvedAnalyzerReferenceTo
private static void WriteUnresolvedAnalyzerReferenceTo(AnalyzerReference reference, ObjectWriter writer)
{
writer.WriteString(nameof(UnresolvedAnalyzerReference));
writer.WriteString(reference.FullPath);
}
示例13: ApplyAnalyzerReferenceRemoved
protected override void ApplyAnalyzerReferenceRemoved(ProjectId projectId, AnalyzerReference analyzerReference)
{
Debug.Assert(_applyChangesProjectFile != null);
_applyChangesProjectFile.RemoveAnalyzerReference(analyzerReference);
this.OnAnalyzerReferenceRemoved(projectId, analyzerReference);
}
示例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);
}