Thursday, January 04, 2007

Debugging Internet Explorer hosted Windows Forms Controls

Our product for historical reasons has some .NET v1.1 Windows Forms user controls embedded in ASP.NET pages.

Running these pages on a machine that has .NET v2.0 installed causes things to not work. Basically the unmanaged host iexplore.exe has to pick a version of the CLR to load when it is about to load the controls and it will pick the latest and greatest v2.0 in our case. This of course, is not what we want. It is possible to constrain the options by having an iexplore.exe.config that specifies the versions it is allowed to choose from. In our case, the config file looks like this:

<configuration>
<startup>
<supportedRuntime version="v1.1.4322"/>
</startup>
</configuration>

A useful tip in debugging Windows Forms controls embedded in this way is to activate IEHost logging