-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Don't call into unsupported APIs on build targets which don't support quic #49261
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
Changes from 15 commits
ba66ddb
90b4e11
308b2f5
de703d5
b50a11f
5e654f6
7f31198
a12fa4a
2dd36e1
f32aeb5
4831c4c
b737eca
5c98140
1362cf0
7304863
62323da
afb4cd5
e969f29
f8d3506
b26e3df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.IO; | ||
| using System.Net.Http; | ||
| using System.Threading.Tasks; | ||
|
|
||
| class Program | ||
| { | ||
| static async Task<int> Main(string[] args) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the intention of this test. I also don't understand why a trimming test is being included in a change concerning the Platform Compatibility Analyzer.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to trim System.Net.Quic.dll as well. |
||
| { | ||
| using var client = new HttpClient(); | ||
| using var response = await client.GetAsync("https://www.microsoft.com"); | ||
| var result = await response.Content.ReadAsStringAsync(); | ||
| Console.WriteLine(result); | ||
|
|
||
| const string quicDll = "System.Net.Quic.dll"; | ||
| var quicDllExists = File.Exists(Path.Combine(AppContext.BaseDirectory, quicDll)); | ||
|
|
||
| // TODO: Replace with Platform-Guard Assertion Annotations once https://github.com/dotnet/runtime/issues/44922 is finished | ||
| if (OperatingSystem.IsLinux() || OperatingSystem.IsWindows() || OperatingSystem.IsMacOS()) | ||
| { | ||
| Console.WriteLine($"Expected {quicDll} is {(quicDllExists ? "present - OK" : "missing - BAD")}."); | ||
| return quicDllExists ? 100 : -1; | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine($"Unexpected {quicDll} is {(quicDllExists ? "present - BAD" : "missing - OK")}."); | ||
| return quicDllExists ? -1 : 100; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <Project DefaultTargets="Build"> | ||
| <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" /> | ||
|
|
||
| <ItemGroup> | ||
| <TestConsoleAppSourceFiles Include="HttpClientTest.cs" /> | ||
| </ItemGroup> | ||
|
|
||
| <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" /> | ||
| </Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Once this PR goes through, I plan to send a follow-up PR that utilizes the
<SupportedOSPlatforms>property instead of<IsWindowsSpecific>. jeffhandley@0f530be