如何修复使用Tibco时在进程退出时抛出的此错误?

时间:2014-06-27 07:25:49

标签: c# tibco-rv

使用Tibco时,出现此错误的原因是什么?

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
^

1 个答案:

答案 0 :(得分:1)

这是因为调用Tibco的Environment.Open()而未调用匹配的Tibco Environment.Close()。在引用计数达到0之前,Tibco实际上没有被正确处理。

要在C#中解决此问题,请确保在每个调用Tibco的.Dispose()的课程中都有Environment.Open()方法,此.Dispose()来电呼叫Tibco&#39 ; s Environment.Close()