Fix trimming of System.Net.Ping (dotnet/corefx#41180)
authorStephen Toub <stoub@microsoft.com>
Wed, 18 Sep 2019 19:29:16 +0000 (15:29 -0400)
committerGitHub <noreply@github.com>
Wed, 18 Sep 2019 19:29:16 +0000 (15:29 -0400)
It has an ILLinkTrim.xml file that was keeping a type around for testing, but that's apparently keeping the assembly from being trimmed in a published app.

Commit migrated from https://github.com/dotnet/corefx/commit/64c7228b941d1402009c57441a5a8c634d0e6843

src/libraries/System.Net.Ping/src/ILLinkTrim.xml [deleted file]
src/libraries/System.Net.Ping/tests/FunctionalTests/LoggingTest.cs

diff --git a/src/libraries/System.Net.Ping/src/ILLinkTrim.xml b/src/libraries/System.Net.Ping/src/ILLinkTrim.xml
deleted file mode 100644 (file)
index aa0107d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<linker>
-  <assembly fullname="System.Net.Ping">
-    <!-- NetEventSource isn't used by this assembly but tests check for its presence -->
-    <type fullname="System.Net.NetEventSource" />
-  </assembly>
-</linker>
\ No newline at end of file
index f82fec7..bb4ebd7 100644 (file)
@@ -12,13 +12,13 @@ namespace System.Net.NetworkInformation.Tests
         [Fact]
         public void EventSource_ExistsWithCorrectId()
         {
-            Type esType = typeof(Ping).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
-            Assert.NotNull(esType);
-
-            Assert.Equal("Microsoft-System-Net-Ping", EventSource.GetName(esType));
-            Assert.Equal(Guid.Parse("a771ec4a-7260-59ce-0475-db257437ed8c"), EventSource.GetGuid(esType));
-
-            Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
+            Type esType = typeof(Ping).Assembly.GetType("System.Net.NetEventSource", throwOnError: false, ignoreCase: false);
+            if (esType != null)
+            {
+                Assert.Equal("Microsoft-System-Net-Ping", EventSource.GetName(esType));
+                Assert.Equal(Guid.Parse("a771ec4a-7260-59ce-0475-db257437ed8c"), EventSource.GetGuid(esType));
+                Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
+            }
         }
     }
 }