Skip to content

Limit ITlsHandshakeFeature.Exception on Connections.Abstractions for #if NETCOREAPP#66300

Merged
DeagleGross merged 1 commit intodotnet:mainfrom
DeagleGross:dmkorolev/connection-abstractions-tlsexception-net10
Apr 22, 2026
Merged

Limit ITlsHandshakeFeature.Exception on Connections.Abstractions for #if NETCOREAPP#66300
DeagleGross merged 1 commit intodotnet:mainfrom
DeagleGross:dmkorolev/connection-abstractions-tlsexception-net10

Conversation

@DeagleGross
Copy link
Copy Markdown
Member

#65807 introduced Exception property with #if NET_11_OR_GREATER which makes release of Connections.Abstractions be TFM dependant as well. We should make the APIs match across different TFMs for same NuGet version.

I think simply returning null is ok here. I do not like the idea of throwing an exception as DIM, because that's an extra thing for the user to handle. For net10 apps referncing net11 NuGet package it will throw everytime, which is impacting perf for no reason

@DeagleGross DeagleGross self-assigned this Apr 13, 2026
@DeagleGross DeagleGross requested a review from halter73 as a code owner April 13, 2026 17:33
Copilot AI review requested due to automatic review settings April 13, 2026 17:33
@DeagleGross DeagleGross added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns the ITlsHandshakeFeature.Exception API surface across the Connections.Abstractions netcoreapp TFMs (e.g., net10 and net11) for the same package version by gating it on NETCOREAPP and providing a default null implementation.

Changes:

  • Switch ITlsHandshakeFeature.Exception compilation guard from NET11_0_OR_GREATER to NETCOREAPP.
  • Add the Exception getter to the net10 public API unshipped list.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Servers/Connections.Abstractions/src/PublicAPI/net10.0/PublicAPI.Unshipped.txt Declares the new ITlsHandshakeFeature.Exception getter as part of the net10 API surface.
src/Servers/Connections.Abstractions/src/Features/ITlsHandshakeFeature.cs Makes Exception available for all NETCOREAPP builds with a default null implementation.

@halter73
Copy link
Copy Markdown
Member

I think simply returning null is ok here. I do not like the idea of throwing an exception as DIM, because that's an extra thing for the user to handle. For net10 apps referncing net11 NuGet package it will throw everytime, which is impacting perf for no reason

Agreed. Did you test out the preview package/dll with the net10 ASP.NET Core shared framework? I totally understand if you didn't. But if not, try to do this after this gets released as a preview at least.

@DeagleGross DeagleGross merged commit cd704c1 into dotnet:main Apr 22, 2026
43 checks passed
@DeagleGross DeagleGross deleted the dmkorolev/connection-abstractions-tlsexception-net10 branch April 22, 2026 17:33
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 22, 2026
@wtgodbe wtgodbe modified the milestones: 11.0-preview4, 11.0-preview5 Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants