Well, Another gotcha. To summarize the problem I was facing, there is a COM component, with its well defined interfaces, integrated into a (C#) .NET project. There is a new version of the component, with few more APIs, and I had to integrate and test the new component. The source code for the COM component was available, and I can't change it as its used by multiple other projects.
For integration purpose, using the type library file (tlb), I created the interop library file using Type library import and when I imported this into the .NET project by Adding a Reference, and perform compilation, failures were reported by the compiler for one of the existing API's. There was a library file created for the earlier version of the dll, and with that the compilation went through, which was puzzling to me, as there was no change in the existing API's. I used ildasm to examine the API's of both the interop libraries. When I compared both of them, there was a difference in parameter between the two for a specific API, and the parameter passed to the API, in the later version seemed weird, but I was left wondering how can there be difference. [ Btw, The parameter troubling me was a double pointer to a BSTR ]
MSDN to the rescue. That's when I landed on this page, which stated that though the import process usually produces accurate interop assemblies, occassionally there is a need to modify the interop. I edited the interop assembly which was the right thing to do, for me. This page briefly states the procedure to do so, by first creating the MSIL file, editing it and creating the new dll.
I lost a couple of hours, for not being aware of it, hence this post, which hopefully helps someone save some time.
For integration purpose, using the type library file (tlb), I created the interop library file using Type library import and when I imported this into the .NET project by Adding a Reference, and perform compilation, failures were reported by the compiler for one of the existing API's. There was a library file created for the earlier version of the dll, and with that the compilation went through, which was puzzling to me, as there was no change in the existing API's. I used ildasm to examine the API's of both the interop libraries. When I compared both of them, there was a difference in parameter between the two for a specific API, and the parameter passed to the API, in the later version seemed weird, but I was left wondering how can there be difference. [ Btw, The parameter troubling me was a double pointer to a BSTR ]
MSDN to the rescue. That's when I landed on this page, which stated that though the import process usually produces accurate interop assemblies, occassionally there is a need to modify the interop. I edited the interop assembly which was the right thing to do, for me. This page briefly states the procedure to do so, by first creating the MSIL file, editing it and creating the new dll.
I lost a couple of hours, for not being aware of it, hence this post, which hopefully helps someone save some time.