From 8881e258da00e5675b97b92fa404460d06eee6f4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 12:50:42 +0200 Subject: [PATCH 01/13] Fix eol handling on the last token in a file when formatting code actions --- .../ImplementInterfaceCodeFixTests.cs | 24 ++++++++++++++ .../Core/Formatting/FormattingExtensions.cs | 31 ++++++++++--------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs index 3f833873d5bbe..d67641e4db87c 100644 --- a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs +++ b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.CSharp.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.NamingStyles; +using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.ImplementType; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Testing; @@ -11900,4 +11901,27 @@ class C1 : I1 ReferenceAssemblies = ReferenceAssemblies.Net.Net80, LanguageVersion = LanguageVersionExtensions.CSharpNext, }.RunAsync(); + + [Fact] + public Task TestImplementIDisposable_DisposePattern_LF_EndOfLine() + => new VerifyCS.Test + { + TestCode = """ + using System; + class C : {|CS0535:IDisposable|}{|CS1513:|}{|CS1514:|} + """.Replace("\r\n", "\n"), + FixedCode = $$""" + using System; + class C : IDisposable + { + private bool disposedValue; + + {{DisposePattern("protected virtual ", "C", "public void ")}} + } + """.Replace("\r\n", "\n"), + CodeActionIndex = 1, + ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + LanguageVersion = LanguageVersionExtensions.CSharpNext, + Options = { { FormattingOptions2.NewLine, "\n" } }, + }.RunAsync(); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingExtensions.cs index 6e2e935413c3a..4c8cdde6c1990 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingExtensions.cs @@ -281,31 +281,34 @@ static IEnumerable EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnno var (firstToken, lastToken) = nodeOrToken.AsNode(out var childNode) ? (childNode.GetFirstToken(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true)) : (nodeOrToken.AsToken(), nodeOrToken.AsToken()); - yield return GetSpan(firstToken, lastToken); + yield return GetSpanIncludingPreviousAndNextTokens(firstToken, lastToken); } } } - internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) + /// + /// Attempt to get a span that encompassed these tokens, but is expanded to go from the normal start of the + /// token that precedes them to the normal end of the token that follows. If there is no token that precedes + /// or follows, then we expand to consume at least the full span of the and + /// so that we at least will try to format any trivia on them. + /// + internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) { var previousToken = firstToken.GetPreviousToken(); - var nextToken = lastToken.GetNextToken(); - - if (previousToken.RawKind != 0) - { - firstToken = previousToken; - } + var start = previousToken.RawKind != 0 + ? previousToken.SpanStart + : firstToken.FullSpan.Start; - if (nextToken.RawKind != 0) - { - lastToken = nextToken; - } + var nextToken = lastToken.GetNextToken(); + var end = nextToken.RawKind != 0 + ? nextToken.Span.End + : lastToken.FullSpan.End; - return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); + return TextSpan.FromBounds(start, end); } internal static TextSpan GetElasticSpan(SyntaxToken token) - => GetSpan(token, token); + => GetSpanIncludingPreviousAndNextTokens(token, token); private static IEnumerable AggregateSpans(IEnumerable spans) { From a40a54039e25aefb648da64dc607935cb425fc90 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 12:51:41 +0200 Subject: [PATCH 02/13] Add work item --- .../Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs index d67641e4db87c..55952f48caab7 100644 --- a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs +++ b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs @@ -11902,7 +11902,7 @@ class C1 : I1 LanguageVersion = LanguageVersionExtensions.CSharpNext, }.RunAsync(); - [Fact] + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/79584")] public Task TestImplementIDisposable_DisposePattern_LF_EndOfLine() => new VerifyCS.Test { From cd1fd17699c5fde3f301a767f3b4dc0bf18acd4f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 12:58:36 +0200 Subject: [PATCH 03/13] Fix tests --- .../ImplementInterfaceCodeFixTests.cs | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs index 55952f48caab7..0422011d4aad0 100644 --- a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs +++ b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs @@ -2088,7 +2088,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540318")] @@ -3108,8 +3107,7 @@ abstract class Goo : IGoo { public event EventHandler E; } - """, - index: 0); + """); [Fact] public Task TestImplementEventAbstractly() @@ -5776,7 +5774,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529920")] @@ -5822,7 +5819,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529947")] @@ -5864,8 +5860,7 @@ public void Dispose() throw new NotImplementedException(); } } - - """, index: 0); + """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699")] [WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/994456")] @@ -5883,7 +5878,6 @@ class C : IDisposable {{DisposePattern("protected virtual ", "C", "public void ")}} } - """, index: 1); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699")] @@ -5903,7 +5897,6 @@ void IDisposable.Dispose() throw new NotImplementedException(); } } - """, index: 2); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/941469")] @@ -5947,7 +5940,6 @@ abstract class C : IDisposable { public abstract void Dispose(); } - """, index: 2); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699")] @@ -5986,7 +5978,6 @@ class C : System.IDisposable {{DisposePattern("protected virtual ", "C", "void System.IDisposable.", gcPrefix: "System.")}} } - """, CodeActionIndex = 3, @@ -6025,7 +6016,7 @@ public void F() throw new NotImplementedException(); } } - """, index: 0); + """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/951968")] public Task TestImplementIDisposableViaBaseInterface() @@ -6139,7 +6130,6 @@ public void Dispose() throw new NotImplementedException(); } } - """); [Fact] @@ -6158,7 +6148,6 @@ void IDisposable.Dispose() throw new NotImplementedException(); } } - """, index: 1); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545924")] @@ -6251,7 +6240,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939")] @@ -6271,7 +6259,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939")] @@ -6291,7 +6278,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545940")] @@ -7031,7 +7017,7 @@ public void Dispose() throw new NotImplementedException(); } } - """, index: 0); + """); [Fact] public Task TestImplementInterfaceForIDisposableNonApplicable2() @@ -7060,7 +7046,7 @@ public void Dispose() throw new NotImplementedException(); } } - """, index: 0); + """); [Fact] public Task TestImplementInterfaceForExplicitIDisposableWithSealedClass() @@ -10055,7 +10041,6 @@ public void M1() throw new System.NotImplementedException(); } } - """, }.RunAsync(); @@ -10086,7 +10071,6 @@ public void M1() throw new System.NotImplementedException(); } } - """, }.RunAsync(); @@ -10117,7 +10101,6 @@ public void M1() throw new System.NotImplementedException(); } } - """, }.RunAsync(); From 391f256b4640c605d039edd578243ac120907e7c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 13:26:10 +0200 Subject: [PATCH 04/13] Fix tests --- .../ImplementInterface/ImplementInterfaceCodeFixTests.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs index 0422011d4aad0..28bfb6f5a67c5 100644 --- a/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs +++ b/src/Analyzers/CSharp/Tests/ImplementInterface/ImplementInterfaceCodeFixTests.cs @@ -579,7 +579,6 @@ public void Method1() throw new System.NotImplementedException(); } } - """); [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/26323")] @@ -5686,7 +5685,6 @@ public void Goo<@class>() throw new System.NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545922")] @@ -6220,7 +6218,6 @@ public object GetService(Type serviceType) throw new NotImplementedException(); } } - """); [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939")] @@ -10169,7 +10166,6 @@ public void M1() throw new System.NotImplementedException(); } } - """, }.RunAsync(); From bcbaa5d70e7a691aa8519d2384b5835234d7ca8e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:16:35 +0200 Subject: [PATCH 05/13] Fix tests --- .../PullMemberUp/CSharpPullMemberUpTests.cs | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs index 88f61b4434671..206bb1277b667 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs @@ -603,7 +603,7 @@ public interface IBase { Uri Endpoint { get; set; } } - + using System; @@ -649,7 +649,7 @@ public interface IBase { bool TestMethod(); } - + using System; @@ -700,7 +700,7 @@ public interface IBase { Uri TestMethod(); } - + using System; @@ -750,7 +750,7 @@ public interface IBase { bool TestMethod(Uri endpoint); } - + using System; @@ -807,7 +807,7 @@ public interface IBase { event EventHandler TestEvent; } - + using System; @@ -859,14 +859,14 @@ public class Base { public Uri Endpoint { get; set; } } - + using System; public class Derived : Base { } - + """); @@ -899,14 +899,14 @@ public class Base { public Uri Endpoint { get; set; } } - + using System; public class Derived : Base { } - + """); @@ -943,14 +943,14 @@ public class Base { public Uri Endpoint { get; set; } } - + using System; public class Derived : Base { } - + """); @@ -1000,14 +1000,14 @@ public bool TestProperty } } } - + using System; public class Derived : Base { } - + """); @@ -1047,14 +1047,14 @@ public class Base return Enumerable.Range(0, 5).Sum(); } } - + using System.Linq; public class Derived : Base { } - + """); @@ -1121,7 +1121,7 @@ public class Base public class Derived : Base { } - + """); @@ -1184,7 +1184,7 @@ public class Base public class Derived : Base { } - + """); @@ -1239,7 +1239,7 @@ public int TestMethod() public class Derived : Base { } - + """); @@ -1282,14 +1282,14 @@ public int TestMethod() return 5; } } - + using System.Linq; public class Derived : Base { } - + """); @@ -1329,14 +1329,14 @@ public class Base { public Uri Endpoint { get; set; } } - + using System; public class Derived : Base { } - + """); @@ -1376,14 +1376,14 @@ public class Base { public Uri Endpoint { get; set; } } - + using System; public class Derived : Base { } - + """); @@ -1429,7 +1429,7 @@ public int TestMethod() Count((uri) => uri != null); } } - + using System; using System.Linq; @@ -1437,7 +1437,7 @@ public int TestMethod() public class Derived : Base { } - + """); @@ -1492,7 +1492,7 @@ public int TestMethod() public class Derived : Base { } - + """); @@ -1888,7 +1888,7 @@ public void TestMethod() public class Derived : Base { } - + """); @@ -1941,7 +1941,7 @@ public void TestMethod() public class Derived : Base { } - + """); @@ -2170,7 +2170,7 @@ class Base { public Other GetOther() => null; } - + namespace X.Y; class Derived : A.B.Base @@ -2523,14 +2523,14 @@ public Uri Endpoint() return new Uri("http://localhost"); } } - + using System; public class Derived : Base { } - + """); @@ -2572,14 +2572,14 @@ public bool TestMethod(Uri endpoint) return endpoint.Equals(localhost); } } - + using System; public class Derived : Base { } - + """); @@ -2623,14 +2623,14 @@ public bool TestMethod() return endpoint1.Equals(endpoint2); } } - + using System; public class Derived : Base { } - + """); @@ -2684,14 +2684,14 @@ public event EventHandler Test[||]Event } } } - + using System; public class Derived : Base { } - + """); @@ -2725,14 +2725,14 @@ public class Base { public var endpoint = new Uri("http://localhost"); } - + using System; public class Derived : Base { } - + """); @@ -2766,14 +2766,14 @@ public class Base { public var range = Enumerable.Range(0, 5); } - + using System.Linq; public class Derived : Base { } - + """); From 43f18509a1d8ff194f9c6be69af3edc0eabab2fe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:19:47 +0200 Subject: [PATCH 06/13] Fix tests --- .../PopulateSwitchStatementTests_FixAllTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs index e433e37ceedc1..9bca60e66bb21 100644 --- a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs @@ -271,7 +271,7 @@ void Method() } } } - + namespace ConsoleApplication1 { @@ -292,7 +292,7 @@ void Method() } } } - + @@ -425,7 +425,7 @@ void Method() } } } - + namespace ConsoleApplication1 { @@ -450,7 +450,7 @@ void Method() } } } - + @@ -477,7 +477,7 @@ void Method() } } } - + """); From d4d8ad7f3d82e0cedc03d54fce2d1a25be000673 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:22:28 +0200 Subject: [PATCH 07/13] Fix tests --- .../ImplementAbstractClassTests.cs | 1 - .../PopulateSwitchStatementTests_FixAllTests.cs | 2 -- .../PullMemberUp/CSharpPullMemberUpTests.cs | 12 +++++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/ImplementAbstractClass/ImplementAbstractClassTests.cs b/src/Analyzers/CSharp/Tests/ImplementAbstractClass/ImplementAbstractClassTests.cs index a49651b283549..aa751e329ccd3 100644 --- a/src/Analyzers/CSharp/Tests/ImplementAbstractClass/ImplementAbstractClassTests.cs +++ b/src/Analyzers/CSharp/Tests/ImplementAbstractClass/ImplementAbstractClassTests.cs @@ -2125,7 +2125,6 @@ public override void AbstractMethod() throw new System.NotImplementedException(); } } - """, parseOptions: TestOptions.RegularPreview); [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/48742")] diff --git a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs index 9bca60e66bb21..d06c8156b0c17 100644 --- a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; diff --git a/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs index 206bb1277b667..942428399cdaa 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -36,7 +34,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(EditorT private async Task TestQuickActionNotProvidedAsync( string initialMarkup, - TestParameters parameters = null) + TestParameters? parameters = null) { var service = new TestPullMemberUpService(null, null); var parametersValue = (parameters ?? TestParameters.Default).WithFixProviderData(service); @@ -3957,11 +3955,11 @@ public class Derived : BaseClass internal Task TestWithPullMemberDialogAsync( string initialMarkUp, string expectedResult, - IEnumerable<(string name, bool makeAbstract)> selection = null, - string destinationName = null, + IEnumerable<(string name, bool makeAbstract)>? selection = null, + string? destinationName = null, int index = 0, - TestParameters parameters = null, - OptionsCollection options = null) + TestParameters? parameters = null, + OptionsCollection? options = null) { var service = new TestPullMemberUpService(selection, destinationName); From b5ad09f93cf57a21e3f516042e1d9836ea46e36d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:28:35 +0200 Subject: [PATCH 08/13] Fix tests --- .../CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs index d895d7cd27e5f..9db8378b51b0c 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs @@ -5068,7 +5068,6 @@ X void X Date: Fri, 25 Jul 2025 15:29:52 +0200 Subject: [PATCH 09/13] Fix tests --- .../ConvertPrimaryToRegularConstructorTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Features/CSharpTest/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorTests.cs b/src/Features/CSharpTest/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorTests.cs index b8507cedb4325..a6fb2b018ec7e 100644 --- a/src/Features/CSharpTest/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorTests.cs +++ b/src/Features/CSharpTest/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorTests.cs @@ -2575,7 +2575,6 @@ public Class1() { } } - """, LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); From ee7d8acd7008b048652629f79e989ed75fdb62d1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:32:45 +0200 Subject: [PATCH 10/13] Fix tests --- src/Features/CSharpTest/ExtractClass/ExtractClassTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Features/CSharpTest/ExtractClass/ExtractClassTests.cs b/src/Features/CSharpTest/ExtractClass/ExtractClassTests.cs index e4159d9780417..39fed7b737feb 100644 --- a/src/Features/CSharpTest/ExtractClass/ExtractClassTests.cs +++ b/src/Features/CSharpTest/ExtractClass/ExtractClassTests.cs @@ -229,7 +229,6 @@ void M() { } } - """; await new Test @@ -312,7 +311,6 @@ internal record MyBase { public string S { get; set; } } - """; await new Test From e3bd96f8c003e010258277a846b4eb1c5296df69 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:34:21 +0200 Subject: [PATCH 11/13] Fix tests --- .../ExtractMethod/ExtractMethodTests.LanguageInteraction.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb b/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb index 0c8f0d0ce0ea4..a0581c4e2a0f0 100644 --- a/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb +++ b/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb @@ -2709,7 +2709,7 @@ End Class Private Shared Function NewMethod() As Integer Return 100 End Function -End Class +End Class Await TestExtractMethodAsync(code, expected) End Function From 048c8a46e99b132bf7fbf46d8755eddbf45a05aa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:35:49 +0200 Subject: [PATCH 12/13] Fix tests --- .../CSharpTest/GenerateOverrides/GenerateOverridesTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Features/CSharpTest/GenerateOverrides/GenerateOverridesTests.cs b/src/Features/CSharpTest/GenerateOverrides/GenerateOverridesTests.cs index 6e6d09d346933..6e3f2bfe078c2 100644 --- a/src/Features/CSharpTest/GenerateOverrides/GenerateOverridesTests.cs +++ b/src/Features/CSharpTest/GenerateOverrides/GenerateOverridesTests.cs @@ -74,7 +74,6 @@ public override string ToString() return base.ToString(); } } - """, ["Equals", "GetHashCode", "ToString"]); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateOverrides)] @@ -95,7 +94,6 @@ public override string ToString() return base.ToString(); } } - """, ["GetHashCode", "ToString"]); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateOverrides)] From 1cc5767e4cc8b8e0712048215d702ce62899b152 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 25 Jul 2025 15:37:12 +0200 Subject: [PATCH 13/13] Fix tests --- .../InitializeMemberFromPrimaryConstructorParameterTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs index 221cb1910ebe7..c23727189c219 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs @@ -347,7 +347,6 @@ class C(string s) { public string S { get; } = s; } - """); [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/19956")] @@ -361,7 +360,6 @@ class C(string s) { private readonly string s = s; } - """, index: 1);