From a59aea0a2059517e44cac1e6cac7fe898e1e060b Mon Sep 17 00:00:00 2001 From: jacobvc Date: Mon, 27 Sep 2021 14:58:46 -0500 Subject: [PATCH] Replaced destructor with Displose(), and added InvalidOperationException catch. The destructor was never reached because the thread it was intended to cancel never ended. The OperationCancelledException was apparently changed to an invalid operation by an intervening object --- ViscaLibrary/ViscaProtocolProcessor.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ViscaLibrary/ViscaProtocolProcessor.cs b/ViscaLibrary/ViscaProtocolProcessor.cs index f4673ce..5d07df2 100644 --- a/ViscaLibrary/ViscaProtocolProcessor.cs +++ b/ViscaLibrary/ViscaProtocolProcessor.cs @@ -44,7 +44,7 @@ public static T Dequeue(this BlockingCollection queue) } #endif - public class ViscaProtocolProcessor + public class ViscaProtocolProcessor : IDisposable { private readonly Dictionary _cameras = new Dictionary(7); @@ -118,13 +118,13 @@ public ViscaProtocolProcessor(Action sendData, Action /// Commands in the sending queue @@ -324,6 +324,11 @@ private void parseResponse(object obj) logMessage(2, "Visca Response Queue shutdown"); break; } + catch (InvalidOperationException) + { + logMessage(2, "Visca Response Queue shutdown 2"); + break; + } #endif catch (Exception e) {