Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -2125,7 +2125,6 @@ public override void AbstractMethod()
throw new System.NotImplementedException();
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because we are handling InsertFinalNewLine correctly now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

""", parseOptions: TestOptions.RegularPreview);

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/48742")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -578,7 +579,6 @@ public void Method1()
throw new System.NotImplementedException();
}
}

""");

[Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/26323")]
Expand Down Expand Up @@ -2087,7 +2087,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540318")]
Expand Down Expand Up @@ -3107,8 +3106,7 @@ abstract class Goo : IGoo
{
public event EventHandler E;
}
""",
index: 0);
""");

[Fact]
public Task TestImplementEventAbstractly()
Expand Down Expand Up @@ -5687,7 +5685,6 @@ public void Goo<@class>()
throw new System.NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545922")]
Expand Down Expand Up @@ -5775,7 +5772,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529920")]
Expand Down Expand Up @@ -5821,7 +5817,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529947")]
Expand Down Expand Up @@ -5863,8 +5858,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")]
Expand All @@ -5882,7 +5876,6 @@ class C : IDisposable

{{DisposePattern("protected virtual ", "C", "public void ")}}
}

""", index: 1);

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699")]
Expand All @@ -5902,7 +5895,6 @@ void IDisposable.Dispose()
throw new NotImplementedException();
}
}

""", index: 2);

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/941469")]
Expand Down Expand Up @@ -5946,7 +5938,6 @@ abstract class C : IDisposable
{
public abstract void Dispose();
}

""", index: 2);

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699")]
Expand Down Expand Up @@ -5985,7 +5976,6 @@ class C : System.IDisposable

{{DisposePattern("protected virtual ", "C", "void System.IDisposable.", gcPrefix: "System.")}}
}

""",
CodeActionIndex = 3,

Expand Down Expand Up @@ -6024,7 +6014,7 @@ public void F()
throw new NotImplementedException();
}
}
""", index: 0);
""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/951968")]
public Task TestImplementIDisposableViaBaseInterface()
Expand Down Expand Up @@ -6138,7 +6128,6 @@ public void Dispose()
throw new NotImplementedException();
}
}

""");

[Fact]
Expand All @@ -6157,7 +6146,6 @@ void IDisposable.Dispose()
throw new NotImplementedException();
}
}

""", index: 1);

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545924")]
Expand Down Expand Up @@ -6230,7 +6218,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939")]
Expand All @@ -6250,7 +6237,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939")]
Expand All @@ -6270,7 +6256,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939")]
Expand All @@ -6290,7 +6275,6 @@ public object GetService(Type serviceType)
throw new NotImplementedException();
}
}

""");

[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545940")]
Expand Down Expand Up @@ -7030,7 +7014,7 @@ public void Dispose()
throw new NotImplementedException();
}
}
""", index: 0);
""");

[Fact]
public Task TestImplementInterfaceForIDisposableNonApplicable2()
Expand Down Expand Up @@ -7059,7 +7043,7 @@ public void Dispose()
throw new NotImplementedException();
}
}
""", index: 0);
""");

[Fact]
public Task TestImplementInterfaceForExplicitIDisposableWithSealedClass()
Expand Down Expand Up @@ -10054,7 +10038,6 @@ public void M1()
throw new System.NotImplementedException();
}
}

""",
}.RunAsync();

Expand Down Expand Up @@ -10085,7 +10068,6 @@ public void M1()
throw new System.NotImplementedException();
}
}

""",
}.RunAsync();

Expand Down Expand Up @@ -10116,7 +10098,6 @@ public void M1()
throw new System.NotImplementedException();
}
}

""",
}.RunAsync();

Expand Down Expand Up @@ -10185,7 +10166,6 @@ public void M1()
throw new System.NotImplementedException();
}
}

""",
}.RunAsync();

Expand Down Expand Up @@ -11900,4 +11880,27 @@ class C1 : I1
ReferenceAssemblies = ReferenceAssemblies.Net.Net80,
LanguageVersion = LanguageVersionExtensions.CSharpNext,
}.RunAsync();

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/79584")]
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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -271,7 +269,7 @@ void Method()
}
}
}
</Document>
</Document>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What caused this indentation change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc is getting formatted, and tha tcleans up the errant final whitespace we weren't touching before.

<Document>
namespace ConsoleApplication1
{
Expand All @@ -292,7 +290,7 @@ void Method()
}
}
}
</Document>
</Document>
</Project>
<Project Language="C#" AssemblyName="Assembly2" CommonReferences="true">
<Document>
Expand Down Expand Up @@ -425,7 +423,7 @@ void Method()
}
}
}
</Document>
</Document>
<Document>
namespace ConsoleApplication1
{
Expand All @@ -450,7 +448,7 @@ void Method()
}
}
}
</Document>
</Document>
</Project>
<Project Language="C#" AssemblyName="Assembly2" CommonReferences="true">
<Document>
Expand All @@ -477,7 +475,7 @@ void Method()
}
}
}
</Document>
</Document>
</Project>
</Workspace>
""");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5068,7 +5068,6 @@ X void X<X void X
{
}
}

""",
index: 2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ class C(string s)
{
public string S { get; } = s;
}

""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/19956")]
Expand All @@ -361,7 +360,6 @@ class C(string s)
{
private readonly string s = s;
}

""",
index: 1);

Expand Down
Loading
Loading