HRESULT exception: 0x80004002 (E_NOINTERFACE)

I am responsible for maintaining the C # application (VS 2005). These C # applications call dll ("mydll.dll"). I needed to make a few changes to the corresponding DLL.

I have a mydll.vbp file written in Visual Basic 6.0. I made changes to Visual Studio, and then "made" mydll "" from the Visual Basic interface.

The problem is that now, every time I try to instantiate a class from "mydll.dll" in debbuger mode in C #, I have the following "InvalidCastException"

Cannot pass a COM object of type mydll.ClassFrommydll to the interface type mydll._ClassFrommydll '. This operation failed because the call to QueryInterface on the COM component for the interface with IID '{384FB79F-B636-4655-9441-8222692AB8AE}' failed due to the following error: this interface is not supported (exception from HRESULT: 0x80004002 (E_NOINTERFACE )),

I tried re-referencing the dll in question ... but that doesn't change anything.

Any idea on where this might come from?

Many thanks to all the yop who can help. Over the past few years, this problem has arisen. Start feeling pressure ...

+5
source share
3 answers

mark the main class [STAThread] and your problem will be solved.

+2
source

GUID "ComVisible" , [assembly: ComVisible (true)] AssemblyInfo "true".

0

I ran into this problem using IBM Dll.

[STAThread]
static void Main(string[] args)
{
}

Fixed an issue where all COM interfaces worked and the exception was cleared

0
source

All Articles