@Greedo yes, that'd be the way to do it - you may want to cache the information how to find the ITypeInfo/ITypeLib, so that you can refresh the cached information easily while storing the harvested information within the class rather than persisting the pointer to the ITypeInfo/ITypeLib.
@MathieuGuindon #ItDepends. Normally, .NET will never unload a type that's been loaded. Moq works around this problem by using dynamic proxy provided by Castle Windsor. However, Moq doesn't expose a method for invalidating the assembly
The 2nd issue is that the caching of the representing type for the purpose of mocking cause problems when running unit tests due to how types are cached in .NET. That's a .NET only problem and not applicable.
@Greedo There are two different issues. First issue is that a reference to a ITypeInfo coming from VBA project cannot be assumed to live beyond any design changes; you'll have to invalidate all the pointers to any ITypeLib/ITypeInfo whenever making design changes or experience the joy of crashing.
@Greedo Yes, AIUI, it gives us the ability to inspect a project as if it was an external type library. We don't have the same visibility as we do with source code (only public symbols are available) but for the purpose of inspecting references to the protected projects, it would help give more complete information for the references to public symbols from the protected project.
@MathieuGuindon you speak as if they are not the same thing. :-p I think I sort of gotcha now - it's more that each will have their respective clients that will capture the events.
@MathieuGuindon I'm referring more to tracking the internal operations executed by the LSP server that the client may not be aware of? That is, if we are debugging and need a trace to flow through all the components?
@MathieuGuindon Yes, that's certainly one way to do it. If we do go down that road, tB can start out as a simple shim, handing out the COM interface to the VBEditor and we can slowly transfer the responibility down to only the managed COM objects.
if you look, I also defined the same COM interfaces twice, in tB and again in .NET. They aren't sharing the same definition, proving that tB can use "private" COM interfaces as long it has the correct definitions.
anyway back in that project, there's no COM exposure because I don't have to go through that COM activation since I've already bootstrapped the .NET Core so I got a delegate that returns a COM interface.
instead of having a mscoree.dll that does the work of setup and returning a COM representation, they now generate a .comhost.dll which has all the code generated to handle all that. In effect, it's now just a normal DLL
so no matter what process you're using, you are always going through the mscoree.dll to do the initial setup and it handles the location of the .NET FX assembly, loading it and returning the COM representation from that.