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

**URL:** <https://devforum.zoom.us/t/com-object-disconnectedcontext-failure-when-closing-wpf-application-including-demo/36549>\
**Category:** Windows\
**Created:** [November 20, 2020, 1:11pm UTC](https://devforum.zoom.us/t/com-object-disconnectedcontext-failure-when-closing-wpf-application-including-demo/36549 "2020-11-20T13:11:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonskeet](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonskeet/32/8028_2.png) [@jonskeet](https://devforum.zoom.us/u/jonskeet)\
**Post date:** [November 20, 2020, 1:11pm UTC](https://devforum.zoom.us/t/com-object-disconnectedcontext-failure-when-closing-wpf-application-including-demo/36549/1 "2020-11-20T13:11:52Z")

</div>

**Description**

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.

---

<div class="post-metadata">

**Author:** ![jonskeet](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonskeet/32/8028_2.png) [@jonskeet](https://devforum.zoom.us/u/jonskeet)\
**Post date:** [November 20, 2020, 2:10pm UTC](https://devforum.zoom.us/t/com-object-disconnectedcontext-failure-when-closing-wpf-application-including-demo/36549/2 "2020-11-20T14:10:05Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [December 3, 2020, 4:17pm UTC](https://devforum.zoom.us/t/com-object-disconnectedcontext-failure-when-closing-wpf-application-including-demo/36549/3 "2020-12-03T16:17:37Z")

</div>

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.

Thanks!  
Michael
