load msquic early to avoid interference with RemoteExecutor (#75424)
authorTomas Weinfurt <tweinfurt@yahoo.com>
Mon, 12 Sep 2022 17:43:08 +0000 (10:43 -0700)
committerGitHub <noreply@github.com>
Mon, 12 Sep 2022 17:43:08 +0000 (10:43 -0700)
* load quic early

* feedback from review

* enable tests again on Mono

* Update src/libraries/System.Net.Requests/tests/QuicLoad.cs

* Update src/libraries/System.Net.Requests/tests/QuicLoad.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
src/libraries/System.Net.Requests/tests/AssemblyInfo.cs
src/libraries/System.Net.Requests/tests/QuicLoad.cs [new file with mode: 0644]
src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj

index 6fa7258..ef5fa46 100644 (file)
@@ -5,4 +5,3 @@ using System;
 using Xunit;
 
 [assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Requests is not supported on Browser.")]
-[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/74795", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoLinuxArm64))]
diff --git a/src/libraries/System.Net.Requests/tests/QuicLoad.cs b/src/libraries/System.Net.Requests/tests/QuicLoad.cs
new file mode 100644 (file)
index 0000000..24de3c8
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.Net.Quic;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.Test.Common
+{
+    public static class QuicLoad
+    {
+        [ModuleInitializer]
+        internal static void InitializeQuic()
+        {
+            // This will load Quic (if supported) to avoid interference with RemoteExecutor
+            // See https://github.com/dotnet/runtime/pull/75424 for more details
+            // IsSupported currently does not unload lttng. If it does in the future,
+            // we may need to call some real Quic API here to get everything loaded properly
+            _ = OperatingSystem.IsLinux() && QuicConnection.IsSupported;
+        }
+    }
+}
index 868d358..0e063a6 100644 (file)
@@ -9,11 +9,13 @@
     <NoWarn>$(NoWarn);SYSLIB0014</NoWarn>
     <!-- the res/xml/network_security_config.xml file comes from the System.Net.TestData package -->
     <IncludeNetworkSecurityConfig Condition="'$(TargetOS)' == 'Android'">true</IncludeNetworkSecurityConfig>
+    <EnablePreviewFeatures>true</EnablePreviewFeatures>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="AssemblyInfo.cs" />
     <Compile Include="HttpWebRequestTest.cs" />
     <Compile Include="HttpWebResponseTest.cs" />
+    <Compile Include="QuicLoad.cs" />
     <Compile Include="RequestStreamTest.cs" />
     <Compile Include="WebRequestTest.cs" />
     <Compile Include="$(CommonTestPath)System\Net\Capability.Security.cs"