From da894a35277539f9f4cb59e9f981e2e7f55f8caa Mon Sep 17 00:00:00 2001 From: Niklas Therning Date: Mon, 7 Nov 2016 15:00:05 +0100 Subject: [PATCH] Fix NRE in Win32 IpcChannel.StopListening() when no server started This makes the System.Runtime.Remoting test suite fail in various places on Windows due to the TestFixtureTearDown method in BaseCalls throwing an NRE. --- .../IpcChannel.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/IpcChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/IpcChannel.cs index 883ea72ebe2..599edd8a803 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/IpcChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/IpcChannel.cs @@ -115,7 +115,8 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32 public void StartListening(object data) { - serverChannel.StartListening(data); + if (serverChannel != null) + serverChannel.StartListening(data); } public object ChannelData @@ -128,7 +129,8 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32 public void StopListening(object data) { - serverChannel.StopListening(data); + if (serverChannel != null) + serverChannel.StopListening(data); } public string[] GetUrlsForUri(string objectURI) -- 2.25.1