Skip to content

Conversation

@mdaigle
Copy link
Contributor

@mdaigle mdaigle commented Oct 29, 2024

Building on #2927. That PR should merge first.

This PR includes a few different types of preprocesser directive cleanups:

  • in netcore, removing #if NET6_0_OR_GREATER and #if NET8_0_OR_GREATER
    • these always evaluated to true
  • in netcore, removing #if NETFRAMEWORK
    • these always evaluated to false
  • in netfx, removing #if NETX_0_OR_GREATER
    • these always evaluated to false
  • in common and test, replacing #if NETX_0_OR_GREATER with #if NET
    • for readability, these didn't actually care what version of .NET was being used.

@mdaigle mdaigle added the Code Health 💊 Issues/PRs that are targeted to source code quality improvements. label Oct 29, 2024
@mdaigle mdaigle added this to the 6.0-preview3 milestone Oct 29, 2024
@mdaigle mdaigle changed the title Remove net6 symbol checks from netcore Cleanup | Remove net6 symbol checks from netcore Oct 29, 2024
@ErikEJ
Copy link
Contributor

ErikEJ commented Oct 29, 2024

Looks like this includes your previous PR?

@mdaigle
Copy link
Contributor Author

mdaigle commented Oct 29, 2024

Looks like this includes your previous PR?

@ErikEJ yes, this is building on the previous PR. I'll move it out of draft when the previous PR merges.

<TargetGroup Condition="$(TargetGroup) == ''">netcoreapp</TargetGroup>
<RuntimeIdentifier Condition="'$(TargetGroup)'=='netfx'">win</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetGroup)'=='netfx' AND $(ReferenceType.Contains('Package')) AND !$(Platform.Contains('AnyCPU'))">win-$(Platform)</RuntimeIdentifier>
<DefineConstants Condition="'$(TargetGroup)'=='netfx'">$(DefineConstants);NETFRAMEWORK</DefineConstants>
Copy link
Contributor Author

@mdaigle mdaigle Oct 29, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you

@codecov
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@fc0acc0). Learn more about missing BASE report.
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...c/Microsoft/Data/SqlClient/Server/SqlNormalizer.cs 0.00% 1 Missing ⚠️
....SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2938   +/-   ##
=======================================
  Coverage        ?   72.21%           
=======================================
  Files           ?      291           
  Lines           ?    59709           
  Branches        ?        0           
=======================================
  Hits            ?    43120           
  Misses          ?    16589           
  Partials        ?        0           
Flag Coverage Δ
addons 92.58% <ø> (?)
netcore 75.34% <85.71%> (?)
netfx 70.60% <85.71%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

#if NET8_0_OR_GREATER
#if NET

This comment was marked as duplicate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm not too particular about it - I think we're going to have fun cleaning up all this if/when we drop netfx support. Sorry if I seemed like too much of a stick in the mud about it in your PRs 😬

@mdaigle mdaigle changed the title Cleanup | Remove net6 symbol checks from netcore Clean up Preprocessor Directives After NET6 Removal Oct 31, 2024
@mdaigle mdaigle marked this pull request as ready for review October 31, 2024 16:43
Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Love it - it's not stomping on any of the changes I'm making, and it's good to remove these cases that are no longer necessary

#if NET8_0_OR_GREATER
d.WriteTdsValue(data);
#else
SqlTypeWorkarounds.SqlDecimalExtractData(d, out data[0], out data[1], out data[2], out data[3]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the type workarounds be removed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A quick look says at least some of it can be removed. I'll leave it to @benrr101 because the type workarounds are split across netcore and netfx, so they'll likely be touched by the merge efforts.

@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 1, 2024

LGTM

@mdaigle mdaigle merged commit ab9207a into dotnet:main Nov 1, 2024
76 checks passed
@mdaigle mdaigle deleted the remove-net6-symbols branch November 1, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Health 💊 Issues/PRs that are targeted to source code quality improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants