App exits without error when calling method from Media Foundation Interface COM in C#

1

I've been on a quest for a while now to pass the PCM of an MP3 from W8.1/WP8.1 to Unity3D and I believe I'm getting close. I was referred to this project which works absolutely fine but, of course, it's in VB.NET so it can't be used with Unity. VB and C# are fairly similar so I set out to translate it. You can see my translation at this pastebin.

The problem occurs on line 97. The app simply exits with absolutely no indication of what went wrong. Calling any non-inherited function on the interfaces IMFSample and IMFMediaType has the same effect.

A friend suggested getting the HRESULTs from these functions to see if anything shows up. Google shows getting HRESULTs from COM interops in C# is.. hard. I experimented by changing IMFSample.GetSampleFlags to

int GetSampleFlags(out int pRetVal);

And that returned "The requested attribute was not found. (Exception from HRESULT: 0xC00D36E6)" and I'm not really sure what to do with that information...

So, I humbly ask you all... just... just what? What do I do from here?

--- SOLUTION ---

So as it turns out the solution was a little dumber than I expected.

I did not know this, but apparently COM interfaces that inherit from other COM interfaces have to include ALL of the methods from the parent COMs. Otherwise windows, it seems, throws a hissy fit.

That was it... it was my own laziness in the first place that killed me.

c#
vb.net
com-interop
hresult
win-universal-app
asked on Stack Overflow Jan 2, 2015 by user3305700 • edited Jan 3, 2015 by user3305700

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0