This may be a very stupid question.
Is it possible to debug a COM dll in VS2008 for which I do not have the source code?
The reason I want to do this is I am passing an Array to a COM method and I expect this Array to be populated by the method.
However the Array is not being populated. So I want to step into the COM method to see whats happening. is this possible?
Below is an example of the code I am using:
Array binaryArray = Array.CreateInstance(typeof(sbyte), 896);
bool success = photo.GetBinaryData(binaryArray);
IDL for the GetBinaryData
method:
[id(0x000000c9)]
HRESULT GetBinaryData(
[in] SAFEARRAY(char) buffer,
[out, retval] VARIANT_BOOL* retval);
The GetBinaryData
method is the COM method which I would like to step into.
EDIT: Adding a Delphi test script which works
procedure TComTestForm.TestUserBtnClick(Sender: TObject);
var
nCnt :integer;
User :IUser;
Persona :IUserPersona;
ArrayBounds :TSafeArrayBound;
ArrayData :Pointer;
TagList :PSafeArray;
nSize :integer;
begin
User := Session.GetUser;
ArrayBounds.lLbound := 0;
ArrayBounds.cElements := 0;
TagList := SafeArrayCreate( varInteger, 1, ArrayBounds );
User.GetTags( TagList );
if SafeArrayAccessData( TagList, ArrayData ) = S_OK then
begin
nSize := TagList.rgsabound[0].cElements;
OutLine( '----Available Tags, ' + IntToStr(nSize) + ' tags' );
for nCnt := 0 to nSize - 1 do
begin
OutLine( IntToStr( IntegerArray(ArrayData)[nCnt] ) );
end;
OutLine( '----');
SafeArrayUnAccessData( TagList ); SafeArrayDestroy( TagList ); end;
end;
[in]SAFEARRAY(char)
(specifically the [in] bit) I don't think this can work to populate an array allocated by the client, without breaking the semantics of SAFEARRAY. If I'm right, the Delphi code works by accident. I very much doubt you can persuade .NET COM Interop to do the same.