Avoid loading resources for an SslStream exception never thrown (dotnet/corefx#39414)
authorStephen Toub <stoub@microsoft.com>
Fri, 12 Jul 2019 00:28:09 +0000 (20:28 -0400)
committerGitHub <noreply@github.com>
Fri, 12 Jul 2019 00:28:09 +0000 (20:28 -0400)
SslStream's cctor creates an ObjectDisposedException it uses as a sentinel, but this instance is never actually thrown.  As such, we don't need to pay to load resources for it.

Commit migrated from https://github.com/dotnet/corefx/commit/7055a28952ce82e79f93519a68025dc884545645

src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs

index f20a5f9..43fdf85 100644 (file)
@@ -64,7 +64,7 @@ namespace System.Net.Security
         private object _queuedReadStateRequest;
 
         /// <summary>Set as the _exception when the instance is disposed.</summary>
-        private static readonly ExceptionDispatchInfo s_disposedSentinel = ExceptionDispatchInfo.Capture(new ObjectDisposedException(nameof(SslStream)));
+        private static readonly ExceptionDispatchInfo s_disposedSentinel = ExceptionDispatchInfo.Capture(new ObjectDisposedException(nameof(SslStream), (string)null));
 
         private void ThrowIfExceptional()
         {