示例#1
0
        private Task <HostSessionStartAnalysisScope> GetSessionAnalysisScopeCoreAsync(
            DiagnosticAnalyzer analyzer,
            AnalyzerExecutor analyzerExecutor)
        {
            Func <DiagnosticAnalyzer, Task <HostSessionStartAnalysisScope> > getTask = a =>
            {
                return(Task.Run(async() =>
                {
                    var sessionScope = new HostSessionStartAnalysisScope();
                    await analyzerExecutor.ExecuteInitializeMethodAsync(a, sessionScope).ConfigureAwait(false);
                    return sessionScope;
                }, analyzerExecutor.CancellationToken));
            };

            return(_sessionScopeMap.GetOrAdd(analyzer, getTask));
        }