/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Workspaces/Remote/ServiceHub/Services/LegacySolutionEvents/RemoteLegacySolutionEventsAggregationService.cs
53 строки
2 KB
Jason Malinowski
Disable processing of source-generated documents in unit testing
13 фев 2026, 04:03
13 фев 2026, 04:03
148f754
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LegacySolutionEvents; namespace Microsoft.CodeAnalysis.Remote; internal sealed class RemoteLegacySolutionEventsAggregationService : BrokeredServiceBase, IRemoteLegacySolutionEventsAggregationService { internal sealed class Factory : FactoryBase<IRemoteLegacySolutionEventsAggregationService> { protected override IRemoteLegacySolutionEventsAggregationService CreateService(in ServiceConstructionArguments arguments) => new RemoteLegacySolutionEventsAggregationService(arguments); } public RemoteLegacySolutionEventsAggregationService(in ServiceConstructionArguments arguments) : base(arguments) { } public ValueTask<bool> ShouldReportChangesAsync(CancellationToken cancellationToken) { return RunServiceImplAsync( async cancellationToken => { var services = this.GetWorkspaceServices(); var aggregationService = services.GetRequiredService<ILegacySolutionEventsAggregationService>(); return aggregationService.ShouldReportChanges(services); }, cancellationToken); } public ValueTask OnWorkspaceChangedAsync( Checksum oldSolutionChecksum, Checksum newSolutionChecksum, WorkspaceChangeKind kind, ProjectId? projectId, DocumentId? documentId, bool processSourceGeneratedDocuments, CancellationToken cancellationToken) { return RunServiceAsync(oldSolutionChecksum, newSolutionChecksum, async (oldSolution, newSolution) => { var aggregationService = oldSolution.Services.GetRequiredService<ILegacySolutionEventsAggregationService>(); await aggregationService.OnWorkspaceChangedAsync( new WorkspaceChangeEventArgs(kind, oldSolution, newSolution, projectId, documentId), processSourceGeneratedDocuments, cancellationToken).ConfigureAwait(false); }, cancellationToken); } }