本文整理汇总了C#中Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference类的典型用法代码示例。如果您正苦于以下问题:C# AnalyzerReference类的具体用法?C# AnalyzerReference怎么用?C# AnalyzerReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnalyzerReference类属于Microsoft.CodeAnalysis.Diagnostics命名空间,在下文中一共展示了AnalyzerReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: AddAnalyzerReference
public ProjectState AddAnalyzerReference(AnalyzerReference analyzerReference)
{
Contract.Requires(!this.AnalyzerReferences.Contains(analyzerReference));
return this.With(
projectInfo: this.ProjectInfo.WithAnalyzerReferences(this.AnalyzerReferences.ToImmutableArray().Add(analyzerReference)).WithVersion(this.Version.GetNewerVersion()));
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:7,代码来源:ProjectState.cs
示例17: ProjectCodeFixProvider
public ProjectCodeFixProvider(AnalyzerReference reference)
{
_reference = reference;
_fixersPerLanguage = ImmutableDictionary<string, ImmutableArray<CodeFixProvider>>.Empty;
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:5,代码来源:CodeFixService.ProjectCodeFixProvider.cs
示例18: WorkspaceAnalyzerReferenceAsset
public WorkspaceAnalyzerReferenceAsset(AnalyzerReference reference, Serializer serializer) :
base(CreateChecksum(reference), WellKnownSynchronizationKinds.AnalyzerReference)
{
_reference = reference;
_serializer = serializer;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:6,代码来源:CustomAsset.cs
示例19: RemoveAnalyzerReference
/// <summary>
/// Creates a new instance of this project updated to no longer include the specified analyzer reference.
/// </summary>
public Project RemoveAnalyzerReference(AnalyzerReference analyzerReference)
{
return this.Solution.RemoveAnalyzerReference(this.Id, analyzerReference).GetProject(this.Id);
}
开发者ID:tvsonar,项目名称:roslyn,代码行数:7,代码来源:Project.cs
示例20: SonarAnalyzerManager_GetIsBoundWithoutAnalyzer_Unbound_NonConflicting
public void SonarAnalyzerManager_GetIsBoundWithoutAnalyzer_Unbound_NonConflicting()
{
this.activeSolutionBoundTracker.IsActiveSolutionBound = false;
IEnumerable<AnalyzerReference> references = new AnalyzerReference[]
{
new ConfigurableAnalyzerReference(
new AssemblyIdentity(SonarAnalyzerManager.AnalyzerName, SonarAnalyzerManager.AnalyzerVersion),
SonarAnalyzerManager.AnalyzerName)
};
Assert.IsFalse(
this.testSubject.GetIsBoundWithoutAnalyzer(
SonarAnalyzerManager.GetProjectAnalyzerConflictStatus(references)),
"Unbound solution should never return true");
}
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:16,代码来源:SonarAnalyzerManagerTests.ForBound.cs
注:本文中的Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论