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

[Weird] HTTP/3 does not work after publishing app, but works on debug and release #79727

Closed
alexandrehtrb opened this issue Dec 16, 2022 · 3 comments

Comments

@alexandrehtrb
Copy link

Description

Hello,

I have a weird bug, that my app can make HTTP/3 requests when running on debug or release, but, when the app is published, it cannot make such requests.
My app is an Avalonia desktop app in .NET 6.
This bug happens in both Linux and Windows versions of the app.

Reproduction Steps

  1. Make a .NET 6 app with a HttpClient making HTTP/3 requests

  2. The app's .csproj has:

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <DebugType>embedded</DebugType>
    <EnablePreviewFeatures>True</EnablePreviewFeatures>
    <EnableCompressionInSingleFile>True</EnableCompressionInSingleFile>
    <PublishReadyToRun>True</PublishReadyToRun>
  </PropertyGroup>
<ItemGroup>
  <RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />
</ItemGroup>
  1. Publish this app like below:
dotnet publish ./src/Pororoca.Desktop/Pororoca.Desktop.csproj `
		--verbosity quiet `
		--nologo `
		--configuration Release `
		-p:PublishSingleFile=true `
		--self-contained true `
		--runtime "win-x64" `
		--output "./out/win-x64/"

Expected behavior

Should make HTTP/3 requests without problems, because it works with dotnet run, whether it is on Debug or Release configurations

Actual behavior

The following Exception is thrown:

System.Net.Http.HttpRequestException: Requesting HTTP version 3.0 with version policy RequestVersionExact while unable to establish HTTP/3 connection.
   at System.Net.Http.HttpConnectionPool.ThrowGetVersionException(HttpRequestMessage request, Int32 desiredVersion)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Pororoca.Infrastructure.Features.Requester.PororocaRequester.RequestAsync(IPororocaVariableResolver variableResolver, PororocaHttpRequest req, Boolean disableSslVerification, CancellationToken cancellationToken) in C:\Projetos\Pororoca\src\Pororoca.Infrastructure\Features\Requester\PororocaRequester.cs:line 37

Regression?

No response

Known Workarounds

No response

Configuration

Running on .NET 6, last app version was compiled with 6.0.403;
Bug confirmed on Linux x64 and Windows 11 x64

Other information

The URLs that I use for testing HTTP/3 are:

https://cloudflare-quic.com/

https://quic.aiortc.org/

The error happens with both of them...

My project is on GitHub, if you want to use it to reproduce the bug:

https://github.com/alexandrehtrb/Pororoca

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 16, 2022
@ghost
Copy link

ghost commented Dec 16, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Hello,

I have a weird bug, that my app can make HTTP/3 requests when running on debug or release, but, when the app is published, it cannot make such requests.
My app is an Avalonia desktop app in .NET 6.
This bug happens in both Linux and Windows versions of the app.

Reproduction Steps

  1. Make a .NET 6 app with a HttpClient making HTTP/3 requests

  2. The app's .csproj has:

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <DebugType>embedded</DebugType>
    <EnablePreviewFeatures>True</EnablePreviewFeatures>
    <EnableCompressionInSingleFile>True</EnableCompressionInSingleFile>
    <PublishReadyToRun>True</PublishReadyToRun>
  </PropertyGroup>
<ItemGroup>
  <RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />
</ItemGroup>
  1. Publish this app like below:
dotnet publish ./src/Pororoca.Desktop/Pororoca.Desktop.csproj `
		--verbosity quiet `
		--nologo `
		--configuration Release `
		-p:PublishSingleFile=true `
		--self-contained true `
		--runtime "win-x64" `
		--output "./out/win-x64/"

Expected behavior

Should make HTTP/3 requests without problems, because it works with dotnet run, whether it is on Debug or Release configurations

Actual behavior

The following Exception is thrown:

System.Net.Http.HttpRequestException: Requesting HTTP version 3.0 with version policy RequestVersionExact while unable to establish HTTP/3 connection.
   at System.Net.Http.HttpConnectionPool.ThrowGetVersionException(HttpRequestMessage request, Int32 desiredVersion)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Pororoca.Infrastructure.Features.Requester.PororocaRequester.RequestAsync(IPororocaVariableResolver variableResolver, PororocaHttpRequest req, Boolean disableSslVerification, CancellationToken cancellationToken) in C:\Projetos\Pororoca\src\Pororoca.Infrastructure\Features\Requester\PororocaRequester.cs:line 37

Regression?

No response

Known Workarounds

No response

Configuration

Running on .NET 6, last app version was compiled with 6.0.403;
Bug confirmed on Linux x64 and Windows 11 x64

Other information

The URLs that I use for testing HTTP/3 are:

https://cloudflare-quic.com/

https://quic.aiortc.org/

The error happens with both of them...

My project is on GitHub, if you want to use it to reproduce the bug:

https://github.com/alexandrehtrb/Pororoca

Author: alexandrehtrb
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@vitek-karas
Copy link
Member

This is very likely same issue as #73290
On Windows the workaround is to copy the msquic.dll file from the runtime install next to your application.
On Linux the msquic needs to be installed - @ManickaP @wfurt for more info.

@rzikm
Copy link
Member

rzikm commented Jan 2, 2023

Closing as duplicate of #73290

@rzikm rzikm closed this as completed Jan 2, 2023
@rzikm rzikm removed the untriaged New issue has not been triaged by the area owner label Jan 2, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 1, 2023
@karelz karelz added this to the 8.0.0 milestone Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants