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

Microsoft.AspNetCore.Connections.Abstractions 9.0 needs additional TFM net8.0 #59095

Closed
1 task done
fubar-coder opened this issue Nov 21, 2024 · 3 comments · Fixed by #59219
Closed
1 task done

Microsoft.AspNetCore.Connections.Abstractions 9.0 needs additional TFM net8.0 #59095

fubar-coder opened this issue Nov 21, 2024 · 3 comments · Fixed by #59219
Assignees
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Comments

@fubar-coder
Copy link

fubar-coder commented Nov 21, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Microsoft.AspNetCore.Connections.Abstractions provides an interface ITlsHandshakeFeature, which gained additional members (e.g. NegotiatedCipherSuite) in net8.0.

The problem here is, that this package Microsoft.AspNetCore.Connections.Abstractions targets netstandard2.0, netstandard2.1, and net462 in addition to net9.0. Now assume that you add Microsoft.AspNetCore.Connections.Abstractions 9.0 to a net8.0 project. This causes the netstandard2.1 assembly to be used in ASP.NET Core 8, which now has missing members for ITlsHandshakeFeature, which results in MissingMethodExceptions.

You can find the original issue here: dotnet/orleans#9238

Expected Behavior

Adding Microsoft.AspNetCore.Connections.Abstractions 9.0 to .NET 8.0 should not result in MissingMethodExceptions.

Steps To Reproduce

  1. Create an ASP.NET Core 8 project
  2. Install Microsoft.AspNetCore.Connections.Abstractions 9.0
  3. Publish
  4. Install the web site in your IIS (with HTTPS)

Now watch it crash with the following exception:

[2024-11-19 13:11:34 ERR]  Unexpected exception in static IISHttpServer.HandleRequest.
System.MissingMethodException: Method not found: 'System.Nullable`1<System.Net.Security.TlsCipherSuite> Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature.get_NegotiatedCipherSuite()'.
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.IISContextFactory`1.CreateHttpContext
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.HandleRequest(IntPtr pInProcessHandler, IntPtr pvRequestContext)

Even if you cannot see the exception, you can always inspect the Microsoft.AspNetCore.Connections.Abstractions.dll from the publish directory and see that ITlsHandshakeFeature misses the NegotiatedCipherSuite property, which is only available on .NET Core builds, but a .NET 8.0 target uses the .NET Standard 2.1 build, which contains the incomplete interface.

Exceptions (if any)

[2024-11-19 13:11:34 ERR]  Unexpected exception in static IISHttpServer.HandleRequest.
System.MissingMethodException: Method not found: 'System.Nullable`1<System.Net.Security.TlsCipherSuite> Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature.get_NegotiatedCipherSuite()'.
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.IISContextFactory`1.CreateHttpContext
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.HandleRequest(IntPtr pInProcessHandler, IntPtr pvRequestContext)

.NET Version

9.0.100

Anything else?

  • ASP.NET Core 8
  • net8.0
  • Microsoft.AspNetCore.Connections.Abstractions 9.0
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Nov 21, 2024
@DeagleGross DeagleGross self-assigned this Nov 22, 2024
@DeagleGross
Copy link
Contributor

Marc has explained his thoughts in the linked orleans issue, once we have a decision I will let you know here as well!

@cadusantos
Copy link

Downgrade Microsoft.AspNetCore.Connections.Abstractions 9.0 to 8.0 or install .net9 runtime on server. It worked for me.

@fubar-coder
Copy link
Author

@cadusantos : Some problems with your proposal:

  1. It wasn't me, but a third party library, which used the 9.0 package
  2. Using the .net 9 runtime itself isn't a solution, because you'd have to upgrade to the .NET 9 SDK (including ASP.NET Core)
    1. Updating the projects TFM from LTS (.NET 8.0) to STS (.NET 9.0) isn't always a viable option
    2. The problem is the projects TFM and the wrong interface version in the library for the given TFM

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
Projects
None yet
3 participants