Operation aborted (Exception from HRESULT: 0x80004004)

Hong 1,221 Reputation points
2023-01-19T04:46:36.76+00:00

myMediaPlayerElement.MediaPlayer.IsMuted = true;

The above code occasionally throws the following exception:

System.Exception: Operation aborted (Exception from HRESULT: 0x80004004)
 Stack Trace:
   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
   at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, SByte) + 0xc0
   at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Boolean, Int32) + 0x37

I want to emphasize it happens only occasionally. The code works most of the time.

I wonder if anyone could shed some light on this regarding possible causes.

Universal Windows Platform (UWP)
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.