When using Tibco, what is the cause of this error?
2014-06-27 07:58:39.8230|ERROR|Boot.Processes.ServiceRunner|Ctrl-C handler error.|
System.ObjectDisposedException: Safe handle has been closed
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
at Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
at System.Threading.EventWaitHandle.Set()
at ServiceProxyHelper.SetStateStopped(IServiceProxy serviceProxy) in Container\ServiceProxyHelper.cs:line 387
at ServiceProxyHelper.ShellStop() in Container\ServiceProxyHelper.cs:line 200
at ServiceProxy.ShellStop() in Container\ServiceProxy.cs:line 193
at Boot.Processes.ServiceRunner.ConsoleCancelKeyPress(Object sender, ConsoleCancelEventArgs e) in Boot\Processes\ServiceRunner.cs:line 218
^
This is caused by calling Tibco's Environment.Open()
without calling a matching Tibco Environment.Close()
. Until the reference count reaches 0, Tibco is not actually disposed of properly.
To fix this issue in C#, ensure that there is a .Dispose()
method on every single class that calls Tibco's Environment.Open()
, and this .Dispose()
call calls Tibco's Environment.Close()
.