.NET has no way to call methods on COM objects that take "ref" parameters via late binding - by GiddyUpHorsey

Status : 

 


6
0
Sign in
to vote
ID 714578 Comments
Status Active Workarounds
Type Bug Repros 1
Opened 12/18/2011 8:47:41 PM
Access Restriction Public
Moderator Decision Sent to Engineering Team for consideration

Description

I've been trying to figure out how to call the following method on a VB6 COM object from .NET and I'm convinced that it is not possible and that it is either a design flaw of COM interop in the .NET Framework or more likely, a bug.

Public Function CreateMiscRepayment(ByRef objMiscRepayment As MiscRepayment) As Variant
   ' Code that sets objMiscRepayment here
End Function

I've documented the problem and my different attempts to get it working on StackOverflow - http://stackoverflow.com/questions/8529313/how-do-i-call-a-vb6-com-object-from-c-sharp-with-dynamic-when-it-has-a-ref-param.

I understand that it might be possible to call this method with early binding and an interop assembly, but I haven't tried. I think that this *should* be able to work via latebinding/IDispatch.

I'm especially disappointed that this doesn't work since .NET 4.0 was supposed to have much better COM interop support than previous version i.e. dynamic keyword.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:24 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Camuvingian on 3/7/2014 at 8:19 AM
I have tried all version of .NET I have on my machine .NET2.0-.NET4.5.1 this has NOT been fixed. Can you tell us a proper workaround for this please?
Posted by GiddyUpHorsey on 4/29/2013 at 2:35 PM
Hi

Can you provide a little more info? i.e. in which version of .NET has the fix been applied?

Cheers
John
Posted by Microsoft on 4/12/2013 at 4:01 PM
Hi. Thanks for this bug, we fixed it.

bill
Posted by MS-Moderator10 [Feedback Moderator] on 12/20/2011 at 12:50 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 12/18/2011 at 9:42 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)