At my work, we have «deeply connected » COM libraries written in the
good old days of VB6. Those components can be indifferently called from other components, ASP pages or VBScripts.
We want to progressively migrate those components in C# using COM interoperability. After doing some tests, I came upon some “weird” interop behaviors...
I’ve managed to make some rather simple examples of my problems; here it goes…
For our migration scenario, let’s take 4 classes in 4 distinct VB6 libraries each containing a single class.
Here’s the dependency graph of the libraries:
Now the call graph of two very simple tests: In the first test, an ASP/VBScript instantiates a
DataClass then passes it on to the method ClassB::RunBC , which in turns instantiates and calls a
ClassC::CalledByB passing the reference to the DataClass along. The 2nd test is modeled after the first one:
ClassC::RunCD calls ClassD::CalledByC still passing a reference to third party object
In other words, the ClassC can be called from either VB6 or ASP/VBScript.
After compilation of all the projects, here’s the output of the test script:
Now let’s try to migrate LibraryC in C#...
Before starting to write anything in C#, we first need to generate interop assemblies for both LibraryA and LibraryD (which
View Complete Post