I've got a WPF webcam component's source-code from Codeplex that I'm trying to port from .NET 3.5 to .NET 4.0.
Compiles just fine under both targets, but in the .NET 4.0 version, it crashes when running the app with a System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception
at the line moniker.BindToObject(bindCtx, null, ref filterId, out filterObject);
in this method:
internal static IBaseFilter CreateFilter(string filterMoniker)
{
object filterObject = null;
IBindCtx bindCtx = null;
IMoniker moniker = null;
int n = 0;
if (CreateBindCtx(0, out bindCtx) == 0)
{
if (MkParseDisplayName(bindCtx, filterMoniker, ref n, out moniker) == 0)
{
Guid filterId = typeof(IBaseFilter).GUID;
try
{
moniker.BindToObject(bindCtx, null, ref filterId, out filterObject);
}
catch (Exception ex)
{
MessageBox.Show(ex+"");
}
Marshal.ReleaseComObject(moniker);
}
Marshal.ReleaseComObject(bindCtx);
}
return filterObject as IBaseFilter;
}
Any idea why and how to fix it?
The camera is a Genius Eye 110, and I'm working under Windows XP SP2.