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

Replace usage of out-of-support TFM compiler directives #101672

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

ViktorHofer
Copy link
Member

... and directives for TFMs that we don't target anymore in main.

Replaces the following directives with NET or !NET:

  • #if NETCOREAPP2*
  • #if !NETCOREAPP2*
  • #if NETCOREAPP3*
  • #if !NETCOREAPP3*
  • #if NET5*
  • #if !NET5*
  • #if NET6*
  • #if !NET6*
  • #if NET7*
  • #if !NET7*

... and directives for TFMs that we don't target anymore in main.

Replaces the following directives with `NET` or `!NET`:
- `#if NETCOREAPP2*`
- `#if !NETCOREAPP2*`
- `#if NETCOREAPP3*`
- `#if !NETCOREAPP3*`
- `#if NET5*`
- `#if !NET5*`
- `#if NET6*`
- `#if !NET6*`
- `#if NET7*`
- `#if !NET7*`
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

@jkotas
Copy link
Member

jkotas commented Apr 29, 2024

#if NETCOREAPP2*

Is there a reason why you have not replaced #if NETCOREAPP?

@jkotas
Copy link
Member

jkotas commented Apr 29, 2024

Some of the test failures look related to the change.

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Apr 29, 2024

Is there a reason why you have not replaced #if NETCOREAPP?

Yeah, 300+ hits. i wanted to keep this scoped on the other directives. I can send another PR to then replace NETCOREAPP with NET if we want to go that direction. Another reason for not doing this as part of this PR is that we aren't consistent between using NETCOREAPP vs NET in general, i.e. TFM properties still use NetCoreAppX instead of just NetX and I didn't want to submit a questionable change.

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

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

Do you mind sharing why this change is being made? Why did the old directives lose their value?

Assuming the CI is all good, LGTM.

@ViktorHofer
Copy link
Member Author

Do you mind sharing why this change is being made? Why did the old directives lose their value?

The main branch doesn't benefit from the distinction between NETCOREAPP2 vs NETCOREAPP3 vs NET5 vs NET6 vs NET7 as non of those TFMs are built anymore. Most of them are already out-of-support or soon will be. From a code point perspective, differentiating between .NET Framework, modern .NET and specific modern .NET versions that we target and build in main is sufficient.

Or to rephrase, NETCOREAPP2 and similar compiler directives are things from the past that we don't need in our main source anymore.

@ViktorHofer ViktorHofer merged commit 2616119 into main Apr 29, 2024
133 of 138 checks passed
@ViktorHofer ViktorHofer deleted the RemoveUsageOfCompilerDirectivesOutOfSupportTFMs branch April 29, 2024 19:28
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
* Replace usage of out-of-support TFM compiler directives

... and directives for TFMs that we don't target anymore in main.

Replaces the following directives with `NET` or `!NET`:
- `#if NETCOREAPP2*`
- `#if !NETCOREAPP2*`
- `#if NETCOREAPP3*`
- `#if !NETCOREAPP3*`
- `#if NET5*`
- `#if !NET5*`
- `#if NET6*`
- `#if !NET6*`
- `#if NET7*`
- `#if !NET7*`

* Update EmitterTests.cs
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
* Replace usage of out-of-support TFM compiler directives

... and directives for TFMs that we don't target anymore in main.

Replaces the following directives with `NET` or `!NET`:
- `#if NETCOREAPP2*`
- `#if !NETCOREAPP2*`
- `#if NETCOREAPP3*`
- `#if !NETCOREAPP3*`
- `#if NET5*`
- `#if !NET5*`
- `#if NET6*`
- `#if !NET6*`
- `#if NET7*`
- `#if !NET7*`

* Update EmitterTests.cs
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
* Replace usage of out-of-support TFM compiler directives

... and directives for TFMs that we don't target anymore in main.

Replaces the following directives with `NET` or `!NET`:
- `#if NETCOREAPP2*`
- `#if !NETCOREAPP2*`
- `#if NETCOREAPP3*`
- `#if !NETCOREAPP3*`
- `#if NET5*`
- `#if !NET5*`
- `#if NET6*`
- `#if !NET6*`
- `#if NET7*`
- `#if !NET7*`

* Update EmitterTests.cs
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants