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

HttpClient not working after AOT #1883

Closed
sorainnosia opened this issue Apr 1, 2022 · 7 comments
Closed

HttpClient not working after AOT #1883

sorainnosia opened this issue Apr 1, 2022 · 7 comments
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation

Comments

@sorainnosia
Copy link

sorainnosia commented Apr 1, 2022

Compile to AOT using NativeAOT, method that uses system.net.http.httpclient pause when retrieving httpresponsemessage

Waited a long time and no output return

While compile using bflat it works. The URL is http not https

@jkotas
Copy link
Member

jkotas commented Apr 1, 2022

Could you please share a short program that reproduces the problem, and version of the NativeAOT package that you are seeing this problem with?

@jkotas jkotas added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Apr 1, 2022
@sorainnosia
Copy link
Author

sorainnosia commented Apr 2, 2022

Hangs when calling below
HttpClient cwc = new HttpClient();
HttpResponseMessage msg = cwc.GetAsync(url2).Result;
string page = msg.Content.ReadAsStringAsync().Result;

NativeAOT version : Microsoft.DotNet.ILCompiler 7.0.0-preview2.22152.2

@jkotas
Copy link
Member

jkotas commented Apr 2, 2022

I have tried this against https://www.bing.com and it works fine. Can you share the url2 of the server if it is public, or at least share what kind of server is it?

Microsoft.DotNet.ILCompiler 7.0.0-preview2.22152.2

You may want to try our nightly build feed that is preview4 currently: https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/compiling.md#add-ilcompiler-package-reference . The problem might have been fixed already.

@sorainnosia
Copy link
Author

sorainnosia commented Apr 2, 2022

censored url

@jkotas
Copy link
Member

jkotas commented Apr 2, 2022

Hmm, this url works fine for me. Are you on Windows, Linux or macOS?

@sorainnosia
Copy link
Author

that's strange, let me tried again

@sorainnosia
Copy link
Author

sorainnosia commented Apr 2, 2022

it works now, probably i used the wrong version

thanks

Edit :
Found out the reason, because I disable Reflection, after setting

<IlcDisableReflection>false</IlcDisableReflection>

It is working fine now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

No branches or pull requests

2 participants