-1

I am in the process of writing a basic video player program. I found this tutorial online, which is exactly the kind of help I was looking for -- except, the tutorial was written for .net 2.0.

This means, for instance, when I originally tried to run the finished program, I got a runtime error identical to this question. I fixed that as per the accepted answer, but now I get a new bug:

DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

Is there a way to update this tutorial code into something that works with .net 4.0? Or am I better off just finding a new tutorial that's more up-to-date?

Community
  • 1
  • 1
Raven Dreamer
  • 6,940
  • 13
  • 64
  • 101

2 Answers2

1

The obsolete managed DirectX wrappers do indeed generate this warning. It is a false warning, the CLR is already loaded. Debug + Exceptions, expand the Managed Debugging Assistants node and untick LoaderLock.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Is there a better way to do this, using non-obsolete wrappers? – Raven Dreamer Sep 17 '11 at 21:32
  • Erm, sure, you can add a COM reference to Windows Media Player to your toolbox and drop it on a form. It plays back videos pretty well and takes but a handful of minutes to get going. DirectShow.NET works well too, provided you have the right DS filters installed. But it sounded like you were trying to do this the non-boring way. – Hans Passant Sep 17 '11 at 21:57
0

I suggest to use AForge.NET which wraps FFMPEG library so you can work with many kind of video files in C#. Don't use DirecX, use http://www.aforgenet.com/framework/downloads.html Building with this framework video player is simple and you don't waste time.

Marek Bar
  • 873
  • 3
  • 16
  • 31