Skip to content

Drop .NET Standard 2.1 target #1040

@paulirwin

Description

@paulirwin

Is there an existing issue for this?

  • I have searched the existing issues

Task description

As part of implementing #1039, it dawned on me. I'd like to propose that we drop the .NET Standard 2.1 (netstandard2.1) target. I don't think it makes much sense going into 2025 with the limited amount of currently-supported implementations that support it that aren't already covered by our netstandard2.0 or net8.0 targets.

Docs: https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1

As a reminder, no version of .NET Framework or UWP supports netstandard2.1, so those can either use our net462 target or netstandard2.0. Xamarin is now out of support as well, along with .NET (Core) 3.0-7.0.

The only currently supported .NET implementations that support netstandard2.1 in that list are:

  • .NET 8 (we already have a net8.0 target for this)
  • .NET 9 (would use our net8.0 target)
  • Mono 6.4+
  • Unity 2021.2, maybe?

The first two are covered by our net8.0 target and thus don't apply. (If we added a net9.0 target, it also wouldn't use the netstandard2.1 build.) The latter two presumably have no issues running netstandard2.0, and Mono 6.4 is listed on the netstandard2.0 tab as well. As far as I can tell, Unity releases get 2 years of LTS support, so 2021.2 should be out of support by now anyways, if I understand correctly. But again, even then, it should be able to use netstandard2.0.

So, basically, we'd be keeping this target around for some slight possible performance optimizations for... people running apps on Mono. (And again, I'm referring to Mono specifically here, not Xamarin running on Mono, which is out of support.)

This target was added in 0482957 in 2019, and I don't see any issues about justifications for why it was added. I assume it was added as an attempt to have just one target to support both Xamarin and .NET Core 3.x-5 primarily, since the next major target that was added was net6.0.

For posterity, the Lucene.NET compilation features that .NET Standard 2.1 supports that 2.0 does not are:

  • FEATURE_ARRAY_FILL
  • FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR
  • FEATURE_CONDITIONALWEAKTABLE_ADDORUPDATE
  • FEATURE_NUMBER_PARSE_READONLYSPAN
  • FEATURE_STREAM_READ_SPAN
  • FEATURE_STRINGBUILDER_APPEND_READONLYSPAN
  • FEATURE_QUEUE_TRYDEQUEUE_TRYPEEK

As we get closer to a 4.8.0 final release, I think we have to determine if this is worth supporting for however many years into the future we have to support it, just for already-older versions of Mono and Unity. Microsoft themselves recommend skipping netstandard2.1 if you can.

Dropping .NET Standard 2.1 would have several benefits:

  • One less target to build for and faster local builds (at least until we add another target)
  • We would not need to run tests against .NET 6 (as of Drop net6.0 target and use net6.0 to run netstandard2.1 tests, #1020 #1039; .NET 5 before this) to test netstandard2.1, reducing test time and resources
  • We therefore would also not need to install the unsupported .NET 6 SDK in the builds
  • We could simplify some of the logic for the feature constants

Given the tradeoffs, is it still worth supporting netstandard2.1 as a target today?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions