Managed directX app refuses to run

isilrion

Newcomer
Joined
Aug 30, 2003
Messages
20
Hi. I've been having a problem...
I made a little C# program with directX (a media player, using the DirectX 9 AudioVideoPlayback). The problem is, it runs perfectly on my computer, a friend told me it ran on his, but yesterday night the one who asked for the program brought me his computer because it refused to run on it.

It has DirectX 9 installed, and the .NET framework. I copied some of the DX SDK samples to his PC, and the managed ones also refused to run (the non-managed, all ok)
I got to the Direct9 setup, and tried to install the .cab that contains the managed DX (Is it necesary to do it manually?), and that got the managed samples to run, but my app (wich is essentially like one of the samples) still refused to.

The best thing I managed to figure out is that it is throwing me an "InvalidCastException" (that is the java name of the exception, forgot c# name, but I'm referring to the exception with the same meaning).

The line that causes the exception goes like this:

Code:
VideoInfo vi = new VideoInfo(filename)

filename being a string,
and the VideoInfo constructor says

Code:
public VideoInfo (string filename) 
{
    MessageBox.Show("Debug: construyendo VideoInfo con "+filename);
    Video v = new Video(filename);
    this.Duration = v.Duration;
    /// get some other data about the video.
}

As you can see, there is no cast there whatsoever.

What boggles me more is that it throws the exception BEFORE showing the messagebox (thus, I never get to see the messagebox).

And, I can call static methods of the VideoInfo class (that doesn't contain any reference to the video class).

I also tried making a setup proyect to install the app, it created the AudioVideoPlayback dll (don't remember the full name), I copied it into the executable directory, and it still refused to work (At the other computer where the app worked, it refused to work without that dll, and began working as soon as I copied it)

And, as a final step to my experiments, I commented out every line referring to the 'Video' class. Surprise. The messagebox appeared (though obviously my app didn't do what it was suposed to do)

My question is, what could be happening? I'm about to format his hard disk and reinstall windows, framework and directx from scratch, but that makes no sense.

Also, why does my app requires the AudioVideoPlayback dll in the same directory, and the samples in the SDK that use the AudioVideoPlayback namespace don't?
 
Problem... solved?

The problem was... solved?

I tried to run it in yet another PC, and I kept getting the exception.
I accidentally installed ACDSee 4.0 on that computer, and the problem disappeared. I had ACDSee 5.0 on my computer and on the other computer where it worked. So I installed ACDSee on the target computer and wow. It works.

Of course... I can't see the relation between ACDSee and a Divx video file and .net and DirectX.

I am closing my own thread (answering my own question) just in case that someone else finds this thread, he can also have the answer (though if anyone can explain to me the relation, please do!)

Thanks
Isilrion
 
I couldn't say what's causing that, however I do have a possible idea about the cast exception. I do not remember the c# method of doing this, but I know that it is the same as in Java.

In Java if you don't call either this() or super() as the first line of a constructor it will automatically insert super() as the first line (and in most cases call the default object constructor).

It makes no sense why that would be a problem, but that is what it appears to be doing. It returns an Object and then tries to cast it to type VideoInfo, and for some reason that could be a problem.

Doubt that is useful for this program since I cannot think of any reason for this behavior, however just for your general information :)
 
Back
Top