Skip to content

.NET 8 QuicConnection AuthenticationException: RemoteCertificateNameMismatch #95072

@GF-Huang

Description

@GF-Huang

Description

In .NET Interactive environment (.NET 7.0.14), QuicConnection.ConnectAsync successful, but in .NET 8 console app, it fails with System.Security.Authentication.AuthenticationException due to RemoteCertificateNameMismatch.

.NET 7 interactive notebook successful

image

.NET 8 console app exception

image

Reproduction Steps

Just create a new .NET 8 console app and run the following code:

using System.Net.Quic;
using System.Net.Security;
using System.Net;

using var cts = new CancellationTokenSource(10_000);

await using var connection = await QuicConnection.ConnectAsync(new QuicClientConnectionOptions {
    RemoteEndPoint = new DnsEndPoint("unfiltered.adguard-dns.com", 853),
    DefaultStreamErrorCode = 0,
    DefaultCloseErrorCode = 0,
    ClientAuthenticationOptions = new SslClientAuthenticationOptions {
        ApplicationProtocols = [new SslApplicationProtocol("doq")]
    }
}, cts.Token);

Console.WriteLine("Connected.");

Expected behavior

Connect to the unfiltered.adguard-dns.com successful.

Actual behavior

Got exception AuthenticationException due to RemoteCertificateNameMismatch.

Regression?

Works well in VSCode Polyglot Notebooks v1.0.4562010 with .NET 7 (7.0.14) environment.

Known Workarounds

No response

Configuration

.NET 8
Win11 22H2 22621.2715
x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.QuicenhancementProduct code improvement that does NOT require public API changes/additionsgood first issueIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions