Skip to content

Clean up our newline-fixing extension methods#83043

Merged
jasonmalinowski merged 1 commit into
dotnet:mainfrom
jasonmalinowski:simplify-string-test-helpers
Apr 9, 2026
Merged

Clean up our newline-fixing extension methods#83043
jasonmalinowski merged 1 commit into
dotnet:mainfrom
jasonmalinowski:simplify-string-test-helpers

Conversation

@jasonmalinowski
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski commented Apr 2, 2026

No reason to define extension methods when they'll lose to the framework provided ones.

Microsoft Reviewers: Open in CodeFlow

No reason to define extension methods when they'll lose to the
framework provided ones.
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner April 2, 2026 21:46
@jasonmalinowski jasonmalinowski requested a review from jaredpar April 2, 2026 21:47
Copy link
Copy Markdown
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (commit 1)

public static string ReplaceLineEndings(this string input)
{
#if NET6_0_OR_GREATER
return input.ReplaceLineEndings();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is used only in tests, then I guess it's fine. But otherwise, our pattern is to have the method available always for binary compatibility: https://github.com/dotnet/roslyn/blob/main/docs/contributing/target-framework-strategy.md#pattern-for-extension-methods

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jjonescz Ah, was unaware of that. If that's a concern, we really need some automated enforcement of that.

@jasonmalinowski jasonmalinowski merged commit a39ad8d into dotnet:main Apr 9, 2026
26 checks passed
@jasonmalinowski jasonmalinowski deleted the simplify-string-test-helpers branch April 9, 2026 01:04
@dotnet-policy-service dotnet-policy-service Bot added this to the Next milestone Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants