Is it possible to implement custom features in .NET?

If so, how?

I suspect the issue is being able to do COM aggregation with .NET, but I can't find anything on that ...

Does anyone know if it is possible to create a runtime COM callable wrapper for a .NET class that supports COM_INTERFACE_ENTRY_AGGREGATE_BLIND ?

  • Wouldn't you be creating a COM-callable wrapper (CCW) rather than a runtime-callable wrapper (RCW), since you're going to publish a managed (.NET) co-class to an unmanaged framework (ArcObjects)?
    – stakx
    Commented Jul 31, 2010 at 0:46
  • I updated my answer to reflect new features in .NET 4 where implementing COM aggregation is actually possible.
    – Petr Krebs
    Commented Aug 3, 2010 at 7:04
  • Also, while I don't have any proof for this, it seems that Managed C++ grants you some more freedom when dealing with COM. In case that you don't find a good way to do this with C#, you could have a look at Managed C++ for the critical pieces of code.
    – stakx
    Commented Aug 22, 2010 at 19:07

1 Answer 1


You will be unable to implement pure COM aggregation in .NET 3.5 or lower, but you may be lucky in .NET 4, which adds the new ICustomQueryInterface interface, allowing you to redirect the interface queries properly. More information with a sample included can be found on codeplex.

I also recommend to proceed along the C++ ESRI docs sample. The link is for 9.0, but I suspect this particular sample has not changed one bit.

  • Since this problem interests me a lot, I'll try to port the ESRI's sample to .NET 4 C#.
    – Petr Krebs
    Commented Aug 3, 2010 at 9:36
  • Hey Petr, that would be great to have a C# version of the sample! Even though the ArcGIS 10.0 PIA's are for 3.5, I guess custom features can still be 4.0(?) I'll add a bounty to this question in a couple of days. Commented Aug 3, 2010 at 17:59
  • @Petr how's that sample coming ;)
    – blah238
    Commented Jul 27, 2011 at 7:44
  • @blah238: turned out it's not that easy as it looked like.. ;) There is not much documentation or samples as to .NET COM aggregation out there. I'll try to come back to it.
    – Petr Krebs
    Commented Jul 27, 2011 at 8:03
  • @Kirk: BTW - We ran into some really strange issues when trying to do extensions using .NET 4 - so I wouldn't recommend it. I ended up having to backport a ton of our code to 3.5sp1 to get things to work properly, at least with 10sp1. (One example - subscribing to certain document events, and doing nothing else, will disable right click menus in ArcMap - even though it's totally unrelated functionality...) Commented Jul 27, 2011 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.