I am trying to figure why this error is happening and determine if it is possible to prevent it.
So, this is all in VS2008 running on Windows XP Pro SP3. I am writing plugin toolbar DLLs for a mapping application called FalconView 4.1.1.6. FalconView (fvw.exe) is an activex application. The toolbars generally work fine except for an occasional pain in the neck error (the error message I am getting is at the end of this question since it is pretty long).
I can sometimes force this error message by installing a release version of our software on a test laptop, replacing the release DLL with the debug DLL (for test purposes), uninstalling the toolbar, and then installing the next version of the toolbar. Boom, there is the error. The error also happens when writing and debugging as well but less predictably. I can fix this on my development machine by removing references to fvw from the project, exiting vs2008, un-registering all copies of Interop.fvw.dll (generated from a tlb file provided by FalconView), running “fvw /regserver”, reloading the project, and adding Interop.fvw.dll back into the project. What a pain! What is happening here? Is there a way to prevent this?
Thanks!
The error in question:
System.InvalidCastException: Unable to cast COM object of type ‘fvw.MapClass’ to interface type ‘fvw.IMap’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{E353BC6C-E8AB-11D3-80B9-00C04F60B086}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at fvw.MapClass.GetElevation(Double lat, Double lon, Int32& elevation)
at Toolbar.rpuav_com.SendElevationData(Hub Station)
Note that {E353BC6C-E8AB-11D3-80B9-00C04F60B086} is in the registry when I look for it.
Uggg… I was really hoping that I wouldn’t end up answering my own question. It feels so wrong somehow.
Anyhow, the problem was with the Interop.fvw.dll file being used. We are supposed to use the one provided with FalconView (built with the also-provided fvw.tlb). Our project references that dll and Visual Studio copies it to our release folder when building the Release version of our plugin and to the Program Files folder when we are debugging. Somehow, and I don’t understand this, a new Interop.fvw.dll gets generated (possibly an intern, other employee, or just magic??) and the bloody thing gets “stuck” in the problem projects.
How can I tell a new interop dll is re-generated? The public key token is all zeros while the one from the FalconView makers has an actual number. Now if only they would sign their assembly as well.
The fix for me is:
Thanks everyone for the effort at helping! Very much appreciated!