Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade MicrosoftCodeAnalysisTestingVersion to 1.1.2-beta1.24121.1 #73840

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<!-- Versions used by several individual references below -->
<RoslynDiagnosticsNugetPackageVersion>3.3.4-beta1.22579.2</RoslynDiagnosticsNugetPackageVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview1.23111.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.23163.2</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.24121.1</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.149-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
<!-- CodeStyleAnalyzerVersion should we updated together with version of dotnet-format in dotnet-tools.json -->
<CodeStyleAnalyzerVersion>4.3.0-1.final</CodeStyleAnalyzerVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ServiceModel.Syndication;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CSharp;
Expand Down Expand Up @@ -4542,37 +4543,23 @@ public class C : [|B|]

#endregion

private static void AddSolutionTransform(List<Func<Solution, ProjectId, Solution>> solutionTransforms)
{
solutionTransforms.Add((solution, projectId) =>
{
var project = solution.GetProject(projectId)!;

var compilationOptions = (CSharpCompilationOptions)project.CompilationOptions!;
// enable nullable
compilationOptions = compilationOptions.WithNullableContextOptions(NullableContextOptions.Enable);
solution = solution
.WithProjectCompilationOptions(projectId, compilationOptions)
.WithProjectMetadataReferences(projectId, TargetFrameworkUtil.GetReferences(TargetFramework.Net60));

return solution;
});
}

private class RefactoringTest : VerifyCSRefactoring.Test
{
public RefactoringTest()
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net60;
LanguageVersion = LanguageVersion.CSharp10;
AddSolutionTransform(SolutionTransforms);
MarkupOptions = MarkupOptions.UseFirstDescriptor;
}

protected override Workspace CreateWorkspaceImpl()
protected override CompilationOptions CreateCompilationOptions()
{
var workspace = new AdhocWorkspace();
var compilationOptions = (CSharpCompilationOptions)base.CreateCompilationOptions();

// enable nullable
compilationOptions = compilationOptions.WithNullableContextOptions(NullableContextOptions.Enable);

return workspace;
return compilationOptions;
}
}

Expand All @@ -4596,8 +4583,18 @@ private class CodeFixTest :
{
public CodeFixTest()
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net60;
LanguageVersion = LanguageVersion.CSharp10;
AddSolutionTransform(SolutionTransforms);
}

protected override CompilationOptions CreateCompilationOptions()
{
var compilationOptions = (CSharpCompilationOptions)base.CreateCompilationOptions();

// enable nullable
compilationOptions = compilationOptions.WithNullableContextOptions(NullableContextOptions.Enable);

return compilationOptions;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ protected override IEnumerable<CodeRefactoringProvider> GetCodeRefactoringProvid
return SpecializedCollections.SingletonEnumerable(new CSharpExtractClassCodeRefactoringProvider(service));
}

protected override Workspace CreateWorkspaceImpl()
protected override Task<Workspace> CreateWorkspaceImplAsync()
{
var unusedCompilationOptions = new CSharpCompilationOptions(OutputKind.NetModule);
var unusedParseOptions = new CSharpParseOptions(LanguageVersion.CSharp1);
return TestWorkspace.Create(WorkspaceKind, LanguageNames.CSharp, unusedCompilationOptions, unusedParseOptions);
return Task.FromResult<Workspace>(TestWorkspace.Create(WorkspaceKind, LanguageNames.CSharp, unusedCompilationOptions, unusedParseOptions));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private class TestWithDialog : VerifyCS.Test
public ImmutableArray<string> MemberNames;
public Action<ImmutableArray<PickMembersOption>> OptionsCallback;

protected override Workspace CreateWorkspaceImpl()
protected override Task<Workspace> CreateWorkspaceImplAsync()
{
// If we're a dialog test, then mixin our mock and initialize its values to the ones the test asked for.
var workspace = new AdhocWorkspace(s_composition.GetHostServices());
Expand All @@ -46,7 +46,7 @@ protected override Workspace CreateWorkspaceImpl()
service.MemberNames = MemberNames;
service.OptionsCallback = OptionsCallback;

return workspace;
return Task.FromResult<Workspace>(workspace);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3420,7 +3420,7 @@ public Test(

private readonly bool _testPreselection;

protected override Workspace CreateWorkspaceImpl()
protected override Task<Workspace> CreateWorkspaceImplAsync()
{
var hostServices = s_testServices.GetHostServices();

Expand All @@ -3432,7 +3432,7 @@ protected override Workspace CreateWorkspaceImpl()
testOptionsService.CreateNew = _createNew;
testOptionsService.ExpectedPrecheckedMembers = _testPreselection ? _selection : ImmutableArray<string>.Empty;

return workspace;
return Task.FromResult<Workspace>(workspace);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,18 @@ protected override CodeFixContext CreateCodeFixContext(Document document, TextSp

protected override FixAllContext CreateFixAllContext(
Document? document,
TextSpan? diagnosticSpan,
Project project,
CodeFixProvider codeFixProvider,
FixAllScope scope,
string? codeActionEquivalenceKey,
IEnumerable<string> diagnosticIds,
DiagnosticSeverity minimumSeverity,
FixAllContext.DiagnosticProvider fixAllDiagnosticProvider,
CancellationToken cancellationToken)
=> new(new FixAllState(
fixAllProvider: NoOpFixAllProvider.Instance,
diagnosticSpan: null,
diagnosticSpan,
document,
project,
codeFixProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ protected override CodeRefactoringContext CreateCodeRefactoringContext(Document

private static readonly TestComposition s_editorFeaturesOOPComposition = EditorTestCompositions.EditorFeatures.WithTestHostParts(TestHost.OutOfProcess);

protected override Workspace CreateWorkspaceImpl()
protected override Task<Workspace> CreateWorkspaceImplAsync()
{
if (TestHost == TestHost.InProcess)
return base.CreateWorkspaceImpl();
return base.CreateWorkspaceImplAsync();

var hostServices = s_editorFeaturesOOPComposition.GetHostServices();
var workspace = new AdhocWorkspace(hostServices);
return workspace;
return Task.FromResult<Workspace>(workspace);
}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ protected override CodeRefactoringContext CreateCodeRefactoringContext(Document

private static readonly TestComposition s_editorFeaturesOOPComposition = EditorTestCompositions.EditorFeatures.WithTestHostParts(TestHost.OutOfProcess);

protected override Workspace CreateWorkspaceImpl()
protected override Task<Workspace> CreateWorkspaceImplAsync()
{
if (TestHost == TestHost.InProcess)
return base.CreateWorkspaceImpl();
return base.CreateWorkspaceImplAsync();

var hostServices = s_editorFeaturesOOPComposition.GetHostServices();
var workspace = new AdhocWorkspace(hostServices);
return workspace;
return Task.FromResult<Workspace>(workspace);
}

#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3065,7 +3065,7 @@ End Namespace"

Private ReadOnly _newType As Boolean

Protected Overrides Function CreateWorkspaceImpl() As Workspace
Protected Overrides Function CreateWorkspaceImplAsync() As Task(Of Workspace)
Dim hostServices = s_testServices.GetHostServices()
Dim workspace = New AdhocWorkspace(hostServices)
Dim optionsService = DirectCast(workspace.Services.GetRequiredService(Of IMoveStaticMembersOptionsService)(), TestMoveStaticMembersService)
Expand All @@ -3079,7 +3079,7 @@ End Namespace"
End If
optionsService.CreateNew = _newType

Return workspace
Return Task.FromResult(Of Workspace)(workspace)
End Function
End Class

Expand Down
Loading