Fix trimmability issues in Quic test (#85579)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Mon, 1 May 2023 16:58:14 +0000 (01:58 +0900)
committerGitHub <noreply@github.com>
Mon, 1 May 2023 16:58:14 +0000 (09:58 -0700)
src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs
src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs

index 5a60db6..0f47ae1 100644 (file)
@@ -162,7 +162,7 @@ namespace HttpStress
 
             string GetAssemblyInfo(Assembly assembly) => $"{assembly.Location}, modified {new FileInfo(assembly.Location).LastWriteTime}";
 
-            Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi");
+            Type msQuicApiType = Type.GetType("System.Net.Quic.MsQuicApi, System.Net.Quic");
             string msQuicLibraryVersion = (string)msQuicApiType.GetProperty("MsQuicLibraryVersion", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty<object?>());
 
             Console.WriteLine("       .NET Core: " + GetAssemblyInfo(typeof(object).Assembly));
index c5f7fb5..149ac5b 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Net.Quic.Tests
         static unsafe QuicTestBase()
         {
             // If any of the reflection bellow breaks due to changes in "System.Net.Quic.MsQuicApi", also check and fix HttpStress project as it uses the same hack.
-            Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi");
+            Type msQuicApiType = Type.GetType("System.Net.Quic.MsQuicApi, System.Net.Quic");
 
             string msQuicLibraryVersion = (string)msQuicApiType.GetProperty("MsQuicLibraryVersion", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty<object?>());
             Console.WriteLine($"MsQuic {(IsSupported ? "supported" : "not supported")} and using '{msQuicLibraryVersion}'.");