I have to include a .NET application into another .NET application as a plugin. The plugin interface requires me to inherit from a template form. The form is then attached in a MDI when the plugin is loaded.
Everything is working so far, but whenever I register for drag and drop events, set the autocomplete mode for a combobox or at various other situations I get the following exception:
...the current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it...
The main application is running in MTA and developed by another company, so there is nothing I can do about it.
I tried to do the things that cause these exceptions in STA threads, but that didn't solve the problem either.
Has anyone been in the same situation? Is there anything I can do to solve the problem?