RE: Preventing aggregation in a .NET class

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Robert Simpson (RobertSimpson_at_discussions.microsoft.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 10:25:01 -0700

AH HA! I finally got it!

The trick was to use an interface with a property (as you had suggested) but
instead of returning the object or late-binding invoke to get the object, the
trick is to wrap the object in an ObjectHandle() class and unwrap it on the
receiving side.

Alternatively, I was able to return any MarshalByRef object that then in
turn exposed a property which returned the actual object I was trying to get
in the first place.

"Robert Simpson" wrote:

> Is there any way to mark a .NET interop class as non-aggregatable? My .NET
> classes are being instantiated as aggegatable objects by 3rd party COM
> objects, and when they're passed around to my other .NET objects they're
> being passed as __ComObject because the Marshaler can't figure out what to do
> with them. When they're instantiated without an outer unknown, they work
> fine. (using VS.NET 2003/2005)
>
> Help!
>



Relevant Pages

  • Re: OT: How to block/ filter undesirables?
    ... That's a neat trick, when the OP is using Google groups with a THML ... interface. ...
    (rec.crafts.metalworking)
  • Re: Prolog module system
    ... exports, put the exports in another file and use:- include/1 to share ... This trick probably doesn't work in most current Prolog ... You do get a bit of checking in the form of a warning, when the interface ... module system construct for it. ...
    (comp.lang.prolog)
  • Re: Arrrrghhhhhhh (unit testing comments)
    ... There aren't any OTAPI hooks for the unit testing wizards. ... The "trick" ... that code that assumes class vs. interface. ...
    (borland.public.delphi.non-technical)
  • Re: Port Mirroring in Linux
    ... interfaces and then just dump them out the desired interface sounds ... like it would do the trick. ... If the mirror interface is also being ... support for designating a mirror interface. ...
    (comp.os.linux.networking)