Is it possible to use multi-threading in a .NET COM callable wrapper DLL assembly?
For example, I have a .NET assembly dll that exposes a .NET FTP library to COM. Upload functions are currently programmed as “best effort” functions. I’m not using events or return values to show whether an upload or download completed successfully, which is something I may consider implementing later if necessary. Could the .NET assembly (in my really limited understanding) simply farm out these upload and download processes to another thread? Assuming this is possible, what would be the result of this if the hosting application was closed before the uploads or downloads were all completed?
Yes, MSDN article Managed and Unmanaged Threading explains the details. In particular:
Good question. How are you terminating the application? If it is simply a GUI application that you are closing, I think the underlying process would continue to execute as long as those threads are active. I recommend you create a test project to confirm your application’s behavior.