From c7a16e0c9e0652ceb00a3e35a8983c7c956a4ae0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 2 Sep 2021 12:47:07 -0700 Subject: [PATCH 1/7] Remove the HasCompilation flag. --- .../Solution/SolutionState.CompilationTracker.cs | 9 --------- ...ate.GeneratedFileReplacingCompilationTracker.cs | 2 -- .../Solution/SolutionState.ICompilationTracker.cs | 14 -------------- .../Portable/Workspace/Solution/SolutionState.cs | 7 ------- 4 files changed, 32 deletions(-) diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs index a04b9e6044d01..7c1a53ddbe199 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs @@ -80,15 +80,6 @@ private void WriteState(State state, SolutionServices solutionServices) Volatile.Write(ref _stateDoNotAccessDirectly, state); } - public bool HasCompilation - { - get - { - var state = this.ReadState(); - return state.CompilationWithoutGeneratedDocuments != null && state.CompilationWithoutGeneratedDocuments.TryGetValue(out _) || state.DeclarationOnlyCompilation != null; - } - } - public bool ContainsAssemblyOrModuleOrDynamic(ISymbol symbol, bool primary) { Debug.Assert(symbol.Kind == SymbolKind.Assembly || diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.GeneratedFileReplacingCompilationTracker.cs b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.GeneratedFileReplacingCompilationTracker.cs index 51d3aead327b3..0804eaa103860 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.GeneratedFileReplacingCompilationTracker.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.GeneratedFileReplacingCompilationTracker.cs @@ -37,8 +37,6 @@ public GeneratedFileReplacingCompilationTracker(ICompilationTracker underlyingTr _replacedGeneratedDocumentState = replacementDocumentState; } - public bool HasCompilation => _underlyingTracker.HasCompilation; - public ProjectState ProjectState => _underlyingTracker.ProjectState; public bool ContainsAssemblyOrModuleOrDynamic(ISymbol symbol, bool primary) diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.ICompilationTracker.cs b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.ICompilationTracker.cs index 7aa776dc26801..0884af7692628 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.ICompilationTracker.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.ICompilationTracker.cs @@ -14,20 +14,6 @@ internal partial class SolutionState { private interface ICompilationTracker { - /// - /// Returns true if this tracker currently either points to a compilation, has an in-progress - /// compilation being computed, or has a skeleton reference. Note: this is simply a weak - /// statement about the tracker at this exact moment in time. Immediately after this returns - /// the tracker might change and may no longer have a final compilation (for example, if the - /// retainer let go of it) or might not have an in-progress compilation (for example, if the - /// background compiler finished with it). - /// - /// Because of the above limitations, this should only be used by clients as a weak form of - /// information about the tracker. For example, a client may see that a tracker has no - /// compilation and may choose to throw it away knowing that it could be reconstructed at a - /// later point if necessary. - /// - bool HasCompilation { get; } ProjectState ProjectState { get; } /// diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs index 213acc84b3b2c..0504a8bd7c642 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs @@ -1586,14 +1586,7 @@ private ImmutableDictionary CreateCompilationTra IEnumerable? dependencies = null; foreach (var (id, tracker) in _projectIdToTrackerMap) - { - if (!tracker.HasCompilation) - { - continue; - } - builder.Add(id, CanReuse(id) ? tracker : tracker.Fork(tracker.ProjectState)); - } return builder.ToImmutable(); From 82a4adb0fc86b4d38939f08336995a4c1b83a7a7 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 3 Sep 2021 16:51:58 -0700 Subject: [PATCH 2/7] Don't try to rename references in source generated files In afd8743801b925948a59edab256120fd140eb804, I prevented us from trying to rename the definition locations of a symbol that may have appeared in a generated file; that could happen in partial file cases or some cascading cases. But I missed the much simpler case: just having a good old fashioned reference in a generated file. This fixes that oversight. Fixes https://developercommunity.visualstudio.com/t/Renaming-fails-for-type-referenced-in-a-/1389855 --- .../Rename/CSharp/SourceGeneratorTests.vb | 22 +++++++++++++++++++ .../RenameLocation.ReferenceProcessing.cs | 7 ++++++ 2 files changed, 29 insertions(+) diff --git a/src/EditorFeatures/Test2/Rename/CSharp/SourceGeneratorTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/SourceGeneratorTests.vb index 429f4425b3234..08f13d9ae44b8 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/SourceGeneratorTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/SourceGeneratorTests.vb @@ -33,6 +33,28 @@ public class GeneratedClass End Using End Sub + + Public Sub RenameWithReferenceInGeneratedFile(host As RenameTestHost) + Using result = RenameEngineResult.Create(_outputHelper, + + + +public class [|$$RegularClass|] +{ +} + + +public class GeneratedClass +{ + public void M(RegularClass c) { } +} + + + , host:=host, renameTo:="A") + + End Using + End Sub + Public Sub RenameWithCascadeIntoGeneratedFile(host As RenameTestHost) diff --git a/src/Workspaces/Core/Portable/Rename/RenameLocation.ReferenceProcessing.cs b/src/Workspaces/Core/Portable/Rename/RenameLocation.ReferenceProcessing.cs index 0fbb42ff3b1a9..4fb1d1e66c5c9 100644 --- a/src/Workspaces/Core/Portable/Rename/RenameLocation.ReferenceProcessing.cs +++ b/src/Workspaces/Core/Portable/Rename/RenameLocation.ReferenceProcessing.cs @@ -360,6 +360,13 @@ void AddRenameLocationIfNotGenerated(Location location, bool isRenamableAccessor internal static async Task> GetRenamableReferenceLocationsAsync(ISymbol referencedSymbol, ISymbol originalSymbol, ReferenceLocation location, Solution solution, CancellationToken cancellationToken) { + // We won't try to update references in source generated files; we'll assume the generator will rerun + // and produce an updated document with the new name. + if (location.Document is SourceGeneratedDocument) + { + return SpecializedCollections.EmptyEnumerable(); + } + var shouldIncludeSymbol = await ShouldIncludeSymbolAsync(referencedSymbol, originalSymbol, solution, true, cancellationToken).ConfigureAwait(false); if (!shouldIncludeSymbol) { From bf962c9f32d7f6f19fdc0a22c47787dbed8037ed Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Mon, 6 Sep 2021 23:39:26 +0200 Subject: [PATCH 3/7] Fix await completion provider to handle non-"true" local function declarations (#56196) Co-authored-by: David Wengier --- ...tionCommandHandlerTests_AwaitCompletion.vb | 35 +++++++++++++++++++ .../AwaitCompletionProvider.cs | 19 ++++++++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_AwaitCompletion.vb b/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_AwaitCompletion.vb index 6ff2de8d839dd..71ab0e7b76262 100644 --- a/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_AwaitCompletion.vb +++ b/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_AwaitCompletion.vb @@ -381,6 +381,41 @@ public class C await } } +", state.GetDocumentText()) + End Using + End Function + + + + Public Async Function SyntaxIsLikeLocalFunction() As Task + Using state = TestStateFactory.CreateCSharpTestState( + + ) + state.SendTypeChars("aw") + Await state.AssertSelectedCompletionItem(displayText:="await", isHardSelected:=True, inlineDescription:=FeaturesResources.Make_containing_scope_async) + + state.SendTab() + + Assert.Equal(" +public class C +{ + public async void M() + { + await MyFunctionCall(); + } + + public void MyFunctionCall() {} +} ", state.GetDocumentText()) End Using End Function diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/AwaitCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/AwaitCompletionProvider.cs index 21b4fb8e9c30d..4825d121acdfa 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/AwaitCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/AwaitCompletionProvider.cs @@ -7,10 +7,8 @@ using System.Composition; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Completion.Providers; -using Microsoft.CodeAnalysis.CSharp.CodeGeneration; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; @@ -50,6 +48,21 @@ private protected override int GetSpanStart(SyntaxNode declaration) } private protected override SyntaxNode? GetAsyncSupportingDeclaration(SyntaxToken token) - => token.GetAncestor(node => node.IsAsyncSupportingFunctionSyntax()); + { + var node = token.GetAncestor(node => node.IsAsyncSupportingFunctionSyntax()); + // For local functions, make sure we either have arrow token or open brace token. + // Consider the following scenario: + // void Method() + // { + // aw$$ AnotherMethodCall(); // NOTE: Here, the compiler produces LocalFunctionStatementSyntax. + // } + // For this case, we're interested in putting async in front of Method() + if (node is LocalFunctionStatementSyntax { ExpressionBody: null, Body: null }) + { + return node.Parent?.FirstAncestorOrSelf(node => node.IsAsyncSupportingFunctionSyntax()); + } + + return node; + } } } From 4fada24142fb5bfdf4ec530e56eebf712227cbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 7 Sep 2021 09:43:36 -0700 Subject: [PATCH 4/7] More options refactoring (#56089) * KeybindingResetDetector refactoring * Atomic get/set of multiple options * RemoteHostOptions * LSP --- .../SplitCommentCommandHandler.cs | 14 +- .../AbstractAsynchronousTaggerProvider.cs | 2 +- ...AbstractSplitCommentCommandHandlerTests.cs | 9 +- .../DiagnosticAnalyzerServiceTests.cs | 97 ++++++++------ .../RemoteEditAndContinueServiceTests.cs | 5 +- .../Test/Preview/PreviewWorkspaceTests.cs | 7 +- .../AbstractLanguageServerProtocolTests.cs | 7 +- .../Squiggles/TestDiagnosticTagProducer.cs | 35 ++--- .../ImplementInterfaceCommandHandlerTests.vb | 5 +- .../Diagnostics/DiagnosticModeExtensions.cs | 14 +- .../Portable/Diagnostics/DiagnosticService.cs | 8 +- .../Diagnostics/DiagnosticsUpdatedArgs.cs | 8 +- .../CSharpVisualBasicLanguageServerFactory.cs | 12 +- .../Handler/Completion/CompletionHandler.cs | 8 +- .../Completion/CompletionHandlerProvider.cs | 6 +- .../AbstractPullDiagnosticHandler.cs | 3 +- .../Protocol/Handler/RequestContext.cs | 122 +++++++++--------- .../Protocol/Handler/RequestExecutionQueue.cs | 5 + .../Protocol/LanguageServerTarget.cs | 6 +- .../LanguageServerTargetTests.cs | 11 +- .../CallHierarchy/CallHierarchyDetail.cs | 7 +- .../CallHierarchy/CallHierarchyProvider.cs | 2 +- .../ColorSchemeApplier.Settings.cs | 14 +- .../ColorSchemes/ColorSchemeApplier.cs | 5 +- .../Entries/DocumentSpanEntry.cs | 5 +- .../KeybindingResetDetector.cs | 1 - .../AbstractInProcLanguageClient.cs | 8 +- .../AlwaysActivateInProcLanguageClient.cs | 11 +- .../LiveShareInProcLanguageClient.cs | 7 +- .../RazorInProcLanguageClient.cs | 7 +- .../VisualStudioInProcLanguageServer.cs | 7 +- .../VisualStudioRemoteHostClientProvider.cs | 13 +- ...isualStudioWorkspaceServiceHubConnector.cs | 11 +- .../AbstractTableEntriesSnapshot.cs | 5 +- .../MiscellaneousDiagnosticListTable.cs | 17 ++- ...DiagnosticListTable.LiveTableDataSource.cs | 16 ++- .../VisualStudioDiagnosticListTable.cs | 16 ++- .../Workspace/SourceGeneratedFileManager.cs | 9 +- .../VisualStudioDocumentNavigationService.cs | 17 ++- .../VisualStudioSymbolNavigationService.cs | 7 +- ...sualStudioWorkspaceStatusServiceFactory.cs | 15 ++- .../Def/ValueTracking/TreeItemViewModel.cs | 2 +- .../ValueTrackedTreeItemViewModel.cs | 2 +- .../RemoteHostClientServiceFactoryTests.cs | 17 ++- .../Test.Next/Services/LspDiagnosticsTests.cs | 3 + .../DiagnosticTableDataSourceTests.vb | 66 ++++++---- .../ExternalDiagnosticUpdateSourceTests.vb | 19 ++- .../VisualStudioAnalyzerTests.vb | 14 +- .../Impl/Client/RemoteDiagnosticListTable.cs | 9 +- .../Client/RemoteLanguageServiceWorkspace.cs | 20 +-- .../XamlInProcLanguageClient.cs | 7 +- .../XamlInProcLanguageClientDisableUX.cs | 7 +- .../Portable/Options/IGlobalOptionService.cs | 6 +- .../OptionServiceTests.cs | 5 - .../Remote/Core/RemoteHostOptions.cs | 33 ++--- .../Remote/Core/ServiceHubRemoteHostClient.cs | 20 ++- .../Remote/Core/SolutionChecksumUpdater.cs | 5 +- 57 files changed, 482 insertions(+), 337 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/SplitComment/SplitCommentCommandHandler.cs b/src/EditorFeatures/Core/Implementation/SplitComment/SplitCommentCommandHandler.cs index 7f399654c87d9..57d2a41895f51 100644 --- a/src/EditorFeatures/Core/Implementation/SplitComment/SplitCommentCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/SplitComment/SplitCommentCommandHandler.cs @@ -34,15 +34,18 @@ internal sealed class SplitCommentCommandHandler : ICommandHandler EditorFeaturesResources.Split_comment; @@ -65,6 +68,9 @@ public bool ExecuteCommand(ReturnKeyCommandArgs args, CommandExecutionContext co if (document == null) return false; + if (!_globalOptions.GetOption(SplitCommentOptions.Enabled, document.Project.Language)) + return false; + var splitCommentService = document.GetLanguageService(); if (splitCommentService == null) return false; @@ -138,11 +144,6 @@ private static bool MatchesCommentStart(string commentStart, ITextSnapshotLine l SnapshotSpan selectionSpan, CancellationToken cancellationToken) { - var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); - var enabled = options.GetOption(SplitCommentOptions.Enabled); - if (!enabled) - return null; - var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var syntaxKinds = document.GetRequiredLanguageService(); var trivia = root.FindTrivia(selectionSpan.Start); @@ -168,6 +169,7 @@ private static bool MatchesCommentStart(string commentStart, ITextSnapshotLine l var textSnapshot = selectionSpan.Snapshot; var triviaLine = textSnapshot.GetLineFromPosition(trivia.SpanStart); + var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var replacementSpan = GetReplacementSpan(triviaLine, selectionSpan); var replacementText = GetReplacementText(textView, options, triviaLine, trivia, selectionSpan.Start); return (replacementSpan, replacementText); diff --git a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs index e139089ef2d74..465dd79a9b188 100644 --- a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs +++ b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs @@ -58,7 +58,7 @@ internal abstract partial class AbstractAsynchronousTaggerProvider : Foreg /// Options controlling this tagger. The tagger infrastructure will check this option /// against the buffer it is associated with to see if it should tag or not. /// - /// An empty enumerable, or null, can be returned to indicate that this tagger should + /// An empty enumerable can be returned to indicate that this tagger should /// run unconditionally. /// protected virtual IEnumerable> Options => SpecializedCollections.EmptyEnumerable>(); diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/SplitComments/AbstractSplitCommentCommandHandlerTests.cs b/src/EditorFeatures/DiagnosticsTestUtilities/SplitComments/AbstractSplitCommentCommandHandlerTests.cs index b0841295c157d..20623f233d3b9 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/SplitComments/AbstractSplitCommentCommandHandlerTests.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/SplitComments/AbstractSplitCommentCommandHandlerTests.cs @@ -50,12 +50,13 @@ private void TestWorker( Assert.True(expectedOutputMarkup.Contains("\t")); } - using var workspace = this.CreateWorkspace(inputMarkup); + using var workspace = CreateWorkspace(inputMarkup); + var globalOptions = workspace.ExportProvider.GetExportedValue(); var language = workspace.Projects.Single().Language; - workspace.SetOptions( - workspace.Options.WithChangedOption(FormattingOptions.UseTabs, language, useTabs) - .WithChangedOption(SplitCommentOptions.Enabled, language, enabled)); + + globalOptions.SetGlobalOption(new OptionKey(SplitCommentOptions.Enabled, language), enabled); + workspace.SetOptions(workspace.Options.WithChangedOption(FormattingOptions.UseTabs, language, useTabs)); var document = workspace.Documents.Single(); var view = document.GetTextView(); diff --git a/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs b/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs index fbf2f4d8221aa..b1a8a2ae99378 100644 --- a/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs @@ -18,6 +18,7 @@ using Microsoft.CodeAnalysis.Editor.Test; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Remote.Diagnostics; using Microsoft.CodeAnalysis.Remote.Testing; @@ -58,15 +59,17 @@ public async Task TestHasSuccessfullyLoadedBeingFalse() var document = GetDocumentFromIncompleteProject(workspace); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); var analyzer = service.CreateIncrementalAnalyzer(workspace); + var globalOptions = exportProvider.GetExportedValue(); // listen to events // check empty since this could be called to clear up existing diagnostics service.DiagnosticsUpdated += (s, a) => { - var diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); Assert.Empty(diagnostics); }; @@ -183,9 +186,11 @@ public async Task TestDisabledByDefaultAnalyzerEnabledWithEditorConfig(bool enab var applied = workspace.TryApplyChanges(document.Project.Solution); Assert.True(applied); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); var analyzer = service.CreateIncrementalAnalyzer(workspace); + var globalOptions = exportProvider.GetExportedValue(); // listen to events var syntaxDiagnostic = false; @@ -193,7 +198,7 @@ public async Task TestDisabledByDefaultAnalyzerEnabledWithEditorConfig(bool enab var compilationDiagnostic = false; service.DiagnosticsUpdated += (s, a) => { - var diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); var diagnostic = Assert.Single(diagnostics); Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); @@ -232,8 +237,12 @@ private static async Task TestAnalyzerAsync( Func, (bool, bool)> resultSetter, bool expectedSyntax, bool expectedSemantic) { - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); + var globalOptions = exportProvider.GetExportedValue(); + var analyzer = service.CreateIncrementalAnalyzer(workspace); var syntax = false; @@ -242,7 +251,7 @@ private static async Task TestAnalyzerAsync( // listen to events service.DiagnosticsUpdated += (s, a) => { - var diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); (syntax, semantic) = resultSetter(syntax, semantic, diagnostics); }; @@ -262,6 +271,9 @@ public async Task TestOpenFileOnlyAnalyzerDiagnostics() { using var workspace = CreateWorkspace(); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + var globalOptions = exportProvider.GetExportedValue(); + var analyzerReference = new AnalyzerImageReference(ImmutableArray.Create(new OpenFileOnlyAnalyzer())); workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(new[] { analyzerReference })); @@ -275,8 +287,8 @@ public async Task TestOpenFileOnlyAnalyzerDiagnostics() var document = workspace.AddDocument(project.Id, "Empty.cs", SourceText.From("")); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); var analyzer = service.CreateIncrementalAnalyzer(workspace); // listen to events @@ -284,7 +296,7 @@ public async Task TestOpenFileOnlyAnalyzerDiagnostics() { if (workspace.IsDocumentOpen(a.DocumentId)) { - var diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); // check the diagnostics are reported Assert.Equal(document.Id, a.DocumentId); Assert.Equal(1, diagnostics.Length); @@ -294,7 +306,7 @@ public async Task TestOpenFileOnlyAnalyzerDiagnostics() if (a.DocumentId == document.Id && !workspace.IsDocumentOpen(a.DocumentId)) { // check the diagnostics reported are cleared - var diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); Assert.Equal(0, diagnostics.Length); } }; @@ -342,16 +354,18 @@ public async Task TestSynchronizeWithBuild() loader: TextLoader.From(TextAndVersion.Create(SourceText.From(""), VersionStamp.Create(), filePath)), filePath: filePath)); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); var analyzer = service.CreateIncrementalAnalyzer(workspace); + var globalOptions = exportProvider.GetExportedValue(); var syntax = false; // listen to events service.DiagnosticsUpdated += (s, a) => { - var diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); switch (diagnostics.Length) { case 0: @@ -390,6 +404,7 @@ await service.SynchronizeWithBuildAsync( public void TestHostAnalyzerOrdering() { using var workspace = CreateWorkspace(); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; var analyzerReference = new AnalyzerImageReference(ImmutableArray.Create( new Priority20Analyzer(), @@ -411,8 +426,8 @@ public void TestHostAnalyzerOrdering() "Dummy", LanguageNames.CSharp)); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); var incrementalAnalyzer = (DiagnosticIncrementalAnalyzer)service.CreateIncrementalAnalyzer(workspace); var analyzers = incrementalAnalyzer.GetAnalyzersTestOnly(project).ToArray(); @@ -458,13 +473,15 @@ public async Task TestHostAnalyzerErrorNotLeaking() loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class A {}"), VersionStamp.Create(), filePath: "test.cs")), filePath: "test.cs")})); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); + var globalOptions = exportProvider.GetExportedValue(); var called = false; service.DiagnosticsUpdated += (s, e) => { - var diagnostics = e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); if (diagnostics.Length == 0) { return; @@ -560,13 +577,15 @@ private static AdhocWorkspace CreateWorkspaceWithProjectAndAnalyzer(DiagnosticAn private static async Task TestFullSolutionAnalysisForProjectAsync(AdhocWorkspace workspace, Project project, bool expectAnalyzerExecuted) { - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); + var globalOptions = exportProvider.GetExportedValue(); var called = false; service.DiagnosticsUpdated += (s, e) => { - var diagnostics = e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); if (diagnostics.Length == 0) { return; @@ -590,6 +609,9 @@ private static async Task TestFullSolutionAnalysisForProjectAsync(AdhocWorkspace internal async Task TestAdditionalFileAnalyzer(bool registerFromInitialize, bool testMultiple, BackgroundAnalysisScope analysisScope) { using var workspace = CreateWorkspace(); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + var globalOptions = exportProvider.GetExportedValue(); + var options = workspace.Options.WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.CSharp, analysisScope); workspace.SetOptions(options); @@ -616,13 +638,13 @@ internal async Task TestAdditionalFileAnalyzer(bool registerFromInitialize, bool var applied = workspace.TryApplyChanges(project.Solution); Assert.True(applied); - Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); - var service = Assert.IsType(((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValue()); + Assert.IsType(exportProvider.GetExportedValue()); + var service = Assert.IsType(exportProvider.GetExportedValue()); var diagnostics = new ConcurrentSet(); service.DiagnosticsUpdated += (s, e) => { - diagnostics.AddRange(e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode)); + diagnostics.AddRange(e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode)); }; var incrementalAnalyzer = (DiagnosticIncrementalAnalyzer)service.CreateIncrementalAnalyzer(workspace); @@ -719,13 +741,14 @@ internal async Task TestDiagnosticSuppressor(bool includeAnalyzer, bool includeS var project = workspace.CurrentSolution.Projects.Single(); var document = project.Documents.Single(); - Assert.IsType(workspace.ExportProvider.GetExportedValue()); - var service = Assert.IsType(workspace.ExportProvider.GetExportedValue()); + Assert.IsType(workspace.GetService()); + var service = Assert.IsType(workspace.GetService()); + var globalOptions = workspace.GetService(); DiagnosticData diagnostic = null; service.DiagnosticsUpdated += (s, e) => { - var diagnostics = e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); if (diagnostics.Length == 0) { return; @@ -823,14 +846,15 @@ void M() var project = workspace.CurrentSolution.Projects.Single(); var document = project.Documents.Single(); - Assert.IsType(workspace.ExportProvider.GetExportedValue()); - var service = Assert.IsType(workspace.ExportProvider.GetExportedValue()); + Assert.IsType(workspace.GetService()); + var service = Assert.IsType(workspace.GetService()); + var globalOptions = workspace.GetService(); var diagnostics = ArrayBuilder.GetInstance(); service.DiagnosticsUpdated += (s, e) => { diagnostics.AddRange( - e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) .Where(d => d.Id == IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId) .OrderBy(d => d.GetTextSpan())); }; @@ -901,13 +925,14 @@ void M() var project = workspace.CurrentSolution.Projects.Single(); var document = project.Documents.Single(); - Assert.IsType(workspace.ExportProvider.GetExportedValue()); - var service = Assert.IsType(workspace.ExportProvider.GetExportedValue()); + Assert.IsType(workspace.GetService()); + var service = Assert.IsType(workspace.GetService()); + var globalOptions = workspace.GetService(); DiagnosticData diagnostic = null; service.DiagnosticsUpdated += (s, e) => { - var diagnostics = e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); if (diagnostics.IsEmpty) { return; diff --git a/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs b/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs index b450c99aa6c9b..5a153df7c9be5 100644 --- a/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs @@ -20,6 +20,7 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Remote.Testing; using Microsoft.CodeAnalysis.Test.Utilities; @@ -58,6 +59,8 @@ public async Task Proxy(TestHost testHost) using var localWorkspace = new TestWorkspace(composition: localComposition); + var globalOptions = localWorkspace.GetService(); + MockEditAndContinueWorkspaceService mockEncService; var clientProvider = (InProcRemoteHostClientProvider?)localWorkspace.Services.GetService(); if (testHost == TestHost.InProcess) @@ -240,7 +243,7 @@ void VerifyReanalyzeInvocation(ImmutableArray documentIds) }, emitDiagnosticsUpdated.Select(update => { - var d = update.GetPushDiagnostics(localWorkspace, InternalDiagnosticsOptions.NormalDiagnosticMode).Single(); + var d = update.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode).Single(); return $"[{d.ProjectId}] {d.Severity} {d.Id}:" + (d.DataLocation != null ? $" {d.DataLocation.OriginalFilePath}({d.DataLocation.OriginalStartLine}, {d.DataLocation.OriginalStartColumn}, {d.DataLocation.OriginalEndLine}, {d.DataLocation.OriginalEndColumn}):" : "") + $" {d.Message}"; diff --git a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs index 4db4b72a73af6..90babe247843d 100644 --- a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs +++ b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SolutionCrawler; @@ -136,9 +137,11 @@ public async Task TestPreviewServices() public async Task TestPreviewDiagnostic() { var hostServices = EditorTestCompositions.EditorFeatures.GetHostServices(); + var exportProvider = (IMefHostExportProvider)hostServices; - var diagnosticService = (IDiagnosticUpdateSource)((IMefHostExportProvider)hostServices).GetExportedValue(); + var diagnosticService = (IDiagnosticUpdateSource)exportProvider.GetExportedValue(); RoslynDebug.AssertNotNull(diagnosticService); + var globalOptions = exportProvider.GetExportedValue(); var taskSource = new TaskCompletionSource(); diagnosticService.DiagnosticsUpdated += (s, a) => taskSource.TrySetResult(a); @@ -164,7 +167,7 @@ public async Task TestPreviewDiagnostic() Assert.True(taskSource.Task.IsCompleted); var args = taskSource.Task.Result; - Assert.True(args.GetPushDiagnostics(previewWorkspace, InternalDiagnosticsOptions.NormalDiagnosticMode).Length > 0); + Assert.True(args.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode).Length > 0); } [WpfFact] diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index 94327fc855980..ec7a9e8a1b1f6 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -20,11 +20,11 @@ using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Composition; -using Microsoft.VisualStudio.Text.Adornments; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Roslyn.Utilities; @@ -404,8 +404,9 @@ private static RequestDispatcher CreateRequestDispatcher(TestWorkspace workspace private static RequestExecutionQueue CreateRequestQueue(TestWorkspace workspace) { - var registrationService = workspace.ExportProvider.GetExportedValue(); - return new RequestExecutionQueue(NoOpLspLogger.Instance, registrationService, ProtocolConstants.RoslynLspLanguages, serverName: "Tests", "TestClient"); + var registrationService = workspace.GetService(); + var globalOptions = workspace.GetService(); + return new RequestExecutionQueue(NoOpLspLogger.Instance, registrationService, globalOptions, ProtocolConstants.RoslynLspLanguages, serverName: "Tests", "TestClient"); } private static string GetDocumentFilePathFromName(string documentName) diff --git a/src/EditorFeatures/TestUtilities/Squiggles/TestDiagnosticTagProducer.cs b/src/EditorFeatures/TestUtilities/Squiggles/TestDiagnosticTagProducer.cs index d5215d7f24244..18e8a2a490cdf 100644 --- a/src/EditorFeatures/TestUtilities/Squiggles/TestDiagnosticTagProducer.cs +++ b/src/EditorFeatures/TestUtilities/Squiggles/TestDiagnosticTagProducer.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text.Tagging; @@ -33,22 +34,22 @@ internal sealed class TestDiagnosticTagProducer internal static async Task>> GetErrorsFromUpdateSource(TestWorkspace workspace, DiagnosticsUpdatedArgs updateArgs) { - var source = new TestDiagnosticUpdateSource(workspace); - using (var wrapper = new DiagnosticTaggerWrapper(workspace, updateSource: source)) - { - var tagger = wrapper.TaggerProvider.CreateTagger(workspace.Documents.First().GetTextBuffer()); - using (var disposable = tagger as IDisposable) - { - source.RaiseDiagnosticsUpdated(updateArgs); + var globalOptions = workspace.GetService(); + var source = new TestDiagnosticUpdateSource(globalOptions); - await wrapper.WaitForTags(); + using var wrapper = new DiagnosticTaggerWrapper(workspace, updateSource: source); - var snapshot = workspace.Documents.First().GetTextBuffer().CurrentSnapshot; - var spans = tagger.GetTags(snapshot.GetSnapshotSpanCollection()).ToImmutableArray(); + var tagger = wrapper.TaggerProvider.CreateTagger(workspace.Documents.First().GetTextBuffer()); + using var disposable = (IDisposable)tagger; - return spans; - } - } + source.RaiseDiagnosticsUpdated(updateArgs); + + await wrapper.WaitForTags(); + + var snapshot = workspace.Documents.First().GetTextBuffer().CurrentSnapshot; + var spans = tagger.GetTags(snapshot.GetSnapshotSpanCollection()).ToImmutableArray(); + + return spans; } internal static DiagnosticData CreateDiagnosticData(TestHostDocument document, TextSpan span) @@ -72,14 +73,14 @@ internal static DiagnosticData CreateDiagnosticData(TestHostDocument document, T private class TestDiagnosticUpdateSource : IDiagnosticUpdateSource { private ImmutableArray _diagnostics = ImmutableArray.Empty; - private readonly Workspace _workspace; + private readonly IGlobalOptionService _globalOptions; - public TestDiagnosticUpdateSource(Workspace workspace) - => _workspace = workspace; + public TestDiagnosticUpdateSource(IGlobalOptionService globalOptions) + => _globalOptions = globalOptions; public void RaiseDiagnosticsUpdated(DiagnosticsUpdatedArgs args) { - _diagnostics = args.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + _diagnostics = args.GetPushDiagnostics(_globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); DiagnosticsUpdated?.Invoke(this, args); } diff --git a/src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceCommandHandlerTests.vb b/src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceCommandHandlerTests.vb index 897822e411a2e..317550f93db7c 100644 --- a/src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceCommandHandlerTests.vb +++ b/src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceCommandHandlerTests.vb @@ -7,6 +7,7 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions Imports Microsoft.CodeAnalysis.Editor.UnitTests.Utilities Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Editor.VisualBasic.ImplementInterface +Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Text Imports Microsoft.VisualStudio.Commanding Imports Microsoft.VisualStudio.Text @@ -62,10 +63,10 @@ End Class Interface IGoo Sub TestSub() End Interface") + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim commandHandler = MoveCaretAndCreateCommandHandler(workspace) - workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options _ - .WithChangedOption(FeatureOnOffOptions.AutomaticInsertionOfAbstractOrInterfaceMembers, LanguageNames.VisualBasic, False))) + globalOptions.SetGlobalOption(New OptionKey(FeatureOnOffOptions.AutomaticInsertionOfAbstractOrInterfaceMembers, LanguageNames.VisualBasic), False) Dim nextHandlerCalled = False Dim view = workspace.Documents.Single().GetTextView() diff --git a/src/Features/Core/Portable/Diagnostics/DiagnosticModeExtensions.cs b/src/Features/Core/Portable/Diagnostics/DiagnosticModeExtensions.cs index 23ef50921674b..c614d5dc13531 100644 --- a/src/Features/Core/Portable/Diagnostics/DiagnosticModeExtensions.cs +++ b/src/Features/Core/Portable/Diagnostics/DiagnosticModeExtensions.cs @@ -9,24 +9,24 @@ namespace Microsoft.CodeAnalysis.Diagnostics { internal static class DiagnosticModeExtensions { - private static DiagnosticMode GetDiagnosticMode(Workspace workspace, Option2 option) + private static DiagnosticMode GetDiagnosticMode(IGlobalOptionService globalOptions, Option2 option) { - var diagnosticModeOption = workspace.Options.GetOption(option); + var diagnosticModeOption = globalOptions.GetOption(option); // If the workspace diagnostic mode is set to Default, defer to the feature flag service. if (diagnosticModeOption == DiagnosticMode.Default) { - return workspace.Options.GetOption(DiagnosticOptions.LspPullDiagnosticsFeatureFlag) ? DiagnosticMode.Pull : DiagnosticMode.Push; + return globalOptions.GetOption(DiagnosticOptions.LspPullDiagnosticsFeatureFlag) ? DiagnosticMode.Pull : DiagnosticMode.Push; } // Otherwise, defer to the workspace+option to determine what mode we're in. return diagnosticModeOption; } - public static bool IsPullDiagnostics(this Workspace workspace, Option2 option) - => GetDiagnosticMode(workspace, option) == DiagnosticMode.Pull; + public static bool IsPullDiagnostics(this IGlobalOptionService globalOptions, Option2 option) + => GetDiagnosticMode(globalOptions, option) == DiagnosticMode.Pull; - public static bool IsPushDiagnostics(this Workspace workspace, Option2 option) - => GetDiagnosticMode(workspace, option) == DiagnosticMode.Push; + public static bool IsPushDiagnostics(this IGlobalOptionService globalOptions, Option2 option) + => GetDiagnosticMode(globalOptions, option) == DiagnosticMode.Push; } } diff --git a/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs b/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs index 004eccd53f113..32f80575a8386 100644 --- a/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs +++ b/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs @@ -33,15 +33,19 @@ internal partial class DiagnosticService : IDiagnosticService private readonly Dictionary>> _map; private readonly EventListenerTracker _eventListenerTracker; + private readonly IGlobalOptionService _globalOptions; private ImmutableHashSet _updateSources; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public DiagnosticService( + IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable> eventListeners) { + _globalOptions = globalOptions; + // we use registry service rather than doing MEF import since MEF import method can have race issue where // update source gets created before aggregator - diagnostic service - is created and we will lose events fired before // the aggregator is created. @@ -233,7 +237,7 @@ private ValueTask> GetDiagnosticsAsync( { // If this is a pull client, but pull diagnostics is not on, then they get nothing. Similarly, if this is a // push client and pull diagnostics are on, they get nothing. - var isPull = workspace.IsPullDiagnostics(diagnosticMode); + var isPull = _globalOptions.IsPullDiagnostics(diagnosticMode); if (forPullDiagnostics != isPull) return new ValueTask>(ImmutableArray.Empty); @@ -329,7 +333,7 @@ private ImmutableArray GetDiagnosticBuckets( { // If this is a pull client, but pull diagnostics is not on, then they get nothing. Similarly, if this is a // push client and pull diagnostics are on, they get nothing. - var isPull = workspace.IsPullDiagnostics(diagnosticMode); + var isPull = _globalOptions.IsPullDiagnostics(diagnosticMode); if (forPullDiagnostics != isPull) return ImmutableArray.Empty; diff --git a/src/Features/Core/Portable/Diagnostics/DiagnosticsUpdatedArgs.cs b/src/Features/Core/Portable/Diagnostics/DiagnosticsUpdatedArgs.cs index 6f2ade52e87d2..be3427b79c513 100644 --- a/src/Features/Core/Portable/Diagnostics/DiagnosticsUpdatedArgs.cs +++ b/src/Features/Core/Portable/Diagnostics/DiagnosticsUpdatedArgs.cs @@ -51,10 +51,10 @@ public ImmutableArray GetAllDiagnosticsRegardlessOfPushPullSetti /// diagnostics in their scenario (or an empty array if not in their scenario). /// public ImmutableArray GetPullDiagnostics( - Workspace workspace, Option2 diagnosticMode) + IGlobalOptionService globalOptions, Option2 diagnosticMode) { // If push diagnostics are on, they get nothing since they're asking for pull diagnostics. - if (workspace.IsPushDiagnostics(diagnosticMode)) + if (globalOptions.IsPushDiagnostics(diagnosticMode)) return ImmutableArray.Empty; return _diagnostics; @@ -66,10 +66,10 @@ public ImmutableArray GetPullDiagnostics( /// diagnostics in their scenario (or an empty array if not in their scenario). /// public ImmutableArray GetPushDiagnostics( - Workspace workspace, Option2 diagnosticMode) + IGlobalOptionService globalOptions, Option2 diagnosticMode) { // If pull diagnostics are on, they get nothing since they're asking for push diagnostics. - if (workspace.IsPullDiagnostics(diagnosticMode)) + if (globalOptions.IsPullDiagnostics(diagnosticMode)) return ImmutableArray.Empty; return _diagnostics; diff --git a/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs b/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs index 2426d69ada019..1ca2a28bb498f 100644 --- a/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs +++ b/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs @@ -5,9 +5,8 @@ using System; using System.Composition; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; using StreamJsonRpc; namespace Microsoft.CodeAnalysis.LanguageServer @@ -19,14 +18,18 @@ internal class CSharpVisualBasicLanguageServerFactory : ILanguageServerFactory private readonly RequestDispatcherFactory _dispatcherFactory; private readonly IAsynchronousOperationListenerProvider _listenerProvider; + private readonly IGlobalOptionService _globalOptions; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpVisualBasicLanguageServerFactory(RequestDispatcherFactory dispatcherFactory, - IAsynchronousOperationListenerProvider listenerProvider) + public CSharpVisualBasicLanguageServerFactory( + RequestDispatcherFactory dispatcherFactory, + IAsynchronousOperationListenerProvider listenerProvider, + IGlobalOptionService globalOptions) { _dispatcherFactory = dispatcherFactory; _listenerProvider = listenerProvider; + _globalOptions = globalOptions; } public ILanguageServerTarget Create( @@ -40,6 +43,7 @@ public ILanguageServerTarget Create( jsonRpc, capabilitiesProvider, workspaceRegistrationService, + _globalOptions, _listenerProvider, logger, ProtocolConstants.RoslynLspLanguages, diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs index a78239fabe389..b42921af40084 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs @@ -29,6 +29,7 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler /// internal class CompletionHandler : IRequestHandler { + private readonly IGlobalOptionService _globalOptions; private readonly ImmutableHashSet _csharpTriggerCharacters; private readonly ImmutableHashSet _vbTriggerCharacters; @@ -40,9 +41,12 @@ internal class CompletionHandler : IRequestHandler true; public CompletionHandler( + IGlobalOptionService globalOptions, IEnumerable> completionProviders, CompletionListCache completionListCache) { + _globalOptions = globalOptions; + _csharpTriggerCharacters = completionProviders.Where(lz => lz.Metadata.Language == LanguageNames.CSharp).SelectMany( lz => GetTriggerCharacters(lz.Value)).ToImmutableHashSet(); _vbTriggerCharacters = completionProviders.Where(lz => lz.Metadata.Language == LanguageNames.VisualBasic).SelectMany( @@ -92,8 +96,8 @@ public CompletionHandler( // Feature flag to enable the return of TextEdits instead of InsertTexts (will increase payload size). // We check against the CompletionOption for test purposes only. Contract.ThrowIfNull(context.Solution); - var returnTextEdits = completionOptions.GetOption(LspOptions.LspCompletionFeatureFlag) || - completionOptions.GetOption(CompletionOptions.ForceRoslynLSPCompletionExperiment, document.Project.Language); + var returnTextEdits = _globalOptions.GetOption(LspOptions.LspCompletionFeatureFlag) || + _globalOptions.GetOption(CompletionOptions.ForceRoslynLSPCompletionExperiment, document.Project.Language); TextSpan? defaultSpan = null; LSP.Range? defaultRange = null; diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandlerProvider.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandlerProvider.cs index bc7b6820f1569..6faf4faf44ce1 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandlerProvider.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandlerProvider.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Completion.Providers; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler.Completion; +using Microsoft.CodeAnalysis.Options; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler @@ -20,12 +21,15 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler internal class CompletionHandlerProvider : AbstractRequestHandlerProvider { private readonly IEnumerable> _completionProviders; + private readonly IGlobalOptionService _globalOptions; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public CompletionHandlerProvider( + IGlobalOptionService globalOptions, [ImportMany] IEnumerable> completionProviders) { + _globalOptions = globalOptions; _completionProviders = completionProviders; } @@ -33,7 +37,7 @@ public override ImmutableArray CreateRequestHandlers() { var completionListCache = new CompletionListCache(); return ImmutableArray.Create( - new CompletionHandler(_completionProviders, completionListCache), + new CompletionHandler(_globalOptions, _completionProviders, completionListCache), new CompletionResolveHandler(completionListCache)); } } diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs index ae9335814e545..b304bd74bc59e 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs @@ -215,8 +215,7 @@ private async Task ComputeAndReportCurrentDiagnosticsAsync( ? InternalDiagnosticsOptions.RazorDiagnosticMode : InternalDiagnosticsOptions.NormalDiagnosticMode; - var workspace = document.Project.Solution.Workspace; - var isPull = workspace.IsPullDiagnostics(diagnosticMode); + var isPull = context.GlobalOptions.IsPullDiagnostics(diagnosticMode); context.TraceInformation($"Getting '{(isPull ? "pull" : "push")}' diagnostics with mode '{diagnosticMode}'"); diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index d4b2a287ef741..9420cea9455ee 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Collections; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -20,17 +21,75 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler /// internal readonly struct RequestContext { + /// + /// This will be null for non-mutating requests because they're not allowed to change documents + /// + private readonly IDocumentChangeTracker _documentChangeTracker; + + /// + /// The solution state that the request should operate on, if the handler requires an LSP solution, or otherwise + /// + public readonly Solution? Solution; + + /// + /// The client capabilities for the request. + /// + public readonly ClientCapabilities ClientCapabilities; + + /// + /// The LSP client making the request + /// + public readonly string? ClientName; + + /// + /// The document that the request is for, if applicable. This comes from the returned from the handler itself via a call to . + /// + public readonly Document? Document; + + /// + /// The languages supported by the server making the request. + /// + public readonly ImmutableArray SupportedLanguages; + + public readonly IGlobalOptionService GlobalOptions; + + /// + /// Tracing object that can be used to log information about the status of requests. + /// + private readonly Action _traceInformation; + + public RequestContext( + Solution? solution, + Action traceInformation, + ClientCapabilities clientCapabilities, + string? clientName, + Document? document, + IDocumentChangeTracker documentChangeTracker, + ImmutableArray supportedLanguages, + IGlobalOptionService globalOptions) + { + Document = document; + Solution = solution; + ClientCapabilities = clientCapabilities; + ClientName = clientName; + SupportedLanguages = supportedLanguages; + GlobalOptions = globalOptions; + _documentChangeTracker = documentChangeTracker; + _traceInformation = traceInformation; + } + public static RequestContext Create( bool requiresLSPSolution, TextDocumentIdentifier? textDocument, string? clientName, - ILspLogger _logger, + ILspLogger logger, RequestTelemetryLogger telemetryLogger, ClientCapabilities clientCapabilities, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, Dictionary? solutionCache, IDocumentChangeTracker? documentChangeTracker, ImmutableArray supportedLanguages, + IGlobalOptionService globalOptions, out Workspace workspace) { // Go through each registered workspace, find the solution that contains the document that @@ -44,14 +103,14 @@ public static RequestContext Create( // If we were given a document, find it in whichever workspace it exists in if (textDocument is null) { - _logger.TraceInformation("Request contained no text document identifier"); + logger.TraceInformation("Request contained no text document identifier"); } else { // There are multiple possible solutions that we could be interested in, so we need to find the document // first and then get the solution from there. If we're not given a document, this will return the default // solution - document = FindDocument(_logger, telemetryLogger, lspWorkspaceRegistrationService, textDocument, clientName); + document = FindDocument(logger, telemetryLogger, lspWorkspaceRegistrationService, textDocument, clientName); if (document is not null) { @@ -69,7 +128,7 @@ public static RequestContext Create( if (!requiresLSPSolution) { workspace = workspaceSolution.Workspace; - return new RequestContext(solution: null, _logger.TraceInformation, clientCapabilities, clientName, document: null, documentChangeTracker, supportedLanguages); + return new RequestContext(solution: null, logger.TraceInformation, clientCapabilities, clientName, document: null, documentChangeTracker, supportedLanguages, globalOptions); } var lspSolution = BuildLSPSolution(solutionCache, workspaceSolution, documentChangeTracker); @@ -82,7 +141,7 @@ public static RequestContext Create( } workspace = lspSolution.Workspace; - return new RequestContext(lspSolution, _logger.TraceInformation, clientCapabilities, clientName, document, documentChangeTracker, supportedLanguages); + return new RequestContext(lspSolution, logger.TraceInformation, clientCapabilities, clientName, document, documentChangeTracker, supportedLanguages, globalOptions); } private static Document? FindDocument( @@ -165,59 +224,6 @@ private static Solution GetSolutionWithReplacedDocuments(Solution solution, IDoc return solution; } - /// - /// This will be null for non-mutating requests because they're not allowed to change documents - /// - private readonly IDocumentChangeTracker _documentChangeTracker; - - /// - /// The solution state that the request should operate on, if the handler requires an LSP solution, or otherwise - /// - public readonly Solution? Solution; - - /// - /// The client capabilities for the request. - /// - public readonly ClientCapabilities ClientCapabilities; - - /// - /// The LSP client making the request - /// - public readonly string? ClientName; - - /// - /// The document that the request is for, if applicable. This comes from the returned from the handler itself via a call to . - /// - public readonly Document? Document; - - /// - /// The languages supported by the server making the request. - /// - public readonly ImmutableArray SupportedLanguages; - - /// - /// Tracing object that can be used to log information about the status of requests. - /// - private readonly Action _traceInformation; - - public RequestContext( - Solution? solution, - Action traceInformation, - ClientCapabilities clientCapabilities, - string? clientName, - Document? document, - IDocumentChangeTracker documentChangeTracker, - ImmutableArray supportedLanguages) - { - Document = document; - Solution = solution; - ClientCapabilities = clientCapabilities; - ClientName = clientName; - SupportedLanguages = supportedLanguages; - _documentChangeTracker = documentChangeTracker; - _traceInformation = traceInformation; - } - /// /// Allows a mutating request to open a document and start it being tracked. /// diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs index 0068a6dc1232f..afde72b4b77fc 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs @@ -13,6 +13,7 @@ using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { @@ -58,6 +59,7 @@ internal partial class RequestExecutionQueue private readonly CancellationTokenSource _cancelSource; private readonly DocumentChangeTracker _documentChangeTracker; private readonly RequestTelemetryLogger _requestTelemetryLogger; + private readonly IGlobalOptionService _globalOptions; // This dictionary is used to cache our forked LSP solution so we don't have to // recompute it for each request. We don't need to worry about threading because they are only @@ -82,12 +84,14 @@ internal partial class RequestExecutionQueue public RequestExecutionQueue( ILspLogger logger, ILspWorkspaceRegistrationService workspaceRegistrationService, + IGlobalOptionService globalOptions, ImmutableArray supportedLanguages, string serverName, string serverTypeName) { _logger = logger; _workspaceRegistrationService = workspaceRegistrationService; + _globalOptions = globalOptions; _supportedLanguages = supportedLanguages; _serverName = serverName; @@ -300,6 +304,7 @@ private RequestContext CreateRequestContext(QueueItem queueItem, out Workspace w _lspSolutionCache, trackerToUse, _supportedLanguages, + _globalOptions, out workspace); } } diff --git a/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs b/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs index 4065792857894..59357a8bcf060 100644 --- a/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs +++ b/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Protocol; using Roslyn.Utilities; @@ -21,6 +22,7 @@ internal class LanguageServerTarget : ILanguageServerTarget { private readonly ICapabilitiesProvider _capabilitiesProvider; + protected readonly IGlobalOptionService GlobalOptions; protected readonly JsonRpc JsonRpc; protected readonly RequestDispatcher RequestDispatcher; protected readonly RequestExecutionQueue Queue; @@ -53,6 +55,7 @@ internal LanguageServerTarget( JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, ILspWorkspaceRegistrationService workspaceRegistrationService, + IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, ImmutableArray supportedLanguages, @@ -60,6 +63,7 @@ internal LanguageServerTarget( string userVisibleServerName, string telemetryServerTypeName) { + GlobalOptions = globalOptions; RequestDispatcher = requestDispatcherFactory.CreateRequestDispatcher(supportedLanguages); _capabilitiesProvider = capabilitiesProvider; @@ -76,7 +80,7 @@ internal LanguageServerTarget( _userVisibleServerName = userVisibleServerName; TelemetryServerName = telemetryServerTypeName; - Queue = new RequestExecutionQueue(logger, workspaceRegistrationService, supportedLanguages, userVisibleServerName, TelemetryServerName); + Queue = new RequestExecutionQueue(logger, workspaceRegistrationService, globalOptions, supportedLanguages, userVisibleServerName, TelemetryServerName); Queue.RequestServerShutdown += RequestExecutionQueue_Errored; } diff --git a/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs index 8db45ee261a86..31889e1a6c030 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs @@ -10,6 +10,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -75,10 +76,11 @@ private LanguageServerTarget CreateLanguageServer(out JsonRpc serverJsonRpc, out using var workspace = TestWorkspace.CreateCSharp("", composition: Composition); var (_, serverStream) = FullDuplexStream.CreatePair(); - var dispatcherFactory = workspace.ExportProvider.GetExportedValue(); - var lspWorkspaceRegistrationService = workspace.ExportProvider.GetExportedValue(); - var capabilitiesProvider = workspace.ExportProvider.GetExportedValue(); - listenerProvider = workspace.ExportProvider.GetExportedValue(); + var dispatcherFactory = workspace.GetService(); + var lspWorkspaceRegistrationService = workspace.GetService(); + var capabilitiesProvider = workspace.GetService(); + var globalOptions = workspace.GetService(); + listenerProvider = workspace.GetService(); serverJsonRpc = new JsonRpc(new HeaderDelimitedMessageHandler(serverStream, serverStream)) { @@ -90,6 +92,7 @@ private LanguageServerTarget CreateLanguageServer(out JsonRpc serverJsonRpc, out serverJsonRpc, capabilitiesProvider, lspWorkspaceRegistrationService, + globalOptions, listenerProvider, NoOpLspLogger.Instance, ProtocolConstants.RoslynLspLanguages, diff --git a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyDetail.cs b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyDetail.cs index 9ff27de639830..3d733d228c774 100644 --- a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyDetail.cs +++ b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyDetail.cs @@ -60,13 +60,14 @@ private string ComputeText(Location location) public void NavigateTo() { - var document = _workspace.CurrentSolution.GetDocument(_documentId); + var solution = _workspace.CurrentSolution; + var document = solution.GetDocument(_documentId); if (document != null) { var navigator = _workspace.Services.GetService(); - var options = _workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true) - .WithChangedOption(NavigationOptions.ActivateTab, false); + var options = solution.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true) + .WithChangedOption(NavigationOptions.ActivateTab, false); // TODO: Get the platform to use and pass us an operation context, or create one ourselves. navigator.TryNavigateToSpan(_workspace, document.Id, _span, options, CancellationToken.None); } diff --git a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs index 5639615248534..c4fb2a8706330 100644 --- a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs @@ -139,7 +139,7 @@ public void NavigateTo(SymbolKey id, Project project, CancellationToken cancella var compilation = project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken); var resolution = id.Resolve(compilation, cancellationToken: cancellationToken); var workspace = project.Solution.Workspace; - var options = workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true); + var options = project.Solution.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true); var symbolNavigationService = workspace.Services.GetService(); symbolNavigationService.TryNavigateToSymbol(resolution.Symbol, project, options, cancellationToken); diff --git a/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.Settings.cs b/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.Settings.cs index 5b86843c69ef5..00dc1fdff7f10 100644 --- a/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.Settings.cs +++ b/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.Settings.cs @@ -24,12 +24,12 @@ private class ColorSchemeSettings private const string AppliedColorSchemeName = "AppliedColorScheme"; private readonly IServiceProvider _serviceProvider; - private readonly VisualStudioWorkspace _workspace; + private readonly IGlobalOptionService _globalOptions; - public ColorSchemeSettings(IServiceProvider serviceProvider, VisualStudioWorkspace visualStudioWorkspace) + public ColorSchemeSettings(IServiceProvider serviceProvider, IGlobalOptionService globalOptions) { _serviceProvider = serviceProvider; - _workspace = visualStudioWorkspace; + _globalOptions = globalOptions; } public ImmutableDictionary GetColorSchemes() @@ -100,7 +100,7 @@ private void SetAppliedColorScheme(SchemeName schemeName) public SchemeName GetConfiguredColorScheme() { - var schemeName = _workspace.Options.GetOption(ColorSchemeOptions.ColorScheme); + var schemeName = _globalOptions.GetOption(ColorSchemeOptions.ColorScheme); return schemeName != SchemeName.None ? schemeName : ColorSchemeOptions.ColorScheme.DefaultValue; @@ -109,7 +109,7 @@ public SchemeName GetConfiguredColorScheme() public void MigrateToColorSchemeSetting() { // Get the preview feature flag value. - var useEnhancedColorsSetting = _workspace.Options.GetOption(ColorSchemeOptions.LegacyUseEnhancedColors); + var useEnhancedColorsSetting = _globalOptions.GetOption(ColorSchemeOptions.LegacyUseEnhancedColors); // Return if we have already migrated. if (useEnhancedColorsSetting == ColorSchemeOptions.UseEnhancedColors.Migrated) @@ -121,8 +121,8 @@ public void MigrateToColorSchemeSetting() ? SchemeName.VisualStudio2017 : SchemeName.VisualStudio2019; - _workspace.SetOptions(_workspace.Options.WithChangedOption(ColorSchemeOptions.ColorScheme, colorScheme)); - _workspace.SetOptions(_workspace.Options.WithChangedOption(ColorSchemeOptions.LegacyUseEnhancedColors, ColorSchemeOptions.UseEnhancedColors.Migrated)); + _globalOptions.SetGlobalOption(new OptionKey(ColorSchemeOptions.ColorScheme), colorScheme); + _globalOptions.SetGlobalOption(new OptionKey(ColorSchemeOptions.LegacyUseEnhancedColors), ColorSchemeOptions.UseEnhancedColors.Migrated); } } } diff --git a/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs b/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs index 5a1962bbd8acb..2f39276be942e 100644 --- a/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs +++ b/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.Editor.Options; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.PlatformUI; using Microsoft.VisualStudio.Settings; using Microsoft.VisualStudio.Shell; @@ -44,13 +45,13 @@ internal sealed partial class ColorSchemeApplier : ForegroundThreadAffinitizedOb [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ColorSchemeApplier( IThreadingContext threadingContext, - VisualStudioWorkspace visualStudioWorkspace, + IGlobalOptionService globalOptions, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) : base(threadingContext) { _serviceProvider = serviceProvider; - _settings = new ColorSchemeSettings(_serviceProvider, visualStudioWorkspace); + _settings = new ColorSchemeSettings(_serviceProvider, globalOptions); _colorSchemes = _settings.GetColorSchemes(); _classificationVerifier = new ClassificationVerifier(threadingContext, serviceProvider, _colorSchemes); diff --git a/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DocumentSpanEntry.cs b/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DocumentSpanEntry.cs index c8d8240113c86..35a129100e4bb 100644 --- a/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DocumentSpanEntry.cs +++ b/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DocumentSpanEntry.cs @@ -301,14 +301,15 @@ public Task NavigateToAsync(bool isPreview, CancellationToken cancellationToken) // this is because the file path given to the table control isn't a real file path to a file // on disk. - var workspace = _excerptResult.Document.Project.Solution.Workspace; + var solution = _excerptResult.Document.Project.Solution; + var workspace = solution.Workspace; var documentNavigationService = workspace.Services.GetRequiredService(); return documentNavigationService.TryNavigateToSpanAsync( workspace, _excerptResult.Document.Id, _excerptResult.Span, - workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, isPreview), + solution.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, isPreview), cancellationToken); } } diff --git a/src/VisualStudio/Core/Def/Implementation/KeybindingReset/KeybindingResetDetector.cs b/src/VisualStudio/Core/Def/Implementation/KeybindingReset/KeybindingResetDetector.cs index 60cd3fa30e93f..4b0b0e6a11806 100644 --- a/src/VisualStudio/Core/Def/Implementation/KeybindingReset/KeybindingResetDetector.cs +++ b/src/VisualStudio/Core/Def/Implementation/KeybindingReset/KeybindingResetDetector.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Immutable; using System.ComponentModel.Composition; -using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/AbstractInProcLanguageClient.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/AbstractInProcLanguageClient.cs index 58afd2eb47799..1c55658db00ec 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/AbstractInProcLanguageClient.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/AbstractInProcLanguageClient.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -36,7 +37,7 @@ internal abstract partial class AbstractInProcLanguageClient : ILanguageClient, private readonly AbstractRequestDispatcherFactory _requestDispatcherFactory; private readonly ILspWorkspaceRegistrationService _lspWorkspaceRegistrationService; - protected readonly Workspace Workspace; + protected readonly IGlobalOptionService GlobalOptions; /// /// Created when is called. @@ -81,7 +82,7 @@ public event AsyncEventHandler? StopAsync { add { } remove { } } public AbstractInProcLanguageClient( AbstractRequestDispatcherFactory requestDispatcherFactory, - VisualStudioWorkspace workspace, + IGlobalOptionService globalOptions, IDiagnosticService? diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, @@ -90,7 +91,7 @@ public AbstractInProcLanguageClient( string? diagnosticsClientName) { _requestDispatcherFactory = requestDispatcherFactory; - Workspace = workspace; + GlobalOptions = globalOptions; _diagnosticService = diagnosticService; _listenerProvider = listenerProvider; _lspWorkspaceRegistrationService = lspWorkspaceRegistrationService; @@ -208,6 +209,7 @@ public ILanguageServerTarget Create( jsonRpc, capabilitiesProvider, workspaceRegistrationService, + GlobalOptions, _listenerProvider, logger, _diagnosticService, diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/AlwaysActivateInProcLanguageClient.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/AlwaysActivateInProcLanguageClient.cs index 038d1724f4d6f..72d38c541276d 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/AlwaysActivateInProcLanguageClient.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/AlwaysActivateInProcLanguageClient.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -35,13 +36,13 @@ internal class AlwaysActivateInProcLanguageClient : AbstractInProcLanguageClient [Obsolete(MefConstruction.ImportingConstructorMessage, true)] public AlwaysActivateInProcLanguageClient( RequestDispatcherFactory csharpVBRequestDispatcherFactory, - VisualStudioWorkspace workspace, + IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, DefaultCapabilitiesProvider defaultCapabilitiesProvider, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(csharpVBRequestDispatcherFactory, workspace, diagnosticService: null, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(csharpVBRequestDispatcherFactory, globalOptions, diagnosticService: null, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; } @@ -55,7 +56,7 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa var serverCapabilities = new VSInternalServerCapabilities(); // If the LSP editor feature flag is enabled advertise support for LSP features here so they are available locally and remote. - var isLspEditorEnabled = Workspace.Options.GetOption(LspOptions.LspEditorFeatureFlag); + var isLspEditorEnabled = GlobalOptions.GetOption(LspOptions.LspEditorFeatureFlag); if (isLspEditorEnabled) { serverCapabilities = (VSInternalServerCapabilities)_defaultCapabilitiesProvider.GetCapabilities(clientCapabilities); @@ -70,7 +71,7 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa }; } - serverCapabilities.SupportsDiagnosticRequests = Workspace.IsPullDiagnostics(InternalDiagnosticsOptions.NormalDiagnosticMode); + serverCapabilities.SupportsDiagnosticRequests = GlobalOptions.IsPullDiagnostics(InternalDiagnosticsOptions.NormalDiagnosticMode); // This capability is always enabled as we provide cntrl+Q VS search only via LSP in ever scenario. serverCapabilities.WorkspaceSymbolProvider = true; @@ -88,6 +89,6 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa /// they will get no diagnostics. When not enabled we don't show the failure box (failure will still be recorded in the task status center) /// as the failure is not catastrophic. /// - public override bool ShowNotificationOnInitializeFailed => Workspace.IsPullDiagnostics(InternalDiagnosticsOptions.NormalDiagnosticMode); + public override bool ShowNotificationOnInitializeFailed => GlobalOptions.IsPullDiagnostics(InternalDiagnosticsOptions.NormalDiagnosticMode); } } diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/LiveShareInProcLanguageClient.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/LiveShareInProcLanguageClient.cs index 94fbc390d2e82..2d0507f74c6d2 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/LiveShareInProcLanguageClient.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/LiveShareInProcLanguageClient.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -31,14 +32,14 @@ internal class LiveShareInProcLanguageClient : AbstractInProcLanguageClient [Obsolete(MefConstruction.ImportingConstructorMessage, true)] public LiveShareInProcLanguageClient( RequestDispatcherFactory csharpVBRequestDispatcherFactory, - VisualStudioWorkspace workspace, + IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, DefaultCapabilitiesProvider defaultCapabilitiesProvider, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(csharpVBRequestDispatcherFactory, workspace, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(csharpVBRequestDispatcherFactory, globalOptions, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; } @@ -49,7 +50,7 @@ public LiveShareInProcLanguageClient( public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) { - var isLspEditorEnabled = Workspace.Options.GetOption(LspOptions.LspEditorFeatureFlag); + var isLspEditorEnabled = GlobalOptions.GetOption(LspOptions.LspEditorFeatureFlag); // If the preview feature flag to turn on the LSP editor in local scenarios is on, advertise no capabilities for this Live Share // LSP server as LSP requests will be serviced by the AlwaysActiveInProcLanguageClient in both local and remote scenarios. diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/RazorInProcLanguageClient.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/RazorInProcLanguageClient.cs index 5460e04746416..35fe2bcc6d701 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/RazorInProcLanguageClient.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/RazorInProcLanguageClient.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -54,14 +55,14 @@ internal class RazorInProcLanguageClient : AbstractInProcLanguageClient [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RazorInProcLanguageClient( RequestDispatcherFactory csharpVBRequestDispatcherFactory, - VisualStudioWorkspace workspace, + IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, DefaultCapabilitiesProvider defaultCapabilitiesProvider, IThreadingContext threadingContext, ILspLoggerFactory lspLoggerFactory) - : base(csharpVBRequestDispatcherFactory, workspace, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, ClientName) + : base(csharpVBRequestDispatcherFactory, globalOptions, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, ClientName) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; } @@ -75,7 +76,7 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa if (capabilities is VSInternalServerCapabilities vsServerCapabilities) { - vsServerCapabilities.SupportsDiagnosticRequests = this.Workspace.IsPullDiagnostics(InternalDiagnosticsOptions.RazorDiagnosticMode); + vsServerCapabilities.SupportsDiagnosticRequests = GlobalOptions.IsPullDiagnostics(InternalDiagnosticsOptions.RazorDiagnosticMode); return vsServerCapabilities; } diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/VisualStudioInProcLanguageServer.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/VisualStudioInProcLanguageServer.cs index f9c0a10cd5bfb..df5b4bbdd37aa 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/VisualStudioInProcLanguageServer.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/VisualStudioInProcLanguageServer.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -41,6 +42,7 @@ internal VisualStudioInProcLanguageServer( JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, ILspWorkspaceRegistrationService workspaceRegistrationService, + IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, IDiagnosticService? diagnosticService, @@ -48,9 +50,10 @@ internal VisualStudioInProcLanguageServer( string? clientName, string userVisibleServerName, string telemetryServerTypeName) - : base(requestDispatcherFactory, jsonRpc, capabilitiesProvider, workspaceRegistrationService, listenerProvider, logger, supportedLanguages, clientName, userVisibleServerName, telemetryServerTypeName) + : base(requestDispatcherFactory, jsonRpc, capabilitiesProvider, workspaceRegistrationService, globalOptions, listenerProvider, logger, supportedLanguages, clientName, userVisibleServerName, telemetryServerTypeName) { _diagnosticService = diagnosticService; + // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue( TimeSpan.FromMilliseconds(250), @@ -215,7 +218,7 @@ internal async ValueTask ProcessDiagnosticUpdatedBatchAsync( var diagnosticMode = document.IsRazorDocument() ? InternalDiagnosticsOptions.RazorDiagnosticMode : InternalDiagnosticsOptions.NormalDiagnosticMode; - if (document.Project.Solution.Workspace.IsPushDiagnostics(diagnosticMode)) + if (GlobalOptions.IsPushDiagnostics(diagnosticMode)) await PublishDiagnosticsAsync(diagnosticService, document, cancellationToken).ConfigureAwait(false); } } diff --git a/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs b/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs index 4b7f2a63c4c71..280ed5877add2 100644 --- a/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Shell; @@ -29,6 +30,7 @@ internal sealed class Factory : IWorkspaceServiceFactory private readonly IAsyncServiceProvider _vsServiceProvider; private readonly AsynchronousOperationListenerProvider _listenerProvider; private readonly RemoteServiceCallbackDispatcherRegistry _callbackDispatchers; + private readonly IGlobalOptionService _globalOptions; private readonly IThreadingContext _threadingContext; [ImportingConstructor] @@ -36,10 +38,12 @@ internal sealed class Factory : IWorkspaceServiceFactory public Factory( SVsServiceProvider vsServiceProvider, AsynchronousOperationListenerProvider listenerProvider, + IGlobalOptionService globalOptions, IThreadingContext threadingContext, [ImportMany] IEnumerable> callbackDispatchers) { _vsServiceProvider = (IAsyncServiceProvider)vsServiceProvider; + _globalOptions = globalOptions; _listenerProvider = listenerProvider; _threadingContext = threadingContext; _callbackDispatchers = new RemoteServiceCallbackDispatcherRegistry(callbackDispatchers); @@ -50,7 +54,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { // We don't want to bring up the OOP process in a VS cloud environment client instance // Avoids proffering brokered services on the client instance. - if (!RemoteHostOptions.IsUsingServiceHubOutOfProcess(workspaceServices) || + if (!RemoteHostOptions.IsUsingServiceHubOutOfProcess(_globalOptions) || workspaceServices.Workspace is not VisualStudioWorkspace || workspaceServices.GetRequiredService().IsCloudEnvironmentClient()) { @@ -58,11 +62,12 @@ workspaceServices.Workspace is not VisualStudioWorkspace || return new DefaultRemoteHostClientProvider(); } - return new VisualStudioRemoteHostClientProvider(workspaceServices, _vsServiceProvider, _threadingContext, _listenerProvider, _callbackDispatchers); + return new VisualStudioRemoteHostClientProvider(workspaceServices, _globalOptions, _vsServiceProvider, _threadingContext, _listenerProvider, _callbackDispatchers); } } private readonly HostWorkspaceServices _services; + private readonly IGlobalOptionService _globalOptions; private readonly VSThreading.AsyncLazy _lazyClient; private readonly IAsyncServiceProvider _vsServiceProvider; private readonly AsynchronousOperationListenerProvider _listenerProvider; @@ -70,12 +75,14 @@ workspaceServices.Workspace is not VisualStudioWorkspace || private VisualStudioRemoteHostClientProvider( HostWorkspaceServices services, + IGlobalOptionService globalOptions, IAsyncServiceProvider vsServiceProvider, IThreadingContext threadingContext, AsynchronousOperationListenerProvider listenerProvider, RemoteServiceCallbackDispatcherRegistry callbackDispatchers) { _services = services; + _globalOptions = globalOptions; _vsServiceProvider = vsServiceProvider; _listenerProvider = listenerProvider; _callbackDispatchers = callbackDispatchers; @@ -93,7 +100,7 @@ private VisualStudioRemoteHostClientProvider( var serviceBroker = brokeredServiceContainer.GetFullAccessServiceBroker(); // VS AsyncLazy does not currently support cancellation: - var client = await ServiceHubRemoteHostClient.CreateAsync(_services, _listenerProvider, serviceBroker, _callbackDispatchers, CancellationToken.None).ConfigureAwait(false); + var client = await ServiceHubRemoteHostClient.CreateAsync(_services, _globalOptions, _listenerProvider, serviceBroker, _callbackDispatchers, CancellationToken.None).ConfigureAwait(false); // proffer in-proc brokered services: _ = brokeredServiceContainer.Proffer(SolutionAssetProvider.ServiceDescriptor, (_, _, _, _) => ValueTaskFactory.FromResult(new SolutionAssetProvider(_services))); diff --git a/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioWorkspaceServiceHubConnector.cs b/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioWorkspaceServiceHubConnector.cs index eaaec5b1d0489..5d37cb41b66a4 100644 --- a/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioWorkspaceServiceHubConnector.cs +++ b/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioWorkspaceServiceHubConnector.cs @@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; @@ -23,6 +24,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Remote internal sealed class VisualStudioWorkspaceServiceHubConnector : IEventListener, IEventListenerStoppable { private readonly IAsynchronousOperationListenerProvider _listenerProvider; + private readonly IGlobalOptionService _globalOptions; private GlobalNotificationRemoteDeliveryService? _globalNotificationDelivery; private Task? _remoteClientInitializationTask; @@ -33,21 +35,24 @@ internal sealed class VisualStudioWorkspaceServiceHubConnector : IEventListener< [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public VisualStudioWorkspaceServiceHubConnector(IAsynchronousOperationListenerProvider listenerProvider) + public VisualStudioWorkspaceServiceHubConnector( + IGlobalOptionService globalOptions, + IAsynchronousOperationListenerProvider listenerProvider) { _listenerProvider = listenerProvider; + _globalOptions = globalOptions; _disposalCancellationSource = new CancellationTokenSource(); } public void StartListening(Workspace workspace, object serviceOpt) { - if (!(workspace is VisualStudioWorkspace) || IVsShellExtensions.IsInCommandLineMode) + if (workspace is not VisualStudioWorkspace || IVsShellExtensions.IsInCommandLineMode) { return; } // only push solution snapshot from primary (VS) workspace: - _checksumUpdater = new SolutionChecksumUpdater(workspace, _listenerProvider, _disposalCancellationSource.Token); + _checksumUpdater = new SolutionChecksumUpdater(workspace, _globalOptions, _listenerProvider, _disposalCancellationSource.Token); _globalNotificationDelivery = new GlobalNotificationRemoteDeliveryService(workspace.Services, _disposalCancellationSource.Token); diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/AbstractTableEntriesSnapshot.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/AbstractTableEntriesSnapshot.cs index 571a6c22a2773..2ebb4f04e88cc 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/AbstractTableEntriesSnapshot.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/AbstractTableEntriesSnapshot.cs @@ -156,8 +156,9 @@ protected static bool TryNavigateTo(Workspace workspace, DocumentId documentId, return false; } - var options = workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, previewTab) - .WithChangedOption(NavigationOptions.ActivateTab, activate); + var solution = workspace.CurrentSolution; + var options = solution.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, previewTab) + .WithChangedOption(NavigationOptions.ActivateTab, activate); return navigationService.TryNavigateToLineAndOffset(workspace, documentId, position.Line, position.Character, options, cancellationToken); } diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/MiscellaneousDiagnosticListTable.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/MiscellaneousDiagnosticListTable.cs index 18e29d1645198..a5d8400ed12af 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/MiscellaneousDiagnosticListTable.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/MiscellaneousDiagnosticListTable.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.Shell.TableManager; namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource @@ -21,23 +22,29 @@ internal sealed class MiscellaneousDiagnosticListTableWorkspaceEventListener : I internal const string IdentifierString = nameof(MiscellaneousDiagnosticListTable); private readonly ITableManagerProvider _tableManagerProvider; + private readonly IGlobalOptionService _globalOptions; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public MiscellaneousDiagnosticListTableWorkspaceEventListener(ITableManagerProvider tableManagerProvider) - => _tableManagerProvider = tableManagerProvider; + public MiscellaneousDiagnosticListTableWorkspaceEventListener( + ITableManagerProvider tableManagerProvider, + IGlobalOptionService globalOptions) + { + _tableManagerProvider = tableManagerProvider; + _globalOptions = globalOptions; + } public void StartListening(Workspace workspace, IDiagnosticService diagnosticService) - => new MiscellaneousDiagnosticListTable(workspace, diagnosticService, _tableManagerProvider); + => new MiscellaneousDiagnosticListTable(workspace, _globalOptions, diagnosticService, _tableManagerProvider); private sealed class MiscellaneousDiagnosticListTable : VisualStudioBaseDiagnosticListTable { private readonly LiveTableDataSource _source; - public MiscellaneousDiagnosticListTable(Workspace workspace, IDiagnosticService diagnosticService, ITableManagerProvider provider) + public MiscellaneousDiagnosticListTable(Workspace workspace, IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, ITableManagerProvider provider) : base(workspace, provider) { - _source = new LiveTableDataSource(workspace, diagnosticService, IdentifierString); + _source = new LiveTableDataSource(workspace, globalOptions, diagnosticService, IdentifierString); AddInitialTableSource(workspace.CurrentSolution, _source); ConnectWorkspaceEvents(); diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs index 400c299288b9b..c889e3fca7a4e 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs @@ -17,9 +17,9 @@ using Microsoft.CodeAnalysis.Editor.Shared; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; +using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList; -using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Microsoft.VisualStudio.Shell.TableControl; using Microsoft.VisualStudio.Shell.TableManager; using Microsoft.VisualStudio.Text; @@ -39,6 +39,7 @@ protected class LiveTableDataSource : AbstractRoslynTableDataSource _tracker; /// @@ -48,10 +49,11 @@ protected class LiveTableDataSource : AbstractRoslynTableDataSource private bool _isBuildRunning; - public LiveTableDataSource(Workspace workspace, IDiagnosticService diagnosticService, string identifier, ExternalErrorDiagnosticUpdateSource? buildUpdateSource = null) + public LiveTableDataSource(Workspace workspace, IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, string identifier, ExternalErrorDiagnosticUpdateSource? buildUpdateSource = null) : base(workspace) { _workspace = workspace; + _globalOptions = globalOptions; _identifier = identifier; _tracker = new OpenDocumentTracker(_workspace); @@ -176,14 +178,14 @@ private void PopulateInitialData(Workspace workspace, IDiagnosticService diagnos private void OnDiagnosticsUpdated(object sender, DiagnosticsUpdatedArgs e) { - using (Logger.LogBlock(FunctionId.LiveTableDataSource_OnDiagnosticsUpdated, a => GetDiagnosticUpdatedMessage(_workspace, a), e, CancellationToken.None)) + using (Logger.LogBlock(FunctionId.LiveTableDataSource_OnDiagnosticsUpdated, a => GetDiagnosticUpdatedMessage(_globalOptions, a), e, CancellationToken.None)) { if (_workspace != e.Workspace) { return; } - var diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = e.GetPushDiagnostics(_globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); if (diagnostics.Length == 0) { OnDataRemoved(e); @@ -570,19 +572,19 @@ public bool TryCreateStringContent(int index, string columnName, bool singleColu #endregion } - private static string GetDiagnosticUpdatedMessage(Workspace workspace, DiagnosticsUpdatedArgs e) + private static string GetDiagnosticUpdatedMessage(IGlobalOptionService globalOptions, DiagnosticsUpdatedArgs e) { var id = e.Id.ToString(); if (e.Id is LiveDiagnosticUpdateArgsId live) { - id = $"{live.Analyzer.ToString()}/{live.Kind}"; + id = $"{live.Analyzer}/{live.Kind}"; } else if (e.Id is AnalyzerUpdateArgsId analyzer) { id = analyzer.Analyzer.ToString(); } - var diagnostics = e.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode); + var diagnostics = e.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode); return $"Kind:{e.Workspace.Kind}, Analyzer:{id}, Update:{e.Kind}, {(object?)e.DocumentId ?? e.ProjectId}, ({string.Join(Environment.NewLine, diagnostics)})"; } } diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioDiagnosticListTable.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioDiagnosticListTable.cs index 1ff234ca8b85c..51851e2409307 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioDiagnosticListTable.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioDiagnosticListTable.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList; using Microsoft.VisualStudio.Shell; @@ -26,21 +27,24 @@ internal partial class VisualStudioDiagnosticListTableWorkspaceEventListener : I { internal const string IdentifierString = nameof(VisualStudioDiagnosticListTable); - private readonly Shell.IAsyncServiceProvider _asyncServiceProvider; + private readonly IAsyncServiceProvider _asyncServiceProvider; private readonly IThreadingContext _threadingContext; private readonly ITableManagerProvider _tableManagerProvider; + private readonly IGlobalOptionService _globalOptions; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioDiagnosticListTableWorkspaceEventListener( [Import("Microsoft.VisualStudio.Shell.Interop.SAsyncServiceProvider")] object asyncServiceProvider, + IGlobalOptionService globalOptions, IThreadingContext threadingContext, ITableManagerProvider tableManagerProvider) { // MEFv2 doesn't support type based contract for Import above and for this particular contract (SAsyncServiceProvider) // actual type cast doesn't work. (https://github.com/microsoft/vs-mef/issues/138) // workaround by getting the service as object and cast to actual interface - _asyncServiceProvider = (Shell.IAsyncServiceProvider)asyncServiceProvider; + _asyncServiceProvider = (IAsyncServiceProvider)asyncServiceProvider; + _globalOptions = globalOptions; _threadingContext = threadingContext; _tableManagerProvider = tableManagerProvider; } @@ -63,6 +67,7 @@ public void StartListening(Workspace workspace, IDiagnosticService diagnosticSer var table = new VisualStudioDiagnosticListTable( (VisualStudioWorkspaceImpl)workspace, + _globalOptions, diagnosticService, _tableManagerProvider, errorList); @@ -77,6 +82,7 @@ internal partial class VisualStudioDiagnosticListTable : VisualStudioBaseDiagnos public VisualStudioDiagnosticListTable( VisualStudioWorkspaceImpl workspace, + IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, ITableManagerProvider provider, IErrorList errorList) @@ -84,7 +90,7 @@ public VisualStudioDiagnosticListTable( { _errorList = errorList; - _liveTableSource = new LiveTableDataSource(workspace, diagnosticService, IdentifierString, workspace.ExternalErrorDiagnosticUpdateSource); + _liveTableSource = new LiveTableDataSource(workspace, globalOptions, diagnosticService, IdentifierString, workspace.ExternalErrorDiagnosticUpdateSource); _buildTableSource = new BuildTableDataSource(workspace, workspace.ExternalErrorDiagnosticUpdateSource); AddInitialTableSource(Workspace.CurrentSolution, GetCurrentDataSource()); @@ -104,10 +110,10 @@ private ITableDataSource GetCurrentDataSource() } /// this is for test only - internal VisualStudioDiagnosticListTable(Workspace workspace, IDiagnosticService diagnosticService, ITableManagerProvider provider) + internal VisualStudioDiagnosticListTable(Workspace workspace, IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, ITableManagerProvider provider) : base(workspace, provider) { - AddInitialTableSource(workspace.CurrentSolution, new LiveTableDataSource(workspace, diagnosticService, IdentifierString)); + AddInitialTableSource(workspace.CurrentSolution, new LiveTableDataSource(workspace, globalOptions, diagnosticService, IdentifierString)); } /// this is for test only diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs index 754dc3b3fd7da..8e69f8a199f03 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs @@ -45,6 +45,7 @@ internal sealed class SourceGeneratedFileManager : IRunningDocumentTableEventLis private readonly IVsRunningDocumentTable _runningDocumentTable; private readonly ITextDocumentFactoryService _textDocumentFactoryService; private readonly VisualStudioDocumentNavigationService _visualStudioDocumentNavigationService; + private readonly IGlobalOptionService _globalOptions; #pragma warning disable IDE0052 // Remove unread private members private readonly RunningDocumentTableEventTracker _runningDocumentTableEventTracker; @@ -79,6 +80,7 @@ public SourceGeneratedFileManager( IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextDocumentFactoryService textDocumentFactoryService, VisualStudioWorkspace visualStudioWorkspace, + IGlobalOptionService globalOptions, VisualStudioDocumentNavigationService visualStudioDocumentNavigationService, IAsynchronousOperationListenerProvider listenerProvider) { @@ -89,6 +91,7 @@ public SourceGeneratedFileManager( _temporaryDirectory = Path.Combine(Path.GetTempPath(), "VSGeneratedDocuments"); _visualStudioWorkspace = visualStudioWorkspace; _visualStudioDocumentNavigationService = visualStudioDocumentNavigationService; + _globalOptions = globalOptions; Directory.CreateDirectory(_temporaryDirectory); @@ -181,7 +184,7 @@ void IRunningDocumentTableEventListener.OnOpenDocument(string moniker, ITextBuff // Attach to the text buffer if we haven't already if (!_openFiles.TryGetValue(moniker, out var openFile)) { - openFile = new OpenSourceGeneratedFile(this, textBuffer, _visualStudioWorkspace, documentIdentity, _threadingContext); + openFile = new OpenSourceGeneratedFile(this, textBuffer, _visualStudioWorkspace, documentIdentity, _globalOptions, _threadingContext); _openFiles.Add(moniker, openFile); _threadingContext.JoinableTaskFactory.Run(() => openFile.RefreshFileAsync(CancellationToken.None).AsTask()); @@ -223,6 +226,7 @@ private class OpenSourceGeneratedFile : ForegroundThreadAffinitizedObject, IDisp private readonly ITextBuffer _textBuffer; private readonly Workspace _workspace; private readonly SourceGeneratedDocumentIdentity _documentIdentity; + private readonly IGlobalOptionService _globalOptions; /// /// A read-only region that we create across the entire file to prevent edits unless we are the one making them. @@ -254,13 +258,14 @@ private class OpenSourceGeneratedFile : ForegroundThreadAffinitizedObject, IDisp private ImageMoniker _currentWindowFrameImageMoniker = default; private IVsInfoBarUIElement? _currentWindowFrameInfoBarElement = null; - public OpenSourceGeneratedFile(SourceGeneratedFileManager fileManager, ITextBuffer textBuffer, Workspace workspace, SourceGeneratedDocumentIdentity documentIdentity, IThreadingContext threadingContext) + public OpenSourceGeneratedFile(SourceGeneratedFileManager fileManager, ITextBuffer textBuffer, Workspace workspace, SourceGeneratedDocumentIdentity documentIdentity, IGlobalOptionService globalOptions, IThreadingContext threadingContext) : base(threadingContext, assertIsForeground: true) { _fileManager = fileManager; _textBuffer = textBuffer; _workspace = workspace; _documentIdentity = documentIdentity; + _globalOptions = globalOptions; // We'll create a read-only region for the file, but it'll be a dynamic region we can temporarily suspend // while we're doing edits. diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs index 19279a2e30287..4853061930e9c 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs @@ -260,11 +260,13 @@ private bool TryNavigateToLocation( throw new InvalidOperationException(ServicesVSResources.Navigation_must_be_performed_on_the_foreground_thread); } - using (OpenNewDocumentStateScope(options ?? workspace.Options)) + var solution = workspace.CurrentSolution; + + using (OpenNewDocumentStateScope(options ?? solution.Options)) { - if (workspace.CurrentSolution.GetDocument(documentId) == null) + if (solution.GetDocument(documentId) == null) { - var project = workspace.CurrentSolution.GetProject(documentId.ProjectId); + var project = solution.GetProject(documentId.ProjectId); if (project is null) { // This is a source generated document shown in Solution Explorer, but is no longer valid since @@ -272,10 +274,7 @@ private bool TryNavigateToLocation( return false; } - var generatedDocument = project - .GetSourceGeneratedDocumentAsync(documentId, cancellationToken) - .AsTask().GetAwaiter().GetResult(); - + var generatedDocument = project.GetSourceGeneratedDocumentAsync(documentId, cancellationToken).AsTask().GetAwaiter().GetResult(); if (generatedDocument != null) { _sourceGeneratedFileManager.Value.NavigateToSourceGeneratedFile(generatedDocument, getTextSpanForMapping(generatedDocument), cancellationToken); @@ -284,7 +283,7 @@ private bool TryNavigateToLocation( } // Before attempting to open the document, check if the location maps to a different file that should be opened instead. - var document = workspace.CurrentSolution.GetDocument(documentId); + var document = solution.GetDocument(documentId); var spanMappingService = document?.Services.GetService(); if (spanMappingService != null) { @@ -293,7 +292,7 @@ private bool TryNavigateToLocation( { // Check if the mapped file matches one already in the workspace. // If so use the workspace APIs to navigate to it. Otherwise use VS APIs to navigate to the file path. - var documentIdsForFilePath = workspace.CurrentSolution.GetDocumentIdsWithFilePath(mappedSpan.Value.FilePath); + var documentIdsForFilePath = solution.GetDocumentIdsWithFilePath(mappedSpan.Value.FilePath); if (!documentIdsForFilePath.IsEmpty) { // If the mapped file maps to the same document that was passed in, then re-use the documentId to preserve context. diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioSymbolNavigationService.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioSymbolNavigationService.cs index b97b8cb22302e..9a15e2b1994c5 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioSymbolNavigationService.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioSymbolNavigationService.cs @@ -36,6 +36,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation internal partial class VisualStudioSymbolNavigationService : ForegroundThreadAffinitizedObject, ISymbolNavigationService { private readonly IServiceProvider _serviceProvider; + private readonly IGlobalOptionService _globalOptions; private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactory; private readonly IMetadataAsSourceFileService _metadataAsSourceFileService; @@ -43,12 +44,14 @@ internal partial class VisualStudioSymbolNavigationService : ForegroundThreadAff [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioSymbolNavigationService( SVsServiceProvider serviceProvider, + IGlobalOptionService globalOptions, IThreadingContext threadingContext, IVsEditorAdaptersFactoryService editorAdaptersFactory, IMetadataAsSourceFileService metadataAsSourceFileService) : base(threadingContext) { _serviceProvider = serviceProvider; + _globalOptions = globalOptions; _editorAdaptersFactory = editorAdaptersFactory; _metadataAsSourceFileService = metadataAsSourceFileService; } @@ -60,7 +63,7 @@ public bool TryNavigateToSymbol(ISymbol symbol, Project project, OptionSet? opti return false; } - options ??= project.Solution.Workspace.Options; + options ??= project.Solution.Options; symbol = symbol.OriginalDefinition; // Prefer visible source locations if possible. @@ -88,7 +91,7 @@ public bool TryNavigateToSymbol(ISymbol symbol, Project project, OptionSet? opti } // Should we prefer navigating to the Object Browser over metadata-as-source? - if (options.GetOption(VisualStudioNavigationOptions.NavigateToObjectBrowser, project.Language)) + if (_globalOptions.GetOption(VisualStudioNavigationOptions.NavigateToObjectBrowser, project.Language)) { var libraryService = project.LanguageServices.GetService(); if (libraryService == null) diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs index 47409c52a7dc2..ad543d0f486ad 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs @@ -30,15 +30,20 @@ internal class VisualStudioWorkspaceStatusServiceFactory : IWorkspaceServiceFact { private readonly IAsyncServiceProvider2 _serviceProvider; private readonly IThreadingContext _threadingContext; + private readonly IGlobalOptionService _globalOptions; private readonly IAsynchronousOperationListener _listener; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioWorkspaceStatusServiceFactory( - SVsServiceProvider serviceProvider, IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider) + SVsServiceProvider serviceProvider, + IThreadingContext threadingContext, + IGlobalOptionService globalOptions, + IAsynchronousOperationListenerProvider listenerProvider) { _serviceProvider = (IAsyncServiceProvider2)serviceProvider; _threadingContext = threadingContext; + _globalOptions = globalOptions; // for now, we use workspace so existing tests can automatically wait for full solution load event // subscription done in test @@ -48,9 +53,9 @@ public VisualStudioWorkspaceStatusServiceFactory( [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { - if (workspaceServices.Workspace is VisualStudioWorkspace vsWorkspace) + if (workspaceServices.Workspace is VisualStudioWorkspace) { - if (!vsWorkspace.Options.GetOption(Options.PartialLoadModeFeatureFLag)) + if (!_globalOptions.GetOption(Options.PartialLoadModeFeatureFlag)) { // don't enable partial load mode for ones that are not in experiment yet return new WorkspaceStatusService(); @@ -183,11 +188,11 @@ internal sealed class Options : IOptionProvider { private const string FeatureName = "VisualStudioWorkspaceStatusService"; - public static readonly Option PartialLoadModeFeatureFLag = new(FeatureName, nameof(PartialLoadModeFeatureFLag), defaultValue: false, + public static readonly Option PartialLoadModeFeatureFlag = new(FeatureName, nameof(PartialLoadModeFeatureFlag), defaultValue: false, new FeatureFlagStorageLocation("Roslyn.PartialLoadMode")); ImmutableArray IOptionProvider.Options => ImmutableArray.Create( - PartialLoadModeFeatureFLag); + PartialLoadModeFeatureFlag); [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] diff --git a/src/VisualStudio/Core/Def/ValueTracking/TreeItemViewModel.cs b/src/VisualStudio/Core/Def/ValueTracking/TreeItemViewModel.cs index 4ec7232d1ad59..8ae744f703771 100644 --- a/src/VisualStudio/Core/Def/ValueTracking/TreeItemViewModel.cs +++ b/src/VisualStudio/Core/Def/ValueTracking/TreeItemViewModel.cs @@ -111,7 +111,7 @@ public virtual void NavigateTo() } // While navigating do not activate the tab, which will change focus from the tool window - var options = Workspace.Options + var options = Workspace.CurrentSolution.Options .WithChangedOption(new OptionKey(NavigationOptions.PreferProvisionalTab), true) .WithChangedOption(new OptionKey(NavigationOptions.ActivateTab), false); diff --git a/src/VisualStudio/Core/Def/ValueTracking/ValueTrackedTreeItemViewModel.cs b/src/VisualStudio/Core/Def/ValueTracking/ValueTrackedTreeItemViewModel.cs index a11aefa1f07d0..4d5be0240613c 100644 --- a/src/VisualStudio/Core/Def/ValueTracking/ValueTrackedTreeItemViewModel.cs +++ b/src/VisualStudio/Core/Def/ValueTracking/ValueTrackedTreeItemViewModel.cs @@ -126,7 +126,7 @@ public override void NavigateTo() } // While navigating do not activate the tab, which will change focus from the tool window - var options = Workspace.Options + var options = Workspace.CurrentSolution.Options .WithChangedOption(new OptionKey(NavigationOptions.PreferProvisionalTab), true) .WithChangedOption(new OptionKey(NavigationOptions.ActivateTab), false); diff --git a/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs b/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs index 87125097e5c29..443150c5285db 100644 --- a/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs +++ b/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Remote.Testing; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SymbolSearch; @@ -28,22 +29,20 @@ public class RemoteHostClientServiceFactoryTests private static readonly TestComposition s_composition = FeaturesTestCompositions.Features.WithTestHostParts(TestHost.OutOfProcess); private static AdhocWorkspace CreateWorkspace() - => new AdhocWorkspace(s_composition.GetHostServices()); + => new(s_composition.GetHostServices()); [Fact] public async Task UpdaterService() { - var hostServices = s_composition.GetHostServices(); - using var workspace = new AdhocWorkspace(hostServices); - - var options = workspace.CurrentSolution.Options - .WithChangedOption(RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS, 1); + using var workspace = CreateWorkspace(); - workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(options)); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + var listenerProvider = exportProvider.GetExportedValue(); + var globalOptions = exportProvider.GetExportedValue(); - var listenerProvider = ((IMefHostExportProvider)hostServices).GetExportedValue(); + globalOptions.SetGlobalOption(RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS, 1); - var checksumUpdater = new SolutionChecksumUpdater(workspace, listenerProvider, CancellationToken.None); + var checksumUpdater = new SolutionChecksumUpdater(workspace, globalOptions, listenerProvider, CancellationToken.None); var service = workspace.Services.GetRequiredService(); // make sure client is ready diff --git a/src/VisualStudio/Core/Test.Next/Services/LspDiagnosticsTests.cs b/src/VisualStudio/Core/Test.Next/Services/LspDiagnosticsTests.cs index 7e554dc224a7a..9e4425c938540 100644 --- a/src/VisualStudio/Core/Test.Next/Services/LspDiagnosticsTests.cs +++ b/src/VisualStudio/Core/Test.Next/Services/LspDiagnosticsTests.cs @@ -407,11 +407,14 @@ static VisualStudioInProcLanguageServer CreateLanguageServer(Stream inputStream, ExceptionStrategy = ExceptionProcessing.ISerializable, }; + var globalOptions = workspace.GetService(); + var languageServer = new VisualStudioInProcLanguageServer( dispatcherFactory, jsonRpc, capabilitiesProvider, lspWorkspaceRegistrationService, + globalOptions, listenerProvider, NoOpLspLogger.Instance, mockDiagnosticService, diff --git a/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb b/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb index fb0abf88a0fcf..1400ed8bb0211 100644 --- a/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb +++ b/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb @@ -30,8 +30,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Using workspace = TestWorkspace.CreateCSharp(String.Empty) Dim provider = New TestDiagnosticService() Dim tableManagerProvider = New TestTableManagerProvider() + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) Assert.Equal(manager.Identifier, StandardTables.ErrorsTable) @@ -60,11 +61,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestInitialEntries() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim provider = New TestDiagnosticService(CreateItem(documentId)) Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -79,11 +81,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestEntryChanged() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim provider = New TestDiagnosticService() Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of DiagnosticTableItem, DiagnosticsUpdatedArgs)) @@ -104,13 +107,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestEntry() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim item = CreateItem(documentId) Dim provider = New TestDiagnosticService(item) Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -145,13 +149,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestSnapshotEntry() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim item = CreateItem(documentId) Dim provider = New TestDiagnosticService(item) Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -193,13 +198,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestInvalidEntry() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim item = CreateItem(documentId) Dim provider = New TestDiagnosticService(item) Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -223,6 +229,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestNoHiddenEntry() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim item = CreateItem(documentId, DiagnosticSeverity.Error) @@ -231,7 +238,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -250,6 +257,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestProjectEntry() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim projectId = workspace.CurrentSolution.Projects.First().Id Dim item = CreateItem(projectId, Nothing, DiagnosticSeverity.Error) @@ -257,7 +265,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -285,7 +293,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace1, provider, tableManagerProvider) + Dim globalOptions = workspace1.GetService(Of IGlobalOptionService)() + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace1, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace1) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -311,6 +320,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestDetailExpander() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -319,7 +329,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -348,6 +358,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestHyperLink() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -356,7 +367,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -380,6 +391,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestBingHyperLink() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -388,7 +400,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -412,6 +424,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestHelpLink() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -420,7 +433,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -441,6 +454,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestHelpKeyword() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -449,7 +463,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -470,6 +484,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestBingHelpLink() Using workspace = TestWorkspace.CreateVisualBasic(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -478,7 +493,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -516,6 +531,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestErrorSource() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -524,7 +540,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -545,6 +561,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestWorkspaceDiagnostic() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -553,7 +570,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -575,6 +592,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestProjectDiagnostic() Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim documentId = workspace.CurrentSolution.Projects.First().DocumentIds.First() Dim projectId = documentId.ProjectId @@ -583,7 +601,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, provider, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, provider, tableManagerProvider) provider.RaiseDiagnosticsUpdated(workspace) Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) @@ -616,6 +634,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Using workspace = TestWorkspace.Create(markup) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() Dim analyzerReference = New TestAnalyzerReferenceByLanguage(DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap()) workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) @@ -624,7 +643,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim service = Assert.IsType(Of DiagnosticService)(workspace.ExportProvider.GetExportedValue(Of IDiagnosticService)()) Dim tableManagerProvider = New TestTableManagerProvider() - Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, service, tableManagerProvider) + Dim table = New VisualStudioDiagnosticListTableWorkspaceEventListener.VisualStudioDiagnosticListTable(workspace, globalOptions, service, tableManagerProvider) RunCompilerAnalyzer(workspace) @@ -667,12 +686,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Using workspace = TestWorkspace.Create(markup) - - Dim listenerProvider = workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider) - + Dim globalOptions = workspace.GetService(Of IGlobalOptionService)() + Dim listenerProvider = workspace.GetService(Of IAsynchronousOperationListenerProvider) Dim listener = listenerProvider.GetListener(FeatureAttribute.DiagnosticService) - Dim service = Assert.IsType(Of DiagnosticService)(workspace.ExportProvider.GetExportedValue(Of IDiagnosticService)()) - Dim analyzerService = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.ExportProvider.GetExportedValue(Of IDiagnosticAnalyzerService)()) + Dim service = Assert.IsType(Of DiagnosticService)(workspace.GetService(Of IDiagnosticService)()) + Dim analyzerService = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)()) Using updateSource = New ExternalErrorDiagnosticUpdateSource(workspace, analyzerService, listener, CancellationToken.None) diff --git a/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb b/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb index 9e35258b4ad1a..faaef5d0b3d92 100644 --- a/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb +++ b/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb @@ -11,6 +11,7 @@ Imports Microsoft.CodeAnalysis.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces +Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Shared.TestHooks Imports Microsoft.CodeAnalysis.SolutionCrawler @@ -41,6 +42,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_RaiseEvents() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim waiter = New AsynchronousOperationListener() Dim service = New TestDiagnosticAnalyzerService() Using source = New ExternalErrorDiagnosticUpdateSource(workspace, service, waiter, CancellationToken.None) @@ -50,7 +52,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim expected = 1 AddHandler source.DiagnosticsUpdated, Sub(o, a) - Dim diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(expected, diagnostics.Length) If expected = 1 Then Assert.Equal(diagnostics(0), diagnostic) @@ -109,6 +111,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_DuplicatedError() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim waiter = New AsynchronousOperationListener() Dim project = workspace.CurrentSolution.Projects.First() @@ -124,7 +127,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics source.AddNewErrors(project.Id, New HashSet(Of DiagnosticData)(SpecializedCollections.SingletonEnumerable(diagnostic)), map) AddHandler source.DiagnosticsUpdated, Sub(o, a) - Dim diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(1, diagnostics.Length) End Sub @@ -192,6 +195,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_AddDuplicatedErrors() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim waiter = New AsynchronousOperationListener() Dim project = workspace.CurrentSolution.Projects.First() @@ -205,7 +209,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics source.AddNewErrors(project.Id, diagnostic) AddHandler source.DiagnosticsUpdated, Sub(o, a) - Dim diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(1, diagnostics.Length) End Sub @@ -220,6 +224,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_CompilationEndAnalyzer(hasCompilationEndTag As Boolean) As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim analyzer = New CompilationEndAnalyzer(hasCompilationEndTag) Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) @@ -243,7 +248,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics AddHandler source.DiagnosticsUpdated, Sub(o, a) buildDiagnosticCallbackSeen = True - Dim diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(1, diagnostics.Length) Assert.Equal(diagnostics(0).Properties(WellKnownDiagnosticPropertyNames.Origin), WellKnownDiagnosticTags.Build) End Sub @@ -260,6 +265,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_CompilationAnalyzer() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim analyzer = New CompilationAnalyzer() Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) @@ -280,7 +286,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics source.AddNewErrors(project.Id, diagnostic) AddHandler source.DiagnosticsUpdated, Sub(o, a) - Dim diagnostics = a.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = a.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(1, diagnostics.Length) Assert.Equal(diagnostics(0).Properties(WellKnownDiagnosticPropertyNames.Origin), WellKnownDiagnosticTags.Build) @@ -371,6 +377,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestCompilerDiagnosticWithoutDocumentId() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim analyzer = New CompilationAnalyzer() Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) @@ -403,7 +410,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics language:=project.Language) AddHandler service.DiagnosticsUpdated, Sub(o, args) - Dim diagnostics = args.GetPushDiagnostics(workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = args.GetPushDiagnostics(globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Single(diagnostics) Assert.Equal(diagnostics(0).Id, diagnostic.Id) diff --git a/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioAnalyzerTests.vb b/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioAnalyzerTests.vb index 24f08072af2b7..829a7c7319532 100644 --- a/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioAnalyzerTests.vb +++ b/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioAnalyzerTests.vb @@ -9,6 +9,7 @@ Imports Microsoft.CodeAnalysis.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces +Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem Imports Microsoft.VisualStudio.LanguageServices.Implementation.TaskList @@ -60,7 +61,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim Dim file = Path.GetTempFileName() Using workspace = New TestWorkspace(composition:=composition) - Dim eventHandler = New EventHandlers(file, workspace) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) + Dim eventHandler = New EventHandlers(file, globalOptions) AddHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticAddedTest Using analyzer = New VisualStudioAnalyzer(file, hostDiagnosticUpdateSource, ProjectId.CreateNewId(), LanguageNames.VisualBasic) @@ -77,15 +79,15 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim Private Class EventHandlers Public File As String - Private ReadOnly _workspace As Workspace + Private ReadOnly _globalOptions As IGlobalOptionService - Public Sub New(file As String, workspace As Workspace) + Public Sub New(file As String, globalOptions As IGlobalOptionService) Me.File = file - _workspace = workspace + _globalOptions = globalOptions End Sub Public Sub DiagnosticAddedTest(o As Object, e As DiagnosticsUpdatedArgs) - Dim diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = e.GetPushDiagnostics(_globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(1, diagnostics.Length) Dim diagnostic As DiagnosticData = diagnostics.First() Assert.Equal("BC42378", diagnostic.Id) @@ -93,7 +95,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim End Sub Public Sub DiagnosticRemovedTest(o As Object, e As DiagnosticsUpdatedArgs) - Dim diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode) + Dim diagnostics = e.GetPushDiagnostics(_globalOptions, InternalDiagnosticsOptions.NormalDiagnosticMode) Assert.Equal(0, diagnostics.Length) End Sub End Class diff --git a/src/VisualStudio/LiveShare/Impl/Client/RemoteDiagnosticListTable.cs b/src/VisualStudio/LiveShare/Impl/Client/RemoteDiagnosticListTable.cs index 5cbbfc57af4b5..6d293f0b6dfce 100644 --- a/src/VisualStudio/LiveShare/Impl/Client/RemoteDiagnosticListTable.cs +++ b/src/VisualStudio/LiveShare/Impl/Client/RemoteDiagnosticListTable.cs @@ -9,6 +9,7 @@ using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.TableManager; @@ -30,10 +31,14 @@ internal class RemoteDiagnosticListTable : VisualStudioBaseDiagnosticListTable [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")] public RemoteDiagnosticListTable( - SVsServiceProvider serviceProvider, RemoteLanguageServiceWorkspace workspace, IDiagnosticService diagnosticService, ITableManagerProvider provider) + SVsServiceProvider serviceProvider, + RemoteLanguageServiceWorkspace workspace, + IGlobalOptionService globalOptions, + IDiagnosticService diagnosticService, + ITableManagerProvider provider) : base(workspace, provider) { - _source = new LiveTableDataSource(workspace, diagnosticService, IdentifierString); + _source = new LiveTableDataSource(workspace, globalOptions, diagnosticService, IdentifierString); AddInitialTableSource(workspace.CurrentSolution, _source); ConnectWorkspaceEvents(); diff --git a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs index 99146fa30398a..2176c5a380b40 100644 --- a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs +++ b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Composition; @@ -76,19 +77,20 @@ internal sealed class RemoteLanguageServiceWorkspace : CodeAnalysis.Workspace, I /// [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public RemoteLanguageServiceWorkspace(ExportProvider exportProvider, - IVsEditorAdaptersFactoryService editorAdaptersFactoryService, - IVsFolderWorkspaceService vsFolderWorkspaceService, - SVsServiceProvider serviceProvider, - IDiagnosticService diagnosticService, - ITableManagerProvider tableManagerProvider, - IThreadingContext threadingContext) + public RemoteLanguageServiceWorkspace( + ExportProvider exportProvider, + IVsEditorAdaptersFactoryService editorAdaptersFactoryService, + IVsFolderWorkspaceService vsFolderWorkspaceService, + SVsServiceProvider serviceProvider, + IDiagnosticService diagnosticService, + ITableManagerProvider tableManagerProvider, + IGlobalOptionService globalOptions, + IThreadingContext threadingContext) : base(VisualStudioMefHostServices.Create(exportProvider), WorkspaceKind.CloudEnvironmentClientWorkspace) - { _serviceProvider = serviceProvider; - _remoteDiagnosticListTable = new RemoteDiagnosticListTable(serviceProvider, this, diagnosticService, tableManagerProvider); + _remoteDiagnosticListTable = new RemoteDiagnosticListTable(serviceProvider, this, globalOptions, diagnosticService, tableManagerProvider); var runningDocumentTable = (IVsRunningDocumentTable)serviceProvider.GetService(typeof(SVsRunningDocumentTable)); _runningDocumentTableEventTracker = new RunningDocumentTableEventTracker(threadingContext, editorAdaptersFactoryService, runningDocumentTable, this); diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs index de324df67803f..f2558bf83c0e2 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Editor.Xaml; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Experimentation; using Microsoft.VisualStudio.LanguageServer.Client; @@ -33,13 +34,13 @@ internal class XamlInProcLanguageClient : AbstractInProcLanguageClient [Obsolete(MefConstruction.ImportingConstructorMessage, true)] public XamlInProcLanguageClient( XamlRequestDispatcherFactory xamlDispatcherFactory, - VisualStudioWorkspace workspace, + IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(xamlDispatcherFactory, workspace, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(xamlDispatcherFactory, globalOptions, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) { } @@ -64,6 +65,6 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa public override bool ShowNotificationOnInitializeFailed => IsXamlLspIntelliSenseEnabled(); private bool IsXamlLspIntelliSenseEnabled() - => Workspace.Options.GetOption(XamlOptions.EnableLspIntelliSenseFeatureFlag); + => GlobalOptions.GetOption(XamlOptions.EnableLspIntelliSenseFeatureFlag); } } diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs index 38db929281683..1de26499b64d4 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Editor.Xaml; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -34,13 +35,13 @@ internal class XamlInProcLanguageClientDisableUX : AbstractInProcLanguageClient [Obsolete(MefConstruction.ImportingConstructorMessage, true)] public XamlInProcLanguageClientDisableUX( XamlRequestDispatcherFactory xamlDispatcherFactory, - VisualStudioWorkspace workspace, + IGlobalOptionService globalOptions, IDiagnosticService diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(xamlDispatcherFactory, workspace, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(xamlDispatcherFactory, globalOptions, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) { } @@ -53,7 +54,7 @@ public XamlInProcLanguageClientDisableUX( public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) { - var isLspExperimentEnabled = Workspace.Options.GetOption(XamlOptions.EnableLspIntelliSenseFeatureFlag); + var isLspExperimentEnabled = GlobalOptions.GetOption(XamlOptions.EnableLspIntelliSenseFeatureFlag); var capabilities = isLspExperimentEnabled ? XamlCapabilities.None : XamlCapabilities.Current; // Only turn on CodeAction support for client scenarios. Hosts will get non-LSP lightbulbs automatically. diff --git a/src/Workspaces/Core/Portable/Options/IGlobalOptionService.cs b/src/Workspaces/Core/Portable/Options/IGlobalOptionService.cs index 152730b6345d0..3357cb27e9a84 100644 --- a/src/Workspaces/Core/Portable/Options/IGlobalOptionService.cs +++ b/src/Workspaces/Core/Portable/Options/IGlobalOptionService.cs @@ -58,15 +58,17 @@ internal interface IGlobalOptionService /// /// Sets and persists the value of a global option. + /// Sets the value of a global option. + /// Invokes registered option persisters. + /// Triggers . /// Does not update any workspace (since this option is not a solution option). - /// Does not trigger . /// void SetGlobalOption(OptionKey optionKey, object? value); /// /// Atomically sets the values of specified global options. The option values are persisted. + /// Triggers . /// Does not update any workspace (since this option is not a solution option). - /// Does not trigger . /// void SetGlobalOptions(ImmutableArray optionKeys, ImmutableArray values); diff --git a/src/Workspaces/CoreTest/WorkspaceServiceTests/OptionServiceTests.cs b/src/Workspaces/CoreTest/WorkspaceServiceTests/OptionServiceTests.cs index 22d2ff958d5b8..045ee0186d62e 100644 --- a/src/Workspaces/CoreTest/WorkspaceServiceTests/OptionServiceTests.cs +++ b/src/Workspaces/CoreTest/WorkspaceServiceTests/OptionServiceTests.cs @@ -134,11 +134,6 @@ public void GlobalOptions() optionService.OptionChanged -= handler; } - private void OptionService_OptionChanged(object? sender, OptionChangedEventArgs e) - { - throw new System.NotImplementedException(); - } - [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionWithChangedOption() { diff --git a/src/Workspaces/Remote/Core/RemoteHostOptions.cs b/src/Workspaces/Remote/Core/RemoteHostOptions.cs index 3325a78cf84e4..cc542088b2d90 100644 --- a/src/Workspaces/Remote/Core/RemoteHostOptions.cs +++ b/src/Workspaces/Remote/Core/RemoteHostOptions.cs @@ -67,37 +67,20 @@ public RemoteHostOptions() { } - public static bool IsServiceHubProcessServerGC(HostWorkspaceServices services) - { - var optionService = services.GetRequiredService(); - return optionService.GetOption(OOPServerGC) || optionService.GetOption(OOPServerGCFeatureFlag); - } + public static bool IsServiceHubProcessServerGC(IGlobalOptionService globalOptions) + => globalOptions.GetOption(OOPServerGC) || globalOptions.GetOption(OOPServerGCFeatureFlag); /// /// Determines whether ServiceHub out-of-process execution is enabled for Roslyn. /// - public static bool IsUsingServiceHubOutOfProcess(HostWorkspaceServices services) - { - var optionService = services.GetRequiredService(); - if (Environment.Is64BitOperatingSystem && optionService.GetOption(OOP64Bit)) - { - // OOP64Bit is set and supported - return true; - } + public static bool IsUsingServiceHubOutOfProcess(IGlobalOptionService globalOptions) + => Environment.Is64BitOperatingSystem && globalOptions.GetOption(OOP64Bit); - return false; - } - - public static bool IsServiceHubProcessCoreClr(HostWorkspaceServices services) - { - var optionService = services.GetRequiredService(); - return optionService.GetOption(OOPCoreClr) || optionService.GetOption(OOPCoreClrFeatureFlag); - } + public static bool IsServiceHubProcessCoreClr(IGlobalOptionService globalOptions) + => globalOptions.GetOption(OOPCoreClr) || globalOptions.GetOption(OOPCoreClrFeatureFlag); public static bool IsCurrentProcessRunningOnCoreClr() - { - return !RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework") - && !RuntimeInformation.FrameworkDescription.StartsWith(".NET Native"); - } + => !RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework") && + !RuntimeInformation.FrameworkDescription.StartsWith(".NET Native"); } } diff --git a/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs b/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs index 7b0aef1009506..61d4498a41474 100644 --- a/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs +++ b/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Serialization; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Telemetry; @@ -27,6 +28,7 @@ internal sealed partial class ServiceHubRemoteHostClient : RemoteHostClient, IRe private const int ConnectionPoolCapacity = 15; private readonly HostWorkspaceServices _services; + private readonly IGlobalOptionService _globalOptions; private readonly SolutionAssetStorage _assetStorage; private readonly ISerializerService _serializer; private readonly RemoteEndPoint _endPoint; @@ -43,6 +45,7 @@ internal sealed partial class ServiceHubRemoteHostClient : RemoteHostClient, IRe private ServiceHubRemoteHostClient( HostWorkspaceServices services, + IGlobalOptionService globalOptions, IServiceBroker serviceBroker, ServiceBrokerClient serviceBrokerClient, HubClient hubClient, @@ -57,6 +60,7 @@ private ServiceHubRemoteHostClient( services.GetService()?.RegisterUnexpectedExceptionLogger(hubClient.Logger); _services = services; + _globalOptions = globalOptions; _serviceBroker = serviceBroker; _serviceBrokerClient = serviceBrokerClient; _hubClient = hubClient; @@ -70,8 +74,8 @@ private ServiceHubRemoteHostClient( _serializer = services.GetRequiredService(); _errorReportingService = services.GetService(); _shutdownCancellationService = services.GetService(); - _isRemoteHostServerGC = RemoteHostOptions.IsServiceHubProcessServerGC(services); - _isRemoteHostCoreClr = RemoteHostOptions.IsServiceHubProcessCoreClr(services); + _isRemoteHostServerGC = RemoteHostOptions.IsServiceHubProcessServerGC(globalOptions); + _isRemoteHostCoreClr = RemoteHostOptions.IsServiceHubProcessCoreClr(globalOptions); } private void OnUnexpectedExceptionThrown(Exception unexpectedException) @@ -79,6 +83,7 @@ private void OnUnexpectedExceptionThrown(Exception unexpectedException) public static async Task CreateAsync( HostWorkspaceServices services, + IGlobalOptionService globalOptions, AsynchronousOperationListenerProvider listenerProvider, IServiceBroker serviceBroker, RemoteServiceCallbackDispatcherRegistry callbackDispatchers, @@ -93,9 +98,9 @@ public static async Task CreateAsync( var hubClient = new HubClient("ManagedLanguage.IDE.RemoteHostClient"); - var remoteHostStream = await RequestServiceAsync(services, hubClient, WellKnownServiceHubService.RemoteHost, cancellationToken).ConfigureAwait(false); + var remoteHostStream = await RequestServiceAsync(services, globalOptions, hubClient, WellKnownServiceHubService.RemoteHost, cancellationToken).ConfigureAwait(false); - var client = new ServiceHubRemoteHostClient(services, serviceBroker, serviceBrokerClient, hubClient, remoteHostStream, callbackDispatchers); + var client = new ServiceHubRemoteHostClient(services, globalOptions, serviceBroker, serviceBrokerClient, hubClient, remoteHostStream, callbackDispatchers); var uiCultureLCID = CultureInfo.CurrentUICulture.LCID; var cultureLCID = CultureInfo.CurrentCulture.LCID; @@ -117,12 +122,13 @@ await client.TryInvokeAsync( public static async Task RequestServiceAsync( HostWorkspaceServices services, + IGlobalOptionService globalOptions, HubClient client, RemoteServiceName serviceName, CancellationToken cancellationToken) { - var isServerGC = RemoteHostOptions.IsServiceHubProcessServerGC(services); - var isCoreClr = RemoteHostOptions.IsServiceHubProcessCoreClr(services); + var isServerGC = RemoteHostOptions.IsServiceHubProcessServerGC(globalOptions); + var isCoreClr = RemoteHostOptions.IsServiceHubProcessCoreClr(globalOptions); // Make sure we are on the thread pool to avoid UI thread dependencies if external code uses ConfigureAwait(true) await TaskScheduler.Default; @@ -201,7 +207,7 @@ public override Task CreateConnectionAsync(RemoteServic private async Task CreateConnectionImplAsync(RemoteServiceName serviceName, object? callbackTarget, IPooledConnectionReclamation? poolReclamation, CancellationToken cancellationToken) { - var serviceStream = await RequestServiceAsync(_services, _hubClient, serviceName, cancellationToken).ConfigureAwait(false); + var serviceStream = await RequestServiceAsync(_services, _globalOptions, _hubClient, serviceName, cancellationToken).ConfigureAwait(false); return new JsonRpcConnection(_services, _hubClient.Logger, callbackTarget, serviceStream, poolReclamation); } diff --git a/src/Workspaces/Remote/Core/SolutionChecksumUpdater.cs b/src/Workspaces/Remote/Core/SolutionChecksumUpdater.cs index 447b49f1803e2..7df27f3d2b349 100644 --- a/src/Workspaces/Remote/Core/SolutionChecksumUpdater.cs +++ b/src/Workspaces/Remote/Core/SolutionChecksumUpdater.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Notification; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.VisualStudio.Threading; @@ -32,10 +33,10 @@ internal sealed class SolutionChecksumUpdater : GlobalOperationAwareIdleProcesso // hold the async token from WaitAsync so ExecuteAsync can complete it private IAsyncToken _currentToken; - public SolutionChecksumUpdater(Workspace workspace, IAsynchronousOperationListenerProvider listenerProvider, CancellationToken shutdownToken) + public SolutionChecksumUpdater(Workspace workspace, IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, CancellationToken shutdownToken) : base(listenerProvider.GetListener(FeatureAttribute.SolutionChecksumUpdater), workspace.Services.GetService(), - TimeSpan.FromMilliseconds(workspace.Options.GetOption(RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS)), shutdownToken) + TimeSpan.FromMilliseconds(globalOptions.GetOption(RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS)), shutdownToken) { _workspace = workspace; _textChangeQueue = new TaskQueue(Listener, TaskScheduler.Default); From 409fcc26226c782f306d81cdbeed06d86b2de3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 7 Sep 2021 10:42:47 -0700 Subject: [PATCH 5/7] Add External Access options for TypeScript (#56187) --- .../VSTypeScript/Api/VSTypeScriptOptions.cs | 26 +++++++++++++++++++ .../Protocol/Extensions/Extensions.cs | 2 +- .../Completion/FSharpCompletionOptions.cs | 4 +-- .../VSTypeScriptContainedLanguageWrapper.cs | 2 +- ...ctLanguageService`2.VsCodeWindowManager.cs | 2 +- .../Options/LanguageSettingsPersister.cs | 2 +- 6 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptOptions.cs diff --git a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptOptions.cs b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptOptions.cs new file mode 100644 index 0000000000000..e66b0b9d436e0 --- /dev/null +++ b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptOptions.cs @@ -0,0 +1,26 @@ +// 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 Microsoft.CodeAnalysis.Completion; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Shared.Options; +using Microsoft.CodeAnalysis.SolutionCrawler; + +namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api +{ + internal static class VSTypeScriptOptions + { + public static PerLanguageOption BlockForCompletionItems { get; } = (PerLanguageOption)CompletionOptions.BlockForCompletionItems2; + + public static OptionSet WithBackgroundAnalysisScope(this OptionSet options, bool openFilesOnly) + => options.WithChangedOption( + SolutionCrawlerOptions.BackgroundAnalysisScopeOption, + InternalLanguageNames.TypeScript, + openFilesOnly ? BackgroundAnalysisScope.OpenFilesAndProjects : BackgroundAnalysisScope.FullSolution) + .WithChangedOption( + ServiceFeatureOnOffOptions.RemoveDocumentDiagnosticsOnDocumentClose, + InternalLanguageNames.TypeScript, + openFilesOnly); + } +} diff --git a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs index f780c2ea48968..f64c02dcd97a7 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs @@ -175,7 +175,7 @@ public static string GetMarkdownLanguageName(this Document document) return "vb"; case LanguageNames.FSharp: return "fsharp"; - case "TypeScript": + case InternalLanguageNames.TypeScript: return "typescript"; default: throw new ArgumentException(string.Format("Document project language {0} is not valid", document.Project.Language)); diff --git a/src/Tools/ExternalAccess/FSharp/Completion/FSharpCompletionOptions.cs b/src/Tools/ExternalAccess/FSharp/Completion/FSharpCompletionOptions.cs index 5b868821f01e0..012f32676d789 100644 --- a/src/Tools/ExternalAccess/FSharp/Completion/FSharpCompletionOptions.cs +++ b/src/Tools/ExternalAccess/FSharp/Completion/FSharpCompletionOptions.cs @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion { internal static class FSharpCompletionOptions { - // Suppression due to https://github.com/dotnet/roslyn/issues/42614 - public static PerLanguageOption BlockForCompletionItems { get; } = ((PerLanguageOption)Microsoft.CodeAnalysis.Completion.CompletionOptions.BlockForCompletionItems2)!; + public static PerLanguageOption BlockForCompletionItems { get; } = (PerLanguageOption)CompletionOptions.BlockForCompletionItems2; } } diff --git a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs index df7694bb89f96..24f42860d031d 100644 --- a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs +++ b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs @@ -73,7 +73,7 @@ public VSTypeScriptContainedLanguageWrapper( { var filePath = ContainedLanguage.GetFilePathFromHierarchyAndItemId(hierarchy, itemid); var projectId = ProjectId.CreateNewId($"Project for {filePath}"); - workspace.OnProjectAdded(ProjectInfo.Create(projectId, VersionStamp.Default, filePath, string.Empty, "TypeScript")); + workspace.OnProjectAdded(ProjectInfo.Create(projectId, VersionStamp.Default, filePath, string.Empty, InternalLanguageNames.TypeScript)); _underlyingObject = new ContainedLanguage( bufferCoordinator, diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs b/src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs index accf5a857fbf3..133ad2d575060 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs @@ -131,7 +131,7 @@ private void AddOrRemoveDropdown() // TODO - Remove the TS check once they move the liveshare navbar to LSP. Then we can also switch to LSP // for the local navbar implementation. // https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1163360 - if (textBuffer?.IsInLspEditorContext() == true && document!.Project!.Language != "TypeScript") + if (textBuffer?.IsInLspEditorContext() == true && document!.Project!.Language != InternalLanguageNames.TypeScript) { // Remove the existing dropdown bar if it is ours. if (IsOurDropdownBar(dropdownManager, out var _)) diff --git a/src/VisualStudio/Core/Def/Implementation/Options/LanguageSettingsPersister.cs b/src/VisualStudio/Core/Def/Implementation/Options/LanguageSettingsPersister.cs index 65619b1bcfb6e..2387b114ccc75 100644 --- a/src/VisualStudio/Core/Def/Implementation/Options/LanguageSettingsPersister.cs +++ b/src/VisualStudio/Core/Def/Implementation/Options/LanguageSettingsPersister.cs @@ -57,7 +57,7 @@ public LanguageSettingsPersister( // TODO: make this configurable _languageMap = BidirectionalMap>.Empty.Add(LanguageNames.CSharp, Tuple.Create(Guids.CSharpLanguageServiceId)) .Add(LanguageNames.VisualBasic, Tuple.Create(Guids.VisualBasicLanguageServiceId)) - .Add("TypeScript", Tuple.Create(new Guid("4a0dddb5-7a95-4fbf-97cc-616d07737a77"))) + .Add(InternalLanguageNames.TypeScript, Tuple.Create(new Guid("4a0dddb5-7a95-4fbf-97cc-616d07737a77"))) .Add("F#", Tuple.Create(new Guid("BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B"))) .Add("Xaml", Tuple.Create(new Guid("CD53C9A1-6BC2-412B-BE36-CC715ED8DD41"))); From ec20540d1ac3d0b048ddfb3b7831728511f3e3bb Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Tue, 7 Sep 2021 10:44:17 -0700 Subject: [PATCH 6/7] Add readme.md listing breaking changes doc chronologically (#56019) --- docs/compilers/CSharp/readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/compilers/CSharp/readme.md diff --git a/docs/compilers/CSharp/readme.md b/docs/compilers/CSharp/readme.md new file mode 100644 index 0000000000000..2bd717adf176a --- /dev/null +++ b/docs/compilers/CSharp/readme.md @@ -0,0 +1,10 @@ +Breaking changes (newest release on top): + +- [.NET 6 and Visual Studio 2022](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%206.md) +- [Minor releases following .NET 5 and Visual Studio 2019 version 16.9](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20post%20DotNet%205.md) +- [.NET 5 and Visual Studio 2019 version 16.9](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%205.md) +- [Minor releases following Visual Studio 2019 version 16.0](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20post%20VS2019.md) +- [Visual Studio 2019 version 16.0](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20VS2019.md) +- [Minor releases following Visual Studio 2017 version 15.0](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20post%20VS2017.md) +- [Visual Studio 2017 version 15.0](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20VS2017.md) +- [Visual Studio 2015 version 14.0](https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20VS2015.md) From 5851730e82f7805df3559444fd0f605243bd1adf Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Tue, 7 Sep 2021 11:21:01 -0700 Subject: [PATCH 7/7] Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. (#56173) Closes #53800. Related to #56171. --- eng/Versions.props | 1 + .../CSharp/Portable/Symbols/AssemblySymbol.cs | 3 +- .../Test/Emit/Attributes/AttributeTests.cs | 2 +- .../DefaultInterfaceImplementationTests.cs | 6 +- .../Symbol/Symbols/MissingSpecialMember.cs | 1 + .../StaticAbstractMembersInInterfacesTests.cs | 947 +++++++++--------- src/Compilers/Core/Portable/SpecialMember.cs | 1 + src/Compilers/Core/Portable/SpecialMembers.cs | 7 + ...crosoft.CodeAnalysis.Test.Utilities.csproj | 1 + .../Test/Core/TargetFrameworkUtil.cs | 6 +- .../WellKnownTypeValidationTests.vb | 1 + .../ImplementInterfaceTests.cs | 24 +- 12 files changed, 518 insertions(+), 482 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 7527c1b1bb5f8..1b0533541cfe2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -52,6 +52,7 @@ 0.9.3 1.2.1 1.2.1 + 1.2.2 0.13.0 0.13.0 1.4.4 diff --git a/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs index b72a47fb05017..1f39620a8b0c2 100644 --- a/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs @@ -436,8 +436,7 @@ internal bool RuntimeSupportsDefaultInterfaceImplementation /// internal bool RuntimeSupportsStaticAbstractMembersInInterfaces { - // https://github.com/dotnet/roslyn/issues/53800: Implement the actual check, this is a temporary stub. - get => RuntimeSupportsDefaultInterfaceImplementation; + get => RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__VirtualStaticsInInterfaces); } private bool RuntimeSupportsFeature(SpecialMember feature) diff --git a/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs b/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs index 2b9e107c94dc1..344c9ef91c240 100644 --- a/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs @@ -10100,7 +10100,7 @@ public static void Main() } } "; - var comp = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(source, targetFramework: TargetFramework.Net60); comp.VerifyEmitDiagnostics(); } diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs index ee681eee7a4cf..744421583f648 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs @@ -7003,7 +7003,7 @@ class Test2 : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); compilation1.VerifyDiagnostics( // (10,24): error CS8703: The modifier 'sealed' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -12210,7 +12210,7 @@ class Test2 : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); compilation1.VerifyDiagnostics( // (4,25): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -25379,7 +25379,7 @@ class Test2 : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); compilation1.VerifyDiagnostics( // (8,46): error CS0073: An add or remove accessor must have a body diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs index 5a2b786ec2ec3..fa901821053c8 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs @@ -542,6 +542,7 @@ public void AllSpecialTypeMembers() var symbol = comp.GetSpecialTypeMember(special); if (special == SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__DefaultImplementationsOfInterfaces || special == SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__CovariantReturnsOfClasses + || special == SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__VirtualStaticsInInterfaces || special == SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__UnmanagedSignatureCallingConvention || special == SpecialMember.System_Runtime_CompilerServices_PreserveBaseOverridesAttribute__ctor) { diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs index e0dd8695f7fa4..f96ce8371b9bd 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs @@ -25,6 +25,8 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols { public class StaticAbstractMembersInInterfacesTests : CSharpTestBase { + private const TargetFramework _supportingFramework = TargetFramework.Net60; + [Fact] public void MethodModifiers_01() { @@ -65,7 +67,7 @@ sealed override static void M10() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -303,7 +305,7 @@ sealed override static void M10() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -411,7 +413,7 @@ sealed override static void M10() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (7,25): error CS0112: A static member cannot be marked as 'virtual' @@ -504,7 +506,7 @@ sealed override static void M10() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS0500: 'I1.M01()' cannot declare a body because it is marked abstract @@ -591,7 +593,7 @@ sealed override static void M10() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -714,7 +716,7 @@ sealed override static void M10() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -823,7 +825,7 @@ partial sealed static I3() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,19): error CS0106: The modifier 'sealed' is not valid for this item @@ -908,7 +910,7 @@ sealed static partial I3() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,19): error CS0246: The type or namespace name 'partial' could not be found (are you missing a using directive or an assembly reference?) @@ -978,7 +980,7 @@ interface I3 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,21): error CS0106: The modifier 'abstract' is not valid for this item @@ -1018,7 +1020,7 @@ partial interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -1055,7 +1057,7 @@ sealed static partial void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); ValidatePartialSealedStatic_02(compilation1); } @@ -1111,7 +1113,7 @@ sealed static partial void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); ValidatePartialSealedStatic_02(compilation1); } @@ -1132,7 +1134,7 @@ static partial void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); ValidatePartialSealedStatic_02(compilation1); } @@ -1149,7 +1151,7 @@ partial interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,34): error CS0750: A partial method cannot have the 'abstract' modifier @@ -1190,7 +1192,7 @@ abstract static partial void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,34): error CS0750: A partial method cannot have the 'abstract' modifier @@ -1251,7 +1253,7 @@ static partial void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,34): error CS0750: A partial method cannot have the 'abstract' modifier @@ -1306,7 +1308,7 @@ abstract static partial void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,34): error CS0500: 'I1.M01()' cannot declare a body because it is marked abstract @@ -1363,7 +1365,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,34): error CS0621: 'I1.M01()': virtual or abstract members cannot be private @@ -1421,7 +1423,7 @@ sealed override static bool M10 { get "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -1745,7 +1747,7 @@ sealed override static bool M10 { get "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -1853,7 +1855,7 @@ sealed override static bool M10 { get "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (7,25): error CS0112: A static member cannot be marked as 'virtual' @@ -1928,7 +1930,7 @@ sealed override static bool M10 { get "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,32): error CS0500: 'I1.M01.get' cannot declare a body because it is marked abstract @@ -2015,7 +2017,7 @@ sealed override static bool M10 { get "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -2120,7 +2122,7 @@ sealed override static bool M10 { get "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,26): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -2239,7 +2241,7 @@ sealed override static event D M10 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,29): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -2571,7 +2573,7 @@ sealed override static event D M10 { add {} remove {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,29): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -2681,7 +2683,7 @@ sealed override static event D M10 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (7,28): error CS0112: A static member cannot be marked as 'virtual' @@ -2757,7 +2759,7 @@ sealed override static event D M10 { add {} remove {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,33): error CS8712: 'I1.M01': abstract event cannot use event accessor syntax @@ -2846,7 +2848,7 @@ sealed override static event D M10 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,29): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -2952,7 +2954,7 @@ sealed override static event D M10 { add {} remove {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,29): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -3069,7 +3071,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,32): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -3307,7 +3309,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,32): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -3415,7 +3417,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (7,31): error CS0106: The modifier 'virtual' is not valid for this item @@ -3508,7 +3510,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,32): error CS0500: 'I1.operator +(I1)' cannot declare a body because it is marked abstract @@ -3595,7 +3597,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,32): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -3718,7 +3720,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,32): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -3823,7 +3825,7 @@ public interface I3 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,34): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -3868,7 +3870,7 @@ public interface I3 compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,34): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -3913,7 +3915,7 @@ public interface I3 compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (6,34): error CS0500: 'I1.operator !=(I1, I1)' cannot declare a body because it is marked abstract @@ -4015,7 +4017,7 @@ public interface I3 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular7_3, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,39): error CS8703: The modifier 'abstract' is not valid for this item in C# 7.3. Please use language version 'preview' or greater. @@ -4078,7 +4080,7 @@ public interface I3 compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,39): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -4141,7 +4143,7 @@ public interface I3 compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,39): error CS0552: 'I1.implicit operator int(I1)': user-defined conversions to or from an interface are not allowed @@ -4248,7 +4250,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,25): error CS0681: The modifier 'abstract' is not valid on fields. Try using a property instead. @@ -4287,7 +4289,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,33): error CS0180: 'I1.M01()' cannot be both extern and abstract @@ -4320,7 +4322,7 @@ extern abstract static event System.Action E01 { add {} remove {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,33): error CS0180: 'I1.M01()' cannot be both extern and abstract @@ -4358,7 +4360,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -4378,7 +4380,7 @@ abstract class C1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,33): error CS0112: A static member cannot be marked as 'abstract' @@ -4414,7 +4416,7 @@ sealed static event System.Action E01 { add {} remove {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,24): error CS0238: 'C1.M01()' cannot be sealed because it is not an override @@ -4447,7 +4449,7 @@ struct C1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,33): error CS0112: A static member cannot be marked as 'abstract' @@ -4483,7 +4485,7 @@ sealed static event System.Action E01 { add {} remove {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,24): error CS0238: 'C1.M01()' cannot be sealed because it is not an override @@ -4513,7 +4515,10 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); + + Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); + Assert.True(compilation1.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -4551,6 +4556,22 @@ interface I1 // abstract static void M01(); Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "M01").WithLocation(4, 26) ); + + Assert.False(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); + Assert.False(compilation1.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces); + + var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: TargetFramework.Net50); + + compilation2.VerifyDiagnostics( + // (4,26): error CS8919: Target runtime doesn't support static abstract members in interfaces. + // abstract static void M01(); + Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "M01").WithLocation(4, 26) + ); + + Assert.True(compilation2.Assembly.RuntimeSupportsDefaultInterfaceImplementation); + Assert.False(compilation2.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces); } [Theory] @@ -4581,7 +4602,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -4619,7 +4640,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -4743,7 +4764,7 @@ interface I1 where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -4805,7 +4826,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -4874,7 +4895,7 @@ interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -4948,7 +4969,7 @@ public interface I3 : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var source2 = @" @@ -5023,7 +5044,7 @@ void Test(C8 x) "; var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); var expected = new[] { @@ -5063,7 +5084,7 @@ void Test(C8 x) compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.EmitToImageReference() }); compilation2.VerifyDiagnostics(expected); @@ -5091,7 +5112,7 @@ public static void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var source2 = @" @@ -5143,14 +5164,14 @@ class C6 : C5 "; var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyEmitDiagnostics(); compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.EmitToImageReference() }); compilation2.VerifyEmitDiagnostics(); @@ -5172,7 +5193,7 @@ interface I2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (5,21): error CS1961: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.P2'. 'T2' is contravariant. // abstract static T2 P2 { get; } @@ -5199,7 +5220,7 @@ interface I2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (5,21): error CS1961: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.M2()'. 'T2' is contravariant. // abstract static T2 M2(); @@ -5226,7 +5247,7 @@ interface I2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (5,58): error CS1961: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.E2'. 'T2' is contravariant. // abstract static event System.Action> E2; @@ -5255,7 +5276,7 @@ interface I3 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,36): error CS1961: Invalid variance: The type parameter 'T2' must be contravariantly valid on 'I2.operator +(I2)'. 'T2' is covariant. // abstract static int operator +(I2 x); @@ -5337,7 +5358,7 @@ interface I13 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.ERR_OperatorNeedsMatch).Verify( // (4,26): error CS0562: The parameter of a unary operator must be the containing type // static bool operator +(T1 x) => throw null; @@ -5433,7 +5454,7 @@ interface I13 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,24): error CS0559: The parameter type for ++ or -- operator must be the containing type // static T1 operator ++(T1 x) => throw null; @@ -5540,7 +5561,7 @@ interface I15 where T151 : I15 where T152 : I15 x) => throw null; @@ -5647,7 +5668,7 @@ interface I13 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators)).Verify( // (4,26): error CS0563: One of the parameters of a binary operator must be the containing type // static bool operator +(T1 x, bool y) => throw null; @@ -5742,7 +5763,7 @@ interface I13 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators)).Verify( // (4,26): error CS0563: One of the parameters of a binary operator must be the containing type // static bool operator +(bool y, T1 x) => throw null; @@ -5843,7 +5864,7 @@ interface I14 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.ERR_OperatorNeedsMatch).Verify( // (4,26): error CS0564: The first operand of an overloaded shift operator must have the same type as the containing type, and the type of the second operand must be int // static bool operator <<(T1 x, int y) => throw null; @@ -5964,7 +5985,7 @@ interface I19 where T19_1 : I19, T19_2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,39): error CS0555: User-defined operator cannot convert a type to itself // abstract static explicit operator T1(T1 y); @@ -6085,7 +6106,7 @@ interface I19 where T19_1 : I19, T19_2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,39): error CS0555: User-defined operator cannot convert a type to itself // abstract static explicit operator T1(T1 y); @@ -6166,7 +6187,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,9): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -6252,7 +6273,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (35,20): error CS0119: 'T' is a type parameter, which is not valid in the given context @@ -6301,7 +6322,7 @@ static async void M05() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -6335,7 +6356,7 @@ .locals init (string V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -6413,7 +6434,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -6458,7 +6479,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); // https://github.com/dotnet/roslyn/issues/53796: Confirm whether we want to enable the 'from t in T' scenario. compilation1.VerifyDiagnostics( @@ -6493,11 +6514,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -6508,7 +6529,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -6563,7 +6584,7 @@ static void MT2() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -6619,7 +6640,7 @@ static T M02(T x) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -6782,7 +6803,7 @@ .locals init (T? V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -6980,7 +7001,7 @@ static void M02(T x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -7034,11 +7055,11 @@ static void M02(T x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -7049,7 +7070,7 @@ static void M02(T x) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (12,31): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -7094,7 +7115,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (9,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -7133,7 +7154,7 @@ static void M02(T x) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -7154,7 +7175,7 @@ .maxstack 1 compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -7216,7 +7237,7 @@ static void M02(T x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -7266,11 +7287,11 @@ static void M02(T x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -7281,7 +7302,7 @@ static void M02(T x) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (12,35): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -7339,7 +7360,7 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (9,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -7388,7 +7409,7 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -7463,7 +7484,7 @@ .locals init (System.ValueTuple> V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -7584,7 +7605,7 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -7644,11 +7665,11 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -7659,7 +7680,7 @@ class C var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (21,35): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -7721,7 +7742,7 @@ public partial interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -7803,7 +7824,7 @@ static void MT4() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); if (success) { @@ -8009,7 +8030,7 @@ static void MT2() where T : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,9): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -8124,7 +8145,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (12,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -8208,7 +8229,7 @@ static void M07(T x, I1 y) where T : U where U : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -8321,7 +8342,7 @@ .locals init (T? V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -8495,7 +8516,7 @@ public partial interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -8560,7 +8581,7 @@ .maxstack 2 compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -8669,7 +8690,7 @@ public partial interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -8743,7 +8764,7 @@ .locals init (T? V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -8884,7 +8905,7 @@ static void M04(T? x, T? y) where T : struct, U where U : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); verifier.VerifyIL("Test.M03(T, T)", @@ -8949,7 +8970,7 @@ .locals init (T? V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); verifier.VerifyIL("Test.M03(T, T)", @@ -9052,7 +9073,7 @@ static void M04(T? x, T? y) where T : struct, U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -9163,7 +9184,7 @@ .locals init (I1 V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -9365,7 +9386,7 @@ static void M05(T? y) where T : struct, U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -9495,7 +9516,7 @@ .locals init (T? V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -9659,7 +9680,7 @@ static void M02((int, T) x) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -9730,7 +9751,7 @@ .locals init (System.ValueTuple V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -9837,7 +9858,7 @@ static void M02(T x, int y) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -9893,7 +9914,7 @@ static void M02(T x, T y) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -9981,7 +10002,7 @@ static void M02(T x, int y) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -10029,7 +10050,7 @@ static void M02((int, T) x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -10079,11 +10100,11 @@ static void M02(T x, int y) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -10094,7 +10115,7 @@ static void M02(T x, int y) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.ERR_OperatorNeedsMatch).Verify( // (12,32): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -10135,11 +10156,11 @@ static void M02(T x, T y) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreAppAndCSharp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); if (success) @@ -10157,7 +10178,7 @@ static void M02(T x, T y) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var builder = ArrayBuilder.GetInstance(); @@ -10223,11 +10244,11 @@ static void M02(T x, int y) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -10238,7 +10259,7 @@ static void M02(T x, int y) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (12,31): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -10271,11 +10292,11 @@ static void M02((int, T) x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -10286,7 +10307,7 @@ static void M02((int, T) x) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (12,35): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -10347,7 +10368,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -10435,7 +10456,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,9): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -10526,7 +10547,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,9): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -10621,7 +10642,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (14,20): error CS0176: Member 'I1.P01' cannot be accessed with an instance reference; qualify it with a type name instead @@ -10671,7 +10692,7 @@ static void M02() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -10690,7 +10711,7 @@ .maxstack 1 compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -10756,7 +10777,7 @@ static void M02() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -10776,7 +10797,7 @@ .maxstack 1 compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -10847,7 +10868,7 @@ static string M03() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -10885,7 +10906,7 @@ .locals init (string V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -10966,7 +10987,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -11015,7 +11036,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -11064,7 +11085,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -11116,11 +11137,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -11131,7 +11152,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,13): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -11165,11 +11186,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -11180,7 +11201,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -11214,11 +11235,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -11229,7 +11250,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -11290,7 +11311,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,9): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -11384,7 +11405,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,9): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -11476,7 +11497,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (14,20): error CS0176: Member 'I1.P01' cannot be accessed with an instance reference; qualify it with a type name instead @@ -11532,7 +11553,7 @@ static string M03() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -11571,7 +11592,7 @@ .locals init (string V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -11652,7 +11673,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -11698,7 +11719,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -11744,11 +11765,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -11759,7 +11780,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -11793,11 +11814,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -11808,7 +11829,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -11875,7 +11896,7 @@ static string M03() where T : I1 "; var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (6,9): error CS0119: 'T' is a type parameter, which is not valid in the given context @@ -11903,7 +11924,7 @@ static void M03() where T : I1 "; var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (6,9): error CS0119: 'T' is a type, which is not valid in the given context @@ -11969,7 +11990,7 @@ static string M03() where T : I1 "; var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (6,11): error CS1545: Property, indexer, or event 'I1.Item[int]' is not supported by the language; try directly calling accessor methods 'I1.get_Item(int)' or 'I1.set_Item(int, int)' @@ -11992,7 +12013,7 @@ static void M02() where T : I1 "; var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation2, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12065,7 +12086,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -12124,7 +12145,7 @@ static System.Action M02() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12148,7 +12169,7 @@ .locals init (System.Action V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12203,7 +12224,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -12249,11 +12270,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -12264,7 +12285,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,28): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -12325,7 +12346,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,31): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -12384,7 +12405,7 @@ static System.Action M02() where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12408,7 +12429,7 @@ .locals init (System.Action V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12463,7 +12484,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -12509,11 +12530,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -12524,7 +12545,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,31): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -12585,7 +12606,7 @@ static void MT2() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,13): error CS8926: A static abstract interface member can be accessed only on a type parameter. @@ -12647,7 +12668,7 @@ unsafe class Test "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12669,7 +12690,7 @@ .locals init (delegate* V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -12722,7 +12743,7 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, @@ -12768,11 +12789,11 @@ static void M02() where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -12783,7 +12804,7 @@ static void M02() where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (6,31): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -12845,7 +12866,7 @@ void I1.M01() {} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.M01()' @@ -12925,7 +12946,7 @@ static void I1.M01() {} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.M01()' @@ -13001,7 +13022,7 @@ interface I8 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (12,25): warning CS0108: 'I3.M01()' hides inherited member 'I1.M01()'. Use the new keyword if hiding was intended. @@ -13065,11 +13086,11 @@ public static void M02() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -13080,7 +13101,7 @@ public static void M02() {} var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (4,20): error CS8703: The modifier 'static' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -13117,7 +13138,7 @@ public static void M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -13166,7 +13187,7 @@ static void I1.M01() {} "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -13217,7 +13238,7 @@ public static void M01() {} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -13278,7 +13299,7 @@ static void I1.M01() {} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -13332,7 +13353,7 @@ static void I1.M01() {} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -13349,7 +13370,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -13447,7 +13468,7 @@ public class C5 : C2, I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -13474,7 +13495,7 @@ public class C5 : C2, I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -13504,7 +13525,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -13517,7 +13538,7 @@ public class C1 : I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -13531,7 +13552,7 @@ static void I1.M01() {} var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyEmitDiagnostics( // (4,19): error CS0539: 'C1.M01()' in explicit interface declaration is not found among members of the interface that can be implemented @@ -13580,7 +13601,7 @@ public class C1 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01()' @@ -13624,7 +13645,7 @@ class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -13708,7 +13729,7 @@ static void I1.M01() {} var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -13807,7 +13828,7 @@ static void I1.M02() {} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -13824,7 +13845,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -13893,7 +13914,7 @@ public class C2 : C1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -13910,7 +13931,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); var verifier = CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -13985,8 +14006,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -14004,7 +14025,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -14068,8 +14089,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -14087,7 +14108,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -14149,8 +14170,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -14168,7 +14189,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -14218,8 +14239,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains("M01")).Count()); @@ -14238,7 +14259,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -14292,8 +14313,8 @@ public class C11 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -14311,7 +14332,7 @@ public class C2 : C11, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -14378,8 +14399,8 @@ public class C11 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -14397,7 +14418,7 @@ public class C2 : C11, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -14515,7 +14536,7 @@ public interface I2 where T : I2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadIncDecRetType or (int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.ERR_OpTFRetType)).Verify( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.operator +(C1)' @@ -14653,7 +14674,7 @@ public interface I2 where T : I2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.WRN_EqualityOpWithoutEquals or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode)).Verify( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.operator >>(C1, int)' @@ -14787,7 +14808,7 @@ interface I14 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); ErrorCode badSignatureError = op.Length != 2 ? ErrorCode.ERR_BadUnaryOperatorSignature : ErrorCode.ERR_BadIncDecSignature; ErrorCode badAbstractSignatureError = op.Length != 2 ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadAbstractIncDecSignature; @@ -14950,7 +14971,7 @@ interface I14 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); bool isShift = op == "<<" || op == ">>"; ErrorCode badSignatureError = isShift ? ErrorCode.ERR_BadShiftOperatorSignature : ErrorCode.ERR_BadBinaryOperatorSignature; @@ -15098,11 +15119,11 @@ public interface I2 where T : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.ERR_OpTFRetType)).Verify( @@ -15113,7 +15134,7 @@ public interface I2 where T : I2 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.ERR_OpTFRetType)).Verify( // (4,15): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -15160,11 +15181,11 @@ public interface I2 where T : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.WRN_EqualityOpWithoutEquals or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode)).Verify( @@ -15175,7 +15196,7 @@ public interface I2 where T : I2 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OperatorNeedsMatch or (int)ErrorCode.WRN_EqualityOpWithoutEquals or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode)).Verify( // (4,15): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -15212,7 +15233,7 @@ public interface I1 where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -15261,7 +15282,7 @@ public interface I1 where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -15310,7 +15331,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -15359,7 +15380,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -15411,7 +15432,7 @@ public interface I1 where T : I1 var opName = UnaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -15491,7 +15512,7 @@ public partial interface I1 where T : I1 var opName = UnaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -15576,7 +15597,7 @@ public partial interface I1 where T : I1 var opName = BinaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -15641,7 +15662,7 @@ public interface I1 var opName = UnaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var tree = compilation1.SyntaxTrees.Single(); var model = compilation1.GetSemanticModel(tree); @@ -15723,7 +15744,7 @@ public partial interface I1 var opName = UnaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var tree = compilation1.SyntaxTrees.Single(); var model = compilation1.GetSemanticModel(tree); @@ -15808,7 +15829,7 @@ public partial interface I1 var opName = BinaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var tree = compilation1.SyntaxTrees.Single(); @@ -15872,7 +15893,7 @@ public class C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -15891,7 +15912,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -15945,7 +15966,7 @@ public partial class C2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -15964,7 +15985,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -16021,7 +16042,7 @@ public partial class C2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -16040,7 +16061,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -16145,7 +16166,7 @@ public class C5 : C2, I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -16178,7 +16199,7 @@ public class C5 : C2, I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -16270,7 +16291,7 @@ public class C5 : C2, I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -16303,7 +16324,7 @@ public class C5 : C2, I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -16339,7 +16360,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -16353,7 +16374,7 @@ public class C1 : I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -16367,7 +16388,7 @@ public class C1 : I1 var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyEmitDiagnostics( // (4,27): error CS0539: 'C1.operator ~(I1)' in explicit interface declaration is not found among members of the interface that can be implemented @@ -16414,7 +16435,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -16428,7 +16449,7 @@ public class C1 : I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -16442,7 +16463,7 @@ public class C1 : I1 var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyEmitDiagnostics( // (4,27): error CS0539: 'C1.operator <(I1, int)' in explicit interface declaration is not found among members of the interface that can be implemented @@ -16498,7 +16519,7 @@ public class C1 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.operator ~(I1)' @@ -16561,7 +16582,7 @@ public class C1 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.operator /(I1, int)' @@ -16627,7 +16648,7 @@ public partial class C1 var opName = BinaryOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -16728,7 +16749,7 @@ class C2 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -16839,7 +16860,7 @@ class C2 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -16968,7 +16989,7 @@ class C2 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -17063,7 +17084,7 @@ public partial class C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -17082,7 +17103,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -17123,7 +17144,7 @@ public partial class C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -17141,7 +17162,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -17218,7 +17239,7 @@ public partial class C2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -17237,7 +17258,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -17331,7 +17352,7 @@ public partial class C2 : C1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -17350,7 +17371,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); var verifier = CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -17450,8 +17471,8 @@ public partial class C1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); compilation1.VerifyDiagnostics(); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains(opName)).Count()); @@ -17469,7 +17490,7 @@ public class C2 : C1, I1, int> { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -17553,8 +17574,8 @@ public partial class C1 : I1, U> var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); compilation1.VerifyDiagnostics(); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains(opName)).Count()); @@ -17572,7 +17593,7 @@ public class C2 : C1, I1, int> { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -17649,8 +17670,8 @@ public partial class C1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); compilation1.VerifyDiagnostics(); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains(opName)).Count()); @@ -17668,7 +17689,7 @@ public class C2 : C11, I1, C1> { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -17806,7 +17827,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var c1 = compilation1.GlobalNamespace.GetTypeMember("C1"); @@ -17956,7 +17977,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var c1 = compilation1.GlobalNamespace.GetTypeMember("C1"); @@ -18026,7 +18047,7 @@ class C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_OpTFRetType or (int)ErrorCode.ERR_OperatorNeedsMatch)).Verify( // (9,20): error CS0540: 'C1.I1.operator -(I1)': containing type does not implement interface 'I1' @@ -18071,7 +18092,7 @@ struct C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.ERR_OperatorNeedsMatch).Verify( // (9,23): error CS0540: 'C1.I1.operator %(I1, int)': containing type does not implement interface 'I1' @@ -18142,7 +18163,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -18222,7 +18243,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -18298,7 +18319,7 @@ interface I8 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (12,24): warning CS0108: 'I3.M01' hides inherited member 'I1.M01'. Use the new keyword if hiding was intended. @@ -18363,11 +18384,11 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -18378,7 +18399,7 @@ public interface I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (4,19): error CS8703: The modifier 'static' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -18415,7 +18436,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -18479,7 +18500,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -18533,7 +18554,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -18627,7 +18648,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -18717,7 +18738,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -18803,7 +18824,7 @@ public class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -18820,7 +18841,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -18982,7 +19003,7 @@ public class C5 : C2, I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -19023,7 +19044,7 @@ public class C5 : C2, I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -19073,7 +19094,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -19090,7 +19111,7 @@ public class C1 : I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -19104,7 +19125,7 @@ public class C1 : I1 var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyEmitDiagnostics( // (4,18): error CS0539: 'C1.M01' in explicit interface declaration is not found among members of the interface that can be implemented @@ -19132,7 +19153,7 @@ public class C1 : I1 var compilation3 = CreateCompilationWithIL(source3, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19184,7 +19205,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -19213,7 +19234,7 @@ public class C1 : I1 var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation2, sourceSymbolValidator: validate2, symbolValidator: validate2, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19265,7 +19286,7 @@ public class C1 : I1 var compilation3 = CreateCompilationWithIL(source3, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19338,7 +19359,7 @@ public class C1 : I1 var compilation4 = CreateCompilationWithIL(source4, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation4.VerifyDiagnostics( // (4,29): error CS0550: 'C1.I1.M01.set' adds an accessor not found in interface member 'I1.M01' @@ -19368,7 +19389,7 @@ public class C1 : I1 var compilation5 = CreateCompilationWithIL(source5, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation5, sourceSymbolValidator: validate5, symbolValidator: validate5, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19427,7 +19448,7 @@ public static int M01 { set{} } var compilation6 = CreateCompilationWithIL(source6, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation6.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.get' @@ -19454,7 +19475,7 @@ static int I1.M01 { set{} } var compilation7 = CreateCompilationWithIL(source7, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation7.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.get' @@ -19516,7 +19537,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -19545,7 +19566,7 @@ static int I1.M01 { set{} } var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation2, sourceSymbolValidator: validate2, symbolValidator: validate2, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19597,7 +19618,7 @@ public class C1 : I1 var compilation3 = CreateCompilationWithIL(source3, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19670,7 +19691,7 @@ public class C1 : I1 var compilation4 = CreateCompilationWithIL(source4, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation4.VerifyDiagnostics( // (4,24): error CS0550: 'C1.I1.M01.get' adds an accessor not found in interface member 'I1.M01' @@ -19700,7 +19721,7 @@ public static int M01 { set{} } var compilation5 = CreateCompilationWithIL(source5, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation5, sourceSymbolValidator: validate5, symbolValidator: validate5, verify: Verification.Skipped).VerifyDiagnostics(); @@ -19759,7 +19780,7 @@ public class C1 : I1 var compilation6 = CreateCompilationWithIL(source6, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation6.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.set' @@ -19786,7 +19807,7 @@ public class C1 : I1 var compilation7 = CreateCompilationWithIL(source7, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation7.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.set' @@ -19877,7 +19898,7 @@ public class C1 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -19927,7 +19948,7 @@ class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -20116,7 +20137,7 @@ class C3 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -20296,7 +20317,7 @@ public class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -20313,7 +20334,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -20409,7 +20430,7 @@ public class C2 : C1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -20426,7 +20447,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); var verifier = CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -20536,8 +20557,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -20555,7 +20576,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -20605,8 +20626,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType().Where(m => m.Name.Contains("M01")).Count()); @@ -20625,7 +20646,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -20696,7 +20717,7 @@ static event System.Action I1.M01 { add{} remove{}} var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -20776,7 +20797,7 @@ event System.Action I1.M01 { add{} remove{} } var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -20852,7 +20873,7 @@ interface I8 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (12,40): warning CS0108: 'I3.M01' hides inherited member 'I1.M01'. Use the new keyword if hiding was intended. @@ -20917,11 +20938,11 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -20935,7 +20956,7 @@ public interface I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (4,35): error CS8703: The modifier 'static' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -20975,7 +20996,7 @@ public static event System.Action M01 { add{} remove{} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -21036,7 +21057,7 @@ public interface I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -21087,7 +21108,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -21181,7 +21202,7 @@ public interface I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -21267,7 +21288,7 @@ public class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -21284,7 +21305,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -21451,7 +21472,7 @@ public class C5 : C2, I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -21492,7 +21513,7 @@ public class C5 : C2, I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -21543,7 +21564,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -21560,7 +21581,7 @@ public class C1 : I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -21574,7 +21595,7 @@ static event System.Action I1.M01 { add{} remove{} } var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyEmitDiagnostics( // (4,34): error CS0539: 'C1.M01' in explicit interface declaration is not found among members of the interface that can be implemented @@ -21602,7 +21623,7 @@ public static event System.Action M01 { add{} remove{} } var compilation3 = CreateCompilationWithIL(source3, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); @@ -21656,7 +21677,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -21685,7 +21706,7 @@ static event System.Action I1.M01 { add {} } var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (4,34): error CS0065: 'C1.I1.M01': event property must have both add and remove accessors @@ -21714,7 +21735,7 @@ public static event System.Action M01 { add{} remove{} } var compilation3 = CreateCompilationWithIL(source3, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); @@ -21786,7 +21807,7 @@ static event System.Action I1.M01 { add{} remove{} } var compilation4 = CreateCompilationWithIL(source4, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation4.VerifyDiagnostics( // (4,46): error CS0550: 'C1.I1.M01.remove' adds an accessor not found in interface member 'I1.M01' @@ -21816,7 +21837,7 @@ public static event System.Action M01 { add{} } var compilation5 = CreateCompilationWithIL(source5, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation5.VerifyDiagnostics( // (4,38): error CS0065: 'C1.M01': event property must have both add and remove accessors @@ -21843,7 +21864,7 @@ public static event System.Action M01 { remove{} } var compilation6 = CreateCompilationWithIL(source6, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation6.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.add' @@ -21873,7 +21894,7 @@ static event System.Action I1.M01 { remove{} } var compilation7 = CreateCompilationWithIL(source7, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation7.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.add' @@ -21936,7 +21957,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -21965,7 +21986,7 @@ static event System.Action I1.M01 { remove {} } var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (4,34): error CS0065: 'C1.I1.M01': event property must have both add and remove accessors @@ -21994,7 +22015,7 @@ public static event System.Action M01 { add{} remove{} } var compilation3 = CreateCompilationWithIL(source3, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); @@ -22066,7 +22087,7 @@ static event System.Action I1.M01 { add{} remove{} } var compilation4 = CreateCompilationWithIL(source4, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation4.VerifyDiagnostics( // (4,40): error CS0550: 'C1.I1.M01.add' adds an accessor not found in interface member 'I1.M01' @@ -22096,7 +22117,7 @@ public static event System.Action M01 { remove{} } var compilation5 = CreateCompilationWithIL(source5, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation5.VerifyDiagnostics( // (4,38): error CS0065: 'C1.M01': event property must have both add and remove accessors @@ -22123,7 +22144,7 @@ public static event System.Action M01 { add{} } var compilation6 = CreateCompilationWithIL(source6, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation6.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.remove' @@ -22153,7 +22174,7 @@ static event System.Action I1.M01 { add{} } var compilation7 = CreateCompilationWithIL(source7, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation7.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.remove' @@ -22247,7 +22268,7 @@ public class C1 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01' @@ -22297,7 +22318,7 @@ class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -22498,7 +22519,7 @@ class C4 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -22802,7 +22823,7 @@ public class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -22819,7 +22840,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -22915,7 +22936,7 @@ public class C2 : C1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -22932,7 +22953,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); var verifier = CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -23043,8 +23064,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType().Where(m => m.Name.Contains("M01")).Count()); compilation1.VerifyDiagnostics(); @@ -23062,7 +23083,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -23112,8 +23133,8 @@ public class C1 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType().Where(m => m.Name.Contains("M01")).Count()); @@ -23132,7 +23153,7 @@ public class C2 : C1, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -23236,7 +23257,7 @@ public interface I2 where T : I2 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.explicit operator int(C1)' @@ -23370,7 +23391,7 @@ interface I14 : I1 where T : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (12,23): error CS0556: User-defined conversion must convert to or from the enclosing type @@ -23486,11 +23507,11 @@ public interface I2 where T : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -23501,7 +23522,7 @@ public interface I2 where T : I2 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (4,21): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. @@ -23535,7 +23556,7 @@ public interface I1 where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -23584,7 +23605,7 @@ public interface I1 where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -23638,7 +23659,7 @@ public interface I1 where T : I1 var opName = ConversionOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -23730,7 +23751,7 @@ interface I1 where T : I1 var opName = ConversionOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var tree = compilation1.SyntaxTrees.Single(); var model = compilation1.GetSemanticModel(tree); @@ -23808,7 +23829,7 @@ public class C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -23827,7 +23848,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -23944,7 +23965,7 @@ public class C5 : C2, I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -23977,7 +23998,7 @@ public class C5 : C2, I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); } @@ -24014,7 +24035,7 @@ public class C1 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -24028,7 +24049,7 @@ public class C1 : I1 compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics(); @@ -24042,7 +24063,7 @@ public class C1 : I1 var compilation2 = CreateCompilationWithIL(source2, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyEmitDiagnostics( // (4,37): error CS0539: 'C1.implicit operator int(C1)' in explicit interface declaration is not found among members of the interface that can be implemented @@ -24102,7 +24123,7 @@ public class C1 : I2 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyEmitDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.explicit operator int(C1)' @@ -24149,7 +24170,7 @@ public class C2 : C1, I1 var opName = ConversionOperatorName(op); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -24249,7 +24270,7 @@ class C2 : I1 var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -24350,7 +24371,7 @@ public class C2 : C1, I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics(); @@ -24369,7 +24390,7 @@ public class C3 : C2, I1 { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); } @@ -24445,8 +24466,8 @@ public class C1 : I1, U> var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); compilation1.VerifyDiagnostics(); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains(opName)).Count()); @@ -24464,7 +24485,7 @@ public class C2 : C1, I1, int> { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -24527,8 +24548,8 @@ public class C1 : I1, U> var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, - references: new[] { CreateCompilation("", targetFramework: TargetFramework.NetCoreApp).ToMetadataReference() }); + targetFramework: _supportingFramework, + references: new[] { CreateCompilation("", targetFramework: _supportingFramework).ToMetadataReference() }); compilation1.VerifyDiagnostics(); Assert.Equal(2, compilation1.GlobalNamespace.GetTypeMember("C1").GetMembers().Where(m => m.Name.Contains(opName)).Count()); @@ -24546,7 +24567,7 @@ public class C2 : C1, I1, int> { var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: parseOptions, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { reference }); CompileAndVerify(compilation2, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -24666,7 +24687,7 @@ public interface I1 where T : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var c1 = compilation1.GlobalNamespace.GetTypeMember("C1"); @@ -24733,7 +24754,7 @@ class C2 : I1 var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (9,21): error CS0540: 'C1.I1.implicit operator int(int)': containing type does not implement interface 'I1' @@ -24789,7 +24810,7 @@ static void MT2() "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var error = (op == "explicit" ? ErrorCode.ERR_NoExplicitConv : ErrorCode.ERR_NoImplicitConv); @@ -24855,7 +24876,7 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (4,39): error CS0552: 'I1.implicit operator bool(I1)': user-defined conversions to or from an interface are not allowed @@ -24915,7 +24936,7 @@ static int M02(T x) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25001,7 +25022,7 @@ .locals init (int? V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25115,7 +25136,7 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25188,7 +25209,7 @@ .locals init (System.ValueTuple> V_0, compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25299,7 +25320,7 @@ static int M02(T x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -25355,7 +25376,7 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, @@ -25404,11 +25425,11 @@ static int M02(T x) where T : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -25419,7 +25440,7 @@ static int M02(T x) where T : I1 var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.ERR_OperatorNeedsMatch).Verify( // (12,39): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -25460,11 +25481,11 @@ class C "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); compilation2.VerifyDiagnostics( @@ -25475,7 +25496,7 @@ class C var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation3.VerifyDiagnostics( // (21,39): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. @@ -25525,7 +25546,7 @@ static T M02(int x) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25611,7 +25632,7 @@ .locals init (T? V_0) compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25731,7 +25752,7 @@ static int M03(C1 y) where T : I1> "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var error = (op == "explicit" ? ErrorCode.ERR_NoExplicitConv : ErrorCode.ERR_NoImplicitConv); @@ -25781,7 +25802,7 @@ static C1 M03(int y) where T : I1> "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var error = (op == "explicit" ? ErrorCode.ERR_NoExplicitConv : ErrorCode.ERR_NoImplicitConv); @@ -25824,7 +25845,7 @@ static int M02(T x) where T : U where U : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25875,7 +25896,7 @@ static T M02(int x) where T : U where U : I2 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25923,7 +25944,7 @@ static U M02(T x) where T : I1 where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -25971,7 +25992,7 @@ static int M02(T x) where T : U where U : C1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -26014,7 +26035,7 @@ static T M02(int x) where T : U where U : C1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -26067,7 +26088,7 @@ static int M02(T x) where T : U where U : C1, I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -26116,7 +26137,7 @@ static T M02(int x) where T : U where U : C1, I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); @@ -26172,7 +26193,7 @@ static int M03(T y) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (15,16): error CS0030: Cannot convert type 'T' to 'int' // return (int)x; @@ -26214,7 +26235,7 @@ static T M03(int y) where T : U where U : I1 "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( // (15,16): error CS0030: Cannot convert type 'int' to 'T' // return (T)x; @@ -26252,7 +26273,7 @@ public static void Method(int i) { } var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -26333,7 +26354,7 @@ public static void Method(T i) { } var compilation0 = CreateCompilation(source0, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation0.VerifyDiagnostics(); @@ -26345,7 +26366,7 @@ public class Derived : Base, Interface var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation0.EmitToImageReference() }); CompileAndVerify(compilation1, sourceSymbolValidator: validate, symbolValidator: validate, verify: Verification.Skipped).VerifyDiagnostics(); @@ -26402,7 +26423,7 @@ public static void Method(T i) { } var compilation0 = CreateCompilation(source0, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { CreateEmptyCompilation("").ToMetadataReference() }); compilation0.VerifyDiagnostics(); @@ -26415,7 +26436,7 @@ public class Derived : Base, Interface var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp, + targetFramework: _supportingFramework, references: new[] { compilation0.ToMetadataReference() }); var d = compilation1.GlobalNamespace.GetTypeMember("Derived"); @@ -26465,7 +26486,7 @@ static void Interface.Method(int i) { } var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (9,15): error CS0535: 'Other' does not implement interface member 'Interface.Method(int)' @@ -26500,9 +26521,9 @@ public interface I2 where T : I2 } "; - var compilation2 = CreateCompilation(new[] { source2, UnmanagedCallersOnlyAttributeDefinition }, options: TestOptions.DebugDll, + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (6,6): error CS8896: 'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract methods or static local functions. @@ -26628,7 +26649,7 @@ static int M03(T x) where T : I2 "; var compilation1 = CreateCompilationWithIL(source1, ilSource, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); // Conversions aren't flagged due to https://github.com/dotnet/roslyn/issues/54113. compilation1.VerifyDiagnostics( @@ -26669,9 +26690,9 @@ [UnmanagedCallersOnly] public static void M1() {} } "; - var compilation2 = CreateCompilation(new[] { source2, UnmanagedCallersOnlyAttributeDefinition }, options: TestOptions.DebugDll, + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (15,47): error CS8932: 'UnmanagedCallersOnly' method 'C.M1()' cannot implement interface member 'I1.M1()' in type 'C' @@ -26717,9 +26738,9 @@ [UnmanagedCallersOnly] static void I1.M1() {} } "; - var compilation2 = CreateCompilation(new[] { source2, UnmanagedCallersOnlyAttributeDefinition }, options: TestOptions.DebugDll, + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: _supportingFramework); compilation2.VerifyDiagnostics( // (15,6): error CS8896: 'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract methods or static local functions. diff --git a/src/Compilers/Core/Portable/SpecialMember.cs b/src/Compilers/Core/Portable/SpecialMember.cs index 40465eab2c69d..4c002b07f7dca 100644 --- a/src/Compilers/Core/Portable/SpecialMember.cs +++ b/src/Compilers/Core/Portable/SpecialMember.cs @@ -151,6 +151,7 @@ internal enum SpecialMember System_Runtime_CompilerServices_RuntimeFeature__DefaultImplementationsOfInterfaces, System_Runtime_CompilerServices_RuntimeFeature__UnmanagedSignatureCallingConvention, System_Runtime_CompilerServices_RuntimeFeature__CovariantReturnsOfClasses, + System_Runtime_CompilerServices_RuntimeFeature__VirtualStaticsInInterfaces, System_Runtime_CompilerServices_PreserveBaseOverridesAttribute__ctor, diff --git a/src/Compilers/Core/Portable/SpecialMembers.cs b/src/Compilers/Core/Portable/SpecialMembers.cs index 92aa95e01ce18..c8df5bb8ebe15 100644 --- a/src/Compilers/Core/Portable/SpecialMembers.cs +++ b/src/Compilers/Core/Portable/SpecialMembers.cs @@ -1020,6 +1020,12 @@ static SpecialMembers() 0, // Arity (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_String, // Field Signature + // System_Runtime_CompilerServices_RuntimeFeature__VirtualStaticsInInterfaces + (byte)(MemberFlags.Field | MemberFlags.Static), // Flags + (byte)SpecialType.System_Runtime_CompilerServices_RuntimeFeature, // DeclaringTypeId + 0, // Arity + (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_String, // Field Signature + // System_Runtime_CompilerServices_PreserveBaseOverridesAttribute__ctor (byte)MemberFlags.Constructor, // Flags (byte)SpecialType.System_Runtime_CompilerServices_PreserveBaseOverridesAttribute, // DeclaringTypeId @@ -1153,6 +1159,7 @@ static SpecialMembers() "DefaultImplementationsOfInterfaces", // System_Runtime_CompilerServices_RuntimeFeature__DefaultImplementationsOfInterfaces "UnmanagedSignatureCallingConvention", // System_Runtime_CompilerServices_RuntimeFeature__UnmanagedSignatureCallingConvention "CovariantReturnsOfClasses", // System_Runtime_CompilerServices_RuntimeFeature__CovariantReturnsOfClasses + "VirtualStaticsInInterfaces", // System_Runtime_CompilerServices_RuntimeFeature__VirtualStaticsInInterfaces ".ctor", // System_Runtime_CompilerServices_PreserveBaseOverridesAttribute__ctor }; diff --git a/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj b/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj index cf4efcc0c0cc3..c3fa5cdc75502 100644 --- a/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj +++ b/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj @@ -103,6 +103,7 @@ + diff --git a/src/Compilers/Test/Core/TargetFrameworkUtil.cs b/src/Compilers/Test/Core/TargetFrameworkUtil.cs index 9ea32e2d761cf..bedd3ac54323c 100644 --- a/src/Compilers/Test/Core/TargetFrameworkUtil.cs +++ b/src/Compilers/Test/Core/TargetFrameworkUtil.cs @@ -75,6 +75,9 @@ public enum TargetFramework /// Minimal set of required types and Task implementation (). /// MinimalAsync, + + Net50, + Net60, } /// @@ -177,7 +180,8 @@ public static class TargetFrameworkUtil // Primary TargetFramework.Empty => ImmutableArray.Empty, TargetFramework.NetStandard20 => NetStandard20References, - TargetFramework.NetCoreApp => NetCoreApp.StandardReferences, + TargetFramework.NetCoreApp or TargetFramework.Net50 => NetCoreApp.StandardReferences, + TargetFramework.Net60 => ImmutableArray.CreateRange(Net60.All), TargetFramework.NetCoreAppAndCSharp => NetCoreApp.StandardReferences.Add(NetCoreApp.MicrosoftCSharp), TargetFramework.NetFramework => NetFramework.StandardReferences, diff --git a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb index 9c53a3fe62931..a8b6b5df00e13 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb @@ -486,6 +486,7 @@ End Namespace If special = SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__DefaultImplementationsOfInterfaces OrElse special = SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__UnmanagedSignatureCallingConvention OrElse special = SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__CovariantReturnsOfClasses OrElse + special = SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__VirtualStaticsInInterfaces OrElse special = SpecialMember.System_Runtime_CompilerServices_PreserveBaseOverridesAttribute__ctor Then Assert.Null(symbol) ' Not available Else diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index c8065add4eb18..61b70b978450e 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -9429,7 +9429,7 @@ public int Foo } [WorkItem(53925, "https://github.com/dotnet/roslyn/issues/53925")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceMember() { await new VerifyCS.Test @@ -9467,7 +9467,7 @@ public static void M1() } [WorkItem(53925, "https://github.com/dotnet/roslyn/issues/53925")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceMemberExplicitly() { await new VerifyCS.Test @@ -9505,7 +9505,7 @@ static void ITest.M1() } [WorkItem(53925, "https://github.com/dotnet/roslyn/issues/53925")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceMember_ImplementAbstractly() { await new VerifyCS.Test @@ -9543,7 +9543,7 @@ public static void M1() } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceOperator_OnlyExplicitlyImplementable() { await new VerifyCS.Test @@ -9579,7 +9579,7 @@ class C : ITest } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceOperator_ImplementImplicitly() { await new VerifyCS.Test @@ -9622,7 +9622,7 @@ class C : ITest } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceOperator_ImplementExplicitly() { await new VerifyCS.Test @@ -9658,7 +9658,7 @@ class C : ITest } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterfaceOperator_ImplementAbstractly() { await new VerifyCS.Test @@ -9695,7 +9695,7 @@ abstract class C : ITest } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterface_Explicitly() { await new VerifyCS.Test @@ -9732,7 +9732,7 @@ static int ITest.M(ITest x) } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterface_Implicitly() { await new VerifyCS.Test @@ -9769,7 +9769,7 @@ public static int M(ITest x) } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterface_ImplementImplicitly() { await new VerifyCS.Test @@ -9806,7 +9806,7 @@ public static int M(C x) } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterface_ImplementExplicitly() { await new VerifyCS.Test @@ -9843,7 +9843,7 @@ static int ITest.M(C x) } [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/56171"), Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestStaticAbstractInterface_ImplementAbstractly() { await new VerifyCS.Test