Open bzuillsmith opened 7 years ago
I though that .Net classes just have to be decorated with [STAThread] and [MTAThread] attributes and then COM interop automagically bakes the marshaling support in the executable. Not sure you have to do anything more explicit in the assembly manifest that mt.exe
generates (which UMMM shells at build time).
On the client side (main VB6 exe) you just "reference" the .Net assembly with dependency
tags so there seems to be nothing more to customize here too.
Actually the STA/MTA thread attributes only work on a .net application's Main function. In this case there is no main function because the application begins in VB6. .Net should have a way to invoke methods on the main thread using the dispatcher but I am hitting a little trouble with it and am testing using proxy stubs to see if that helps marshal to the correct thread. I know it has helped resolve errors for me before, but I had to manually add them to the manifest after running mt.exe
. Here is a SO thread with more info
@bzuillsmith This is an old SO thread I don't remember taking part in but it says so (at least @wqw
is my SO username there)
I'm not super knowledgeable on VB6 interop stuff, but my understanding is that if I make a .NET dll and want to expose it to COM in a way that marshals to the main thread automatically, I need some proxy stub elements in my .NET assembly's manifest, correct? It doesn't seem like mt.exe supports this? Is there an alternative to make this happen automatically using UMMM? Or do I have to write a separate script that inserts any needed proxy stubs?
I tried the Interface option but it puts the proxy stub in the .exe's manifest (a VB6 exe) instead of the .NET assembly's exe. I don't think that's right, but maybe I'm wrong...