I have the following code:
public void Test(IMyInterface iInterface)
{
iInterface.CallMethod ( );
}
Which works fine. However, if I change the code to be threaded:
private IMyInterface myInterface;
public void Test(IMyInterface iInterface)
{
myInterface = iInterface;
new Thread ( new ThreadStart ( CallInterfaceMethod) ).Start ( );
}
public void CallInterfaceMethod ( )
{
myInterface.CallMethod ( )
}
When i use the thread I receive the exception:
Unable to cast COM object of type 'System.__ComObject' to interface type 'IMyInterface'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{GUID}' failed due to the follow error: No such interface supported
But the interface should be supported just fine? Anyone have any thoughts on what is going on here?