Respect EventSource::IsSupported setting in more codepaths (#51977)
authorMarek Safar <marek.safar@gmail.com>
Wed, 23 Jun 2021 12:56:44 +0000 (14:56 +0200)
committerGitHub <noreply@github.com>
Wed, 23 Jun 2021 12:56:44 +0000 (14:56 +0200)
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

index 321d60d..d6093b4 100644 (file)
@@ -495,6 +495,9 @@ namespace System.Diagnostics.Tracing
         /// </summary>
         public override string ToString()
         {
+            if (!IsSupported)
+                return base.ToString()!;
+
             return SR.Format(SR.EventSource_ToString, Name, Guid);
         }