views:

140

answers:

1

I have a java library that I am accessing in VB.NET via COM. The objects on the java side expose non-trivial .toString methods that I need for debugging. Unfortunately, when I call .toString on the COM objects, the call is being intercepted by the Object class' .ToString function.

How do I force the call to the COM-side .toString and prevent Object.ToString from firing?

+1  A: 

Do you have access to the IDL for the java object? Are you generating the runtime callable wrapper for the COM object?

I think you should change the interop assembly or manually generate the wrapper to change the toString() method to toStringJava() or to_String() or something else that doesn't clash with the syntax for object.ToString(). Here's a starting point on MSDN for customizing runtime callable wrappers.

Hamish Smith
I think you may have lead me down the right path on this. There is no IDL for the object and I don't have access to the source code. I suspect that in order to do this, I would have to create the IDL/RCW manually and then alias it.http://msdn.microsoft.com/en-us/library/x8fbsf00.aspx
Dan Coates
That's all I was trying to do. Glad it helped.
Hamish Smith