Skip to content

Commit 46875f5

Browse files
authored
System.Net.Requests: Pick correct RemoteExecutor overload in test (#74994)
The test was using `RemoteExecutor.Invoke(Action<string, string, string, string> method, ...)` since there is no overload that takes `Func<string, string, string, string, Task>` (only one with three strings) and that means it's becoming an async void. The delegate that gets invoked will return the moment the method awaits something not yet completed, so now there's a race condition, where `RemoteExecutor.Invoke` thinks all work is done, but there's still likely work running and it'll start doing all its cleanup stuff like killing child processes. Fix by removing one string parameter so it picks the correct overload. I'll also open an arcade PR to add an overload with four string arguments. Fixes #74667
1 parent cb10fa9 commit 46875f5

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/libraries/System.Net.Requests/tests/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
using Xunit;
66

77
[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
8-
[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/74667", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoLinuxArm64))]
98
[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Requests is not supported on Browser.")]

src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,12 +1978,12 @@ await server.AcceptConnectionAsync(async connection =>
19781978
}
19791979

19801980
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
1981-
[InlineData(RequestCacheLevel.NoCacheNoStore, new string[] { "Pragma: no-cache", "Cache-Control: no-store, no-cache" })]
1982-
[InlineData(RequestCacheLevel.Reload, new string[] { "Pragma: no-cache", "Cache-Control: no-cache" })]
1981+
[InlineData(RequestCacheLevel.NoCacheNoStore, "Cache-Control: no-store, no-cache")]
1982+
[InlineData(RequestCacheLevel.Reload, "Cache-Control: no-cache")]
19831983
public void SendHttpGetRequest_WithGlobalCachePolicy_AddCacheHeaders(
1984-
RequestCacheLevel requestCacheLevel, string[] expectedHeaders)
1984+
RequestCacheLevel requestCacheLevel, string expectedHeader)
19851985
{
1986-
RemoteExecutor.Invoke(async (async, reqCacheLevel, eh0, eh1) =>
1986+
RemoteExecutor.Invoke(async (async, reqCacheLevel, eh) =>
19871987
{
19881988
await LoopbackServer.CreateServerAsync(async (server, uri) =>
19891989
{
@@ -1994,16 +1994,16 @@ await LoopbackServer.CreateServerAsync(async (server, uri) =>
19941994
await server.AcceptConnectionAsync(async connection =>
19951995
{
19961996
List<string> headers = await connection.ReadRequestHeaderAndSendResponseAsync();
1997-
Assert.Contains(eh0, headers);
1998-
Assert.Contains(eh1, headers);
1997+
Assert.Contains("Pragma: no-cache", headers);
1998+
Assert.Contains(eh, headers);
19991999
});
20002000

20012001
using (var response = (HttpWebResponse)await getResponse)
20022002
{
20032003
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
20042004
}
20052005
});
2006-
}, (this is HttpWebRequestTest_Async).ToString(), requestCacheLevel.ToString(), expectedHeaders[0], expectedHeaders[1]).Dispose();
2006+
}, (this is HttpWebRequestTest_Async).ToString(), requestCacheLevel.ToString(), expectedHeader).Dispose();
20072007
}
20082008

20092009
[Theory]

0 commit comments

Comments
 (0)