STA Activex Controls and AppDomains?
-
Hi folks, I currently have to interop to an old ActiveX control that requires the STA threading model. In order to get the control to work, I have to use STAThreadAttribute on the Main method of my desktop application, and set my ASP.NET application to be ASP compatible. This has impact on the threading of the rest of the application which is undesirable (especially on the ASP.NET application). Is there any way to load the ActiveX into a separate STA threaded AppDomain, and keep the main AppDomain MTA? I haven't been able to find any examples or explanations for this. We need to have considerable interaction with the ActiveX control throughout the rest of our code, and I don't know the impact of cross-AppDomain calls on performance, but I can't test until I find out how to separate the AppDomains. Any interop/threading guru's out there? PS. We can't rewrite the Activex control as it is third party (and has been discontinued). It contains complex mathematical parsing that we need to maintain for backward compatability. Dr Herbie Remember, half the people out there have below average IQs.