No such interface supported (0x80004002) in .NET Core


I'm trying to port DirectShowLib for .NET Standard. I have no problem while casting Xml2Dex to IXml2Dex interface in .NET Framework 4.6.2. However, I've got InvalidCastException in .NET Core 3.1.

COM Import

[ComImport, SuppressUnmanagedCodeSecurity,
public interface IXml2Dex
    // Interface implementation..

[ComImport, Guid("18C628EE-962A-11D2-8D08-00A0C9441E20")]
public class Xml2Dex


// works on .NET Framework 4.6.2, failed on .NET Core 3.1
object xml2Dex = (IXml2Dex) new Xml2Dex();
Assert.IsTrue(xml2Dex is IXml2Dex);


Unable to cast COM object of type 'DirectShowLib.DES.Xml2Dex' to interface type 'DirectShowLib.DES.IXml2Dex'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{18C628ED-962A-11D2-8D08-00A0C9441E20}' failed due to the following error: No such interface supported (0x80004002 (E_NOINTERFACE)).

Running the test in STAThread mode does fix the issue. But why it works on .NET Framework without using single-threaded mode? Did I do something wrong?

asked on Stack Overflow Sep 22, 2020 by Luthfi

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0