When suspending: WinRT information: The object invoked has disconnected from its clients. RRS feed

  • Question

  • I have an app where some page contains a SwapChainPanel. The code is similar to the XAML SwapChainPanel DirectX interop sample (http://code.msdn.microsoft.com/windowsapps/XAML-SwapChainPanel-00cb688b). However when I navigate back and forth from the main page to this page containing the SwapChainPanel, and then do a 'Suspend & Resume', I get an 'WinRT information: The object invoked has disconnected from its clients.' error. The error info is minimal, but I assume this is caused the fact that in the DirectXPanelBase constructor (see sample) I am subscribing to the Application.Current.Suspending event creating a weak reference to the instance of DirectXPanelBase. When suspending the app, the eventhandler might still have a reference to an already destroyed instance of the DirectXPanelBase because of the back and forth navigation.

    In order to avoid the exception I introduced a desctructor on DirectXPanelBase which unsubscribes to the Suspending event. This works, however if I quickly navigate back and forth between the main page and the page containing DirectXPanelBase, the unsubscribe action occasionally throws an exception. I fixed this by doing the unsubscribe in a Try/Catch.

    This patching does not look solid to me, so does anyone have the same problems and how did you prevent the exceptions? Is the 'The object invoked has disconnected from its clients' exception problematic when deployed on a users machine (in other words does it crash), or is it just Visual Studio breaking into the process?

    Thanks Ronald

    Monday, August 11, 2014 11:43 AM


All replies

  • I'll ask our DirectX expert to check this out.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, August 11, 2014 7:40 PM
  • Hello,

    I don't think this is a DirectX issue. But... Have you tried forcing the page to cache? Try adding "Page.NavigationCacheMode = Required".

    Page.NavigationCacheMode property


    I hope this helps,


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Tuesday, August 12, 2014 6:03 PM
  • Chaching the page is not an option. Subscribing in the DirectXPanelBase instance to the Application.Current.Suspending event is creating a weak reference to the instance of DirectXPanelBase. The scenario described above might create the situation that an instance of DirectXPanelBase is already destroyed. Doing the scenario when Visual Studio is not debugging, does not create a crash. So it is not a problem, just an annoyance that Visual Studio breaks into the process.


    Friday, August 29, 2014 4:48 PM