本文整理汇总了C#中SolutionCrawlerRegistrationService.AddAnalyzerProvider方法的典型用法代码示例。如果您正苦于以下问题:C# SolutionCrawlerRegistrationService.AddAnalyzerProvider方法的具体用法?C# SolutionCrawlerRegistrationService.AddAnalyzerProvider怎么用?C# SolutionCrawlerRegistrationService.AddAnalyzerProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolutionCrawlerRegistrationService
的用法示例。
在下文中一共展示了SolutionCrawlerRegistrationService.AddAnalyzerProvider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DynamicallyAddAnalyzer
public async Task DynamicallyAddAnalyzer()
{
using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler))
{
// create solution and wait for it to settle
var solution = GetInitialSolutionInfo(workspace);
workspace.OnSolutionAdded(solution);
await WaitWaiterAsync(workspace.ExportProvider);
// create solution crawler and add new analyzer provider dynamically
var service = new SolutionCrawlerRegistrationService(
SpecializedCollections.EmptyEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>>(),
GetListeners(workspace.ExportProvider));
service.Register(workspace);
var provider = new AnalyzerProvider(new Analyzer());
service.AddAnalyzerProvider(provider, Metadata.Crawler);
// wait for everything to settle
await WaitAsync(service, workspace);
service.Unregister(workspace);
// check whether everything ran as expected
Assert.Equal(10, provider.Analyzer.SyntaxDocumentIds.Count);
Assert.Equal(10, provider.Analyzer.DocumentIds.Count);
}
}