Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about proxy stubs #14

Open
bzuillsmith opened this issue Apr 6, 2017 · 3 comments
Open

Question about proxy stubs #14

bzuillsmith opened this issue Apr 6, 2017 · 3 comments

Comments

@bzuillsmith
Copy link

bzuillsmith commented Apr 6, 2017

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...

@wqweto
Copy link
Owner

wqweto commented Apr 7, 2017

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.

@bzuillsmith
Copy link
Author

bzuillsmith commented Apr 7, 2017

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

@wqweto
Copy link
Owner

wqweto commented Apr 8, 2017

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants