未触发ClientDisconnected [英] ClientDisconnected is not being triggered

查看:145
本文介绍了未触发ClientDisconnected的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用UISuppressed客户端应用程序时发现了奇怪的情况。



有时,我的通讯器失败了。 (我还没弄清楚为什么会发生这种情况,但我目前最好的猜测是某种类型的超时?我知道我没有丢失互联网连接)



除了事实上,我不知道为什么它失败了,我的LyncClient.ClientDisconnected没有被触发。

我发现这很奇怪,所以我开始试图强迫它触发。



这导致以下结果:

-如果我结束了沟通过程,程序将继续,好像什么也没发生过。


- 如果我设置断点,程序会找到断点,然后成功通过它。
-但是,如果我通过了SAME断点,但这次查看了我的本地变量中的LyncClient对象,触发了LyncClient.ClientDisconnected事件。$


同样有趣的是,一旦删除了通信器,客户端的状态就会变为无效,但是statechanged事件也永远不会被触发。



除非我试图查看客户端,否则如果没有触发这些事件我应该如何处理?

解决方案

查看此帖子并查看它是否适用于您的问题:
Self.Contact i重新启动Lync客户端后返回null


部分帖子:


您在应用程序中提到了调用GetClient( )当与Lync客户端的连接丢失时,在您的计时器回调中。问题是,如果您的代码通过侦听LyncClient.Disconnected
事件检测到与Lync客户端的连接,那么您会遇到麻烦,因为如果您不对无效的方法调用任何方法,则不会引发此事件Lync SDK对象。


Lync API GetClient()缓存Lync客户端对象,并在没有发生错误时返回缓存对象。因此,即使Lync客户端退出并重新启动,应用程序也始终获取缓存对象。


为了使先前缓存的Lync客户端对象无效,应用程序可以调用LyncClient.State属性或LyncClient.Capabilities使Lync对象抛出异常。这有效地使缓存的对象无效,并使LyncClient.Disconnected
事件被引发。




I have found and odd situation popping up while working on a UISuppressed Client application.

On occasion, my communicator fails. (I have yet to figure out why this happens, but my best guess currently is some type of timeout? I know I haven't lost internet connection)

Aside from the fact that I am unaware WHY it is failing, my LyncClient.ClientDisconnected is not triggered.
I found this odd, so I began trying to FORCE it to trigger.

This lead to the following:
-If I ended my communicator process, the program would continue as though nothing had happened.

-If I set a breakpoint, the program would find the breakpoint, and pass through it successfully
-However, if I went through the SAME breakpoint but this time viewed my LyncClient object in my Local Variables, the LyncClient.ClientDisconnected event is triggered

Also interesting is that once the communicator is removed, the client's state moves to Invalid, but the statechanged event is also never triggered.

How I am supposed to handle such events if they are not triggered unless I attempt to view the client?

解决方案

Check this post and see if it applies to your problem: Self.Contact is null after restarting Lync Client

Part of the post:

You mentioned that in your application you call GetClient() in your timer callback when the connection to the Lync client gets lost. The problem is if your code detects the connectivity with Lync client by listening to the LyncClient.Disconnected event, then you run into trouble because this event won't get raised if you don't call any method on an invalid Lync SDK object.

The Lync API GetClient() caches the Lync client object and will return the cached object when there's no error occurred. So the application always gets the cached object even though the Lync client exits and restarts.

In order to invalidate the previously cached Lync client object, the application can call LyncClient.State property or LyncClient.Capabilities to make the Lync object throw exceptions. This effectively invalidates the cached object, and makes the LyncClient.Disconnected event to be raised.


这篇关于未触发ClientDisconnected的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆