/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/CSharpTest/PdbSourceDocument/NullResultMetadataAsSourceFileProvider.cs
54 строки
2 KB
Cyrus Najmabadi
Reapply "Update methods to be `async`." (#81808)
31 дек 2025, 01:59
31 дек 2025, 01:59
3d73546
Код
Авторство
О чём код?
// 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; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.MetadataAsSource; using Microsoft.CodeAnalysis.PdbSourceDocument; using Microsoft.CodeAnalysis.Structure; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.PdbSourceDocument; /// <summary> /// IMetadataAsSourceFileService has to always return a result, but for our testing /// we remove the decompilation provider that would normally ensure that. This provider /// takes it place to ensure we always return a known null result, so we can also verify /// against it in tests. /// </summary> [ExportMetadataAsSourceFileProvider("Dummy"), Shared] [ExtensionOrder(After = PdbSourceDocumentMetadataAsSourceFileProvider.ProviderName)] internal sealed class NullResultMetadataAsSourceFileProvider : IMetadataAsSourceFileProvider { // Represents a null result public static MetadataAsSourceFile NullResult = new("", null!, null!, null!); [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public NullResultMetadataAsSourceFileProvider() { } public void CleanupGeneratedFiles(MetadataAsSourceWorkspace workspace) { } public async Task<MetadataAsSourceFile?> GetGeneratedFileAsync(MetadataAsSourceWorkspace metadataWorkspace, Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, bool signaturesOnly, MetadataAsSourceOptions options, string tempPath, TelemetryMessage? telemetry, CancellationToken cancellationToken) { return NullResult; } public Project? MapDocument(Document document) { return null; } public bool ShouldCollapseOnOpen(MetadataAsSourceWorkspace workspace, string filePath, BlockStructureOptions options) { return true; } }