Skip to content

QuicConnection.ConnectAsync raises SocketException when host not found #78751

Closed

Description

@bentoi

Description

The QuicConnect.ConnectAsync method raises a SocketException(SocketErrorCode = HostNotFound) if the resolution of a DnsEndPoint set with QuicClientOptions.RemoteEndpoint fails. I did expect a QuicException with a suitable error code instead.

Reproduction Steps

await using var connection = await QuicConnection.ConnectAsync(new QuicClientConnectionOptions
    {
          RemoteEndPoint = new DnsEndPoint("bogus.foo.com", 5001);
          ClientAuthenticationOptions = new SslClientAuthenticationOptions { ... } 
    });

Expected behavior

A QuicException with suitable QuicError.

Actual behavior

It raises a SocketException.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Nov 23, 2022
  2. removed
    untriagedNew issue has not been triaged by the area owner
    on Nov 23, 2022
  3. added this to the 8.0.0 milestone on Nov 23, 2022
  4. ManickaP commented on Nov 23, 2022

    @ManickaP
    Member

    We have several places where we don't raise QuicException. Some raise AuthenticationException for example. However, it might be unexpected to get SocketException, seemingly System.Net.Sockets exclusive type, from System.Net.Quic.
    On the other hand, in #76435 we got a feedback that we could leverage SocketException, albeit as a wrapped exception.
    Lastly, in #75184, we have another use case that expects us to always wrap in QuicException.

    Either way, we have several loosely related issue to exception types and their wrapping. We should take all this feedback and come up with a comprehensive solution to this.

    Triage: this should be settled in 8.0.

    cc: @rzikm

  5. wfurt commented on Nov 23, 2022

    @wfurt
    Member

    It seems like we don't document what ConnectAsync can throw. We should probably fix that regardless of the choice so callers can handle that properly.

  6. alexrp commented on Nov 24, 2022

    @alexrp
    Contributor

    It seems like we don't document what ConnectAsync can throw.

    Just for the record, that seems to be a pervasive issue with all the QUIC API documentation, not just this particular method.

  7. antonfirsov commented on Nov 24, 2022

    @antonfirsov
    Contributor

    Note that we shouldn't document stored (async) exceptions in the exception section of the API docs - dotnet/dotnet-api-docs#7840 (comment). The fact that we do it for some of the networking API docs is a violation of general BCL API doc practices.

  8. alexrp commented on Nov 24, 2022

    @alexrp
    Contributor

    Note that we shouldn't document stored (async) exceptions in the exception section of the API docs - dotnet/dotnet-api-docs#7840 (comment). The fact that we do it for some of the networking API docs is a violation of general BCL API doc practices.

    That issue mentions that async APIs should point to sync APIs for the possible exceptions. There are no sync APIs for QUIC at this time, though?

  9. antonfirsov commented on Nov 24, 2022

    @antonfirsov
    Contributor

    Yepp, just pointed it out in the discussion.

  10. ManickaP commented on Jan 19, 2023

    @ManickaP
    Member

    Triage: this is part of bigger revision on exception in Quic. We should address this 8.0.

    Slightly related: #75184

  11. self-assigned this
    on Jun 30, 2023
  12. wfurt commented on Jun 30, 2023

    @wfurt
    Member

    We agreed to throw SocketException for transport errors - part of #82262 and based on API review feedback.

    e.g. QuicExecption will indicate erros at Quic layer, SocketException with indicate problems bellow - e.g. IP or UDP. We shall document that somehow, perhaps as remarks because of pending debate about exceptions thrown synchronously vs exceptions stored in resulting Task.

  13. added
    documentationDocumentation bug or enhancement, does not impact product or test code
    on Jun 30, 2023
  14. ManickaP commented on Oct 3, 2023

    @ManickaP
    Member

    Closing this in lieu of #92943

  15. modified the milestones: 8.0.0, 9.0.0 on Oct 11, 2023
  16. ghost locked as resolved and limited conversation to collaborators on Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Net.QuicdocumentationDocumentation bug or enhancement, does not impact product or test code

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions