From 06ea282b483d03bc746b01ae8cd00c0e8a27d3b4 Mon Sep 17 00:00:00 2001 From: Hong Li Date: Thu, 15 Jun 2023 20:02:44 -0700 Subject: [PATCH] Fix for issue#5171 --- .../Channels/ServiceChannelFactory.cs | 5 ----- .../System/ServiceModel/InstanceContext.cs | 19 ------------------- 2 files changed, 24 deletions(-) diff --git a/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelFactory.cs b/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelFactory.cs index 117720ba387..09e434dad19 100644 --- a/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelFactory.cs +++ b/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelFactory.cs @@ -351,11 +351,6 @@ public TChannel CreateChannel(EndpointAddress address, Uri via) } serviceChannel.ClientRuntime.GetRuntime().InitializeChannel(clientChannel); - OperationContext current = OperationContext.Current; - if ((current != null) && (current.InstanceContext != null)) - { - current.InstanceContext.WmiChannels.Add((IChannel)serviceChannel.Proxy); - } return (TChannel)serviceChannel.Proxy; } diff --git a/src/System.ServiceModel.Primitives/src/System/ServiceModel/InstanceContext.cs b/src/System.ServiceModel.Primitives/src/System/ServiceModel/InstanceContext.cs index 8e6ae394d7d..17d8a72e915 100644 --- a/src/System.ServiceModel.Primitives/src/System/ServiceModel/InstanceContext.cs +++ b/src/System.ServiceModel.Primitives/src/System/ServiceModel/InstanceContext.cs @@ -23,7 +23,6 @@ public sealed class InstanceContext : CommunicationObject, IExtensibleObject _wmiChannels; private bool _isUserCreated; public InstanceContext(object implementation) @@ -149,24 +148,6 @@ internal object UserObject get { return _userObject; } } - internal ICollection WmiChannels - { - get - { - if (_wmiChannels == null) - { - lock (ThisLock) - { - if (_wmiChannels == null) - { - _wmiChannels = new SynchronizedCollection(); - } - } - } - return _wmiChannels; - } - } - protected override void OnAbort() { _channels.Abort();