.NET C# getting access violation when playing video with WMP


I am making a program on Visual Studio using C#. This program plays a video when the user presses a button. I use the Windows Media Player library to play the video and all worked fine, until I tried it on a laptop with dual graphics adapters. These are Intel HD Graphics 4600 and R9 M256X. On the laptop, any attempt to play the video leads to the program crashing immediately, with Visual Studio reporting an access violation (error 0xC0000005) in the console. I tried putting the code that plays the video in a try-catch block, but nothing was not caught.

Through testing, I noticed that the crash happens if in Radeon settings under the tab "Switchable graphics" I set my program to either Not assigned (default) or High performance but all works well if I set it to Power saving.

Ideally, I need a way to stop this from happening altogether, but a way to test if it is going to crash beforehand will suffice.

Some things of note:

  • I tried creating a blank solution with just a video player and it still crashed, so the rest of the program isn't the issue.
  • I tried playing two different videos and it still failed.
  • It happens in both Debug and Release configurations.
  • The program also has an unhandled exceptions handler but it can't catch the error either.
asked on Stack Overflow Nov 29, 2018 by Steyiak

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0