From c3e5c14109b1ef996604f6e01fe4a3887edc12d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Thu, 14 Dec 2023 19:15:10 +0100 Subject: [PATCH] Make ServiceChannelProxy implement IAsyncDisposable So that channels created through a `ChannelFactory` without inheriting from `ClientBase` can also benefit from the asynchronous disposal improvements introduced in #4865. Fixes #5270 --- .../System/ServiceModel/Channels/ServiceChannelProxy.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs b/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs index 6eeadaf97c6..10d0aec6253 100644 --- a/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs +++ b/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs @@ -15,7 +15,7 @@ namespace System.ServiceModel.Channels { - public class ServiceChannelProxy : DispatchProxy, ICommunicationObject, IChannel, IClientChannel, IOutputChannel, IRequestChannel, IServiceChannel, IDuplexContextChannel + public class ServiceChannelProxy : DispatchProxy, ICommunicationObject, IChannel, IClientChannel, IOutputChannel, IRequestChannel, IServiceChannel, IDuplexContextChannel, IAsyncDisposable { private const String activityIdSlotName = "E2ETrace.ActivityID"; private Type _proxiedType; @@ -673,6 +673,11 @@ void IDisposable.Dispose() ((IClientChannel)_serviceChannel).Dispose(); } + ValueTask IAsyncDisposable.DisposeAsync() + { + return ((IAsyncDisposable)_serviceChannel).DisposeAsync(); + } + bool IContextChannel.AllowOutputBatching { get