Skip to content

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

Merged
ViktorHofer merged 2 commits into
mainfrom
RemoveUsageOfCompilerDirectivesOutOfSupportTFMs
Apr 29, 2024
Merged

Replace usage of out-of-support TFM compiler directives#101672
ViktorHofer merged 2 commits into
mainfrom
RemoveUsageOfCompilerDirectivesOutOfSupportTFMs

Conversation

@ViktorHofer

Copy link
Copy Markdown
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*`
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@jkotas

jkotas commented Apr 29, 2024

Copy link
Copy Markdown
Member

#if NETCOREAPP2*

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

@jkotas

jkotas commented Apr 29, 2024

Copy link
Copy Markdown
Member

Some of the test failures look related to the change.

@ViktorHofer

ViktorHofer commented Apr 29, 2024

Copy link
Copy Markdown
Member Author

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.

@carlossanlop carlossanlop left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@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