本文整理匯總了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);
}