hudec117 / Mpv.NET-lib-

.NET embeddable video/media player based on mpv for WinForms and WPF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when exiting WPF app with more than 1 instance running

mysteryx93 opened this issue · comments

When existing a WPF application with more than 1 instance of MPV running, I get this error

Managed Debugging Assistant 'DisconnectedContext' : 'Transition into COM context 0x909e50 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 0x909e50 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else and cannot process the context transition. No proxy will be used to service the request on the COM component and calls will be made to the COM component directly. 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.'

Hello @mysteryx93

I have been able to re-produce the first error you mentioned. The exception your are seeing is raised by the Managed Debugging Assistant (MDA) which is used to find errors when transitioning between managed/unmanaged code. I found that closing an app with 2 instances of mpv without debugging did not raise this exception. I will however look into this further.

Could you please raise your second problem as a separate issue.

moved it into a separate issue

any progress on this? i think i'm encountering same problem when running 2 videos at same time

Hi @OneB1t,

I'll take a look over the holidays. : )

In the meantime, could you please confirm if you're seeing this exception when you launch without debugging?

When using more than 1 instance, there are other bugs, but these seem to come from the MPV library itself. The bug has been reproduced but nobody has looked into it yet.

If you load 20 instances, 10 load immediately, then only 1 per second. That's the first bug.

Second bug is that if you close the window before all 20 instances are loaded, it freezes. However, this only happens if we call Dispose during the event Dispatcher.ShutdownStarted (since Unloaded event isn't triggered during app shutdown)

mpv-player/mpv#6705

@mysteryx93 could you please try downloading the latest 1.2.0 version and try again? May have been fixed by #28