Lync NotInitializedException uncatchable on windows 8

256 views Asked by At

I use lync Sdk to dock Lync conversation within my own wfp application. The problem is that when I try to dock the conversation like this:

public void Dock(Conversation conversation, IntPtr host)
{
  try
  {
    ConversationWindow window = _automation.GetConversationWindow(conversation);
    if (window.State == ConversationWindowState.Initialized)
    {
      window.Dock(host);
    }
  }
  catch (Exception ex)
  {
  }
}

sometime the window.State change between the verification and the docking and on windows 8 the generated exception seems to be not catchable and cause my application to crash where on windows 7 the exception is just catch.

the exception is of type Microsoft.Lync.Model.NotInitializedException

2

There are 2 answers

0
JRoughan On

I've found that Lync can be very finnicky about which thread it performs operations on. Some of the strangest behavior we've seen is when calls are expected to be made on the thread that created the conference/conversation and are called on another thread instead. Not seeing exceptions was definitely one of the oddities in these scenarios.

If I were you I'd dedicate a thread to performing Lync operations and poke these operations into it where needed (maybe with any callbacks to make the interface nice and clean).

If you just want to check that threading is your issue you could always dispatch these calls onto the WPF dispatcher to confirm (once confirmed you'll need to have your own threading model if you don't want to lock up the UI)

0
user3076137 On

No answer, but a suggestion. You might also try posting your question here:

Lync Client Developer Forum

If your issue is a bug it will get the attention of the product team. If not, there is also the possibility your question gets answered and problem solved.