COM object "DisconnectedContext" failure when closing WPF application (including demo)


I’m using the C# SDK wrapper in a WPF application. When I close the application (when debugging) Visual Studio breaks in with the following error message:

Managed Debugging Assistant ‘DisconnectedContext’ : ‘Transition into COM context 0xbe6950 for this RuntimeCallableWrapper failed with the following error: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)). This is typically because the COM context 0xbe6950 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else. Releasing the interfaces from the current COM context (COM context 0xbe6a08). This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.’

Which version?

SDK version v5.2.41727.0928

Visual Studio 2019 version 16.8.1

To Reproduce
Steps to reproduce the behavior:

  1. Open the C# demo application that comes with the SDK
  2. Set the SDK DLL path in App.xaml.cs
  3. Change MainWindow.button_auth_Click to use AuthParam with a hard-coded SDK key/secret instead of AuthContext (more on that below)
  4. Run the app
  5. Hit “Auth” (the textbox content doesn’t matter at this point)
  6. The “Start Meeting” dialog comes up
  7. Close the dialog
  8. The debugger breaks with the error message in the description

Additional context

I’ve observed the same behavior in my rather larger WPF app that’s been working fine with SDK version v4.6.21666.0428. (I only started seeing this problem when I upgraded the SDK.) I used the demo app to make sure it wasn’t anything I’ve done wrong in the code.

I did try to use the AuthContext with a JWT, but the result of SDKAuth (which the demo app doesn’t check) is 0xf, which isn’t even a member of the SDKError enum, so it’s hard to know what on earth is going wrong there. The rest of the app works fine when using AuthParam - I can investigate moving to JWT separately, once I’ve worked out what’s causing this issue.

Aha - I’ve just tried v5.2.42037.1112 and it looks like it might be fixed now. (It’s not mentioned in the changelog, but a first attempt didn’t cause the error.)

Hey @jonskeet,

Thanks for using the dev forum!

I am sorry you were experiencing this, but that is good to hear that updating seemed to resolve the issue. Please let us know if you see this issue again.