- Posts: 5
- Joined: Thu Nov 10, 2022 12:39 pm
- Real Name: Tomas Mejzr
Hi Tomas,
Each call to IBMDSwitcherDiscovery.ConnectTo will open a new connection with the output IBMDSwitcher object. When the IBMDSwitcher objected is released, then the connection will be closed.
The issue I can see is that in C# managed code, the RCW won't release the COM object straight away, and will only do so when the garbage collector cleans up all unreferenced objects. Because of this you may have exhausted the number of open connections.
To resolve, I suggest calling Marshal.FinalReleaseComObject on the IBMDSwitcher object once you have finished with the object to ensure that the RCW reference count is decremented.
https://learn.microsoft.com/en-us/dotne ... ew=net-7.0
Regards
Cameron