I am having problems running a 32-bit .NET application on Windows 7 x64 that seems to center around a 3rd party COM library. Here's the setup:
Our application was written for 32-bit Windows XP, but we tried to set things up so that it would run properly on 64-bit Windows. It relies on P/Invoke and COM Interop with several 32-bit 3rd party libraries. Obtaining 64-bit versions of these libraries is not possible.
The library in question is a COM wrapper that is provided by the vendor to their C-based framework library (not supported past Windows XP). This interface is far easier to work with from .NET. However, on 64-bit Windows 7, the COM library seems to malfunction during its initialization. The framework has a function named Init() which returns with success, but it does not behave "properly" afterward.
The framework is supposed to look up configuration information in the registry during initialization (names of custom DLLs that we created and other metadata). Using Sysinternals Process Monitor I can see it querying in the 32-bit compatibility section of the registry, but it does not seem to use what it finds.
I am able to reproduce this behavior by interacting with the COM interface from PowerShell (x86) so I do not think I have a setting wrong in Visual Studio.
Here's the kicker though. If I run our application on the x64 platform from Visual Studio with the Hosting Process enabled, it works every time. If I disable the hosting process, or run from outside Visual Studio, it fails every time.
Any ideas what it is about the hosted environment that allows this COM interaction to succeed?
UPDATE: The application is definitely running in 32-bit mode. Visual Studio is configured to build it for x86 and I can see the *32 after its name in Task Manager. Process Monitor also shows the WOW64 DLLs being utilized.