dotnet / dotnet/runtime

NET11 RC1 Quic Connection throws AuthenticationException QUIC_STATUS_TLS_ERROR

Open
#133,978 2 comments 0 reactions 0 assignees View on GitHub
area-System.Net.Quic untriaged
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Description

In .NET 11 RC1 Linux (ubuntu 24.04 and 26.04) QUIC throws AuthenticationException. In previous preview it did not throw the same exception. On Windows it looks fine.

```
System.Security.Authentication.AuthenticationException : Authentication failed: Status code: QUIC_STATUS_TLS_ERROR.
at System.Net.Quic.QuicConnection.HandleEventShutdownInitiatedByTransport(_SHUTDOWN_INITIATED_BY_TRANSPORT_e__Struct& data)
at System.Net.Quic.QuicConnection.HandleConnectionEvent(QUIC_CONNECTION_EVENT& connectionEvent)
at System.Net.Quic.QuicConnection.NativeCallback(QUIC_HANDLE* connection, Void* context, QUIC_CONNECTION_EVENT* connectionEvent)
--- End of stack trace from previous location ---
at System.Net.Quic.ValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Quic.QuicConnection.FinishConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken)
at System.Net.Quic.QuicConnection.g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken)
at System.Net.Quic.QuicConnection.g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken)
```

### Reproduction Steps

```csharp
internal static async Task SetupConnectionAsync(int port, CancellationToken token)
{
(ValueTask quicServerConnecting, QuicListener listener) = await CreateServerAsync(port, token);
var quicClientConnection = await ConnectClientAsync(port, token);
var quicServerConnection = await quicServerConnecting;
return new ClientServerConnection(quicClientConnection, quicServerConnection, listener);
}

internal static async Task<(ValueTask, QuicListener)> CreateServerAsync(int port, CancellationToken token)
{
var serverConnectionOptions = new QuicServerConnectionOptions
{
DefaultStreamErrorCode = 0x010C,
DefaultCloseErrorCode = 0x0100,
ServerAuthenticationOptions = new SslServerAuthenticationOptions
{
ServerCertificate = X509CertificateLoader.LoadPkcs12FromFile("my-self-signed.pfx", "my-password"),
ApplicationProtocols = [new SslApplicationProtocol("h3"u8.ToArray())],
EnabledSslProtocols = SslProtocols.Tls13
},
IdleTimeout = Debugger.IsAttached ? TimeSpan.MaxValue : TimeSpan.Zero,
};
var listener = await QuicListener.ListenAsync(new QuicListenerOptions
{
ListenEndPoint = new IPEndPoint(IPAddress.Loopback, port),
ListenBacklog = 1,
ApplicationProtocols = [new SslApplicationProtocol("h3"u8.ToArray())],
ConnectionOptionsCallback = (_, _, _) => ValueTask.FromResult(serverConnectionOptions),
}, token);
var quicServerConnecting = listener.AcceptConnectionAsync(token);
return (quicServerConnecting, listener);
}

internal static async Task ConnectClientAsync(int port, CancellationToken token)
{
return await QuicConnection.ConnectAsync(new QuicClientConnectionOptions()
{
RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, port),
DefaultCloseErrorCode = 0x0100,
DefaultStreamErrorCode = 0x010C,
MaxInboundUnidirectionalStreams = 1,
ClientAuthenticationOptions = new SslClientAuthenticationOptions() { RemoteCertificateValidationCallback = (_, _, _, _) => true, ApplicationProtocols = [new SslApplicationProtocol("h3"u8.ToArray())] },
IdleTimeout = Debugger.IsAttached ? TimeSpan.MaxValue : TimeSpan.Zero,
}, token);
}
}
```

### Expected behavior

No QUIC_STATUS_TLS_ERROR - as there is nothing on Windows, and no errors previously.

### Actual behavior

AuthenticationException with QUIC_STATUS_TLS_ERROR

### Regression?

First observed on .NET 11 RC1

### Known Workarounds

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied QuicListener and QuicConnection setup on Ubuntu 24.04 or 26.04, comparing it with Windows and the previous preview. Trace System.Net.Quic.QuicConnection.FinishConnectAsync and HandleEventShutdownInitiatedByTransport around the QUIC_STATUS_TLS_ERROR. Done means the loopback connection no longer throws AuthenticationException on the affected Linux versions while preserving the expected Windows behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, linux
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.