Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 ?

share|improve this question
    
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 Jul 31 '10 at 0:46
    
Yes, thanks, revised the question. –  Kirk Kuykendall Jul 31 '10 at 3:37
    
I updated my answer to reflect new features in .NET 4 where implementing COM aggregation is actually possible. –  Petr Krebs Aug 3 '10 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 Aug 22 '10 at 19:07
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Since this problem interests me a lot, I'll try to port the ESRI's sample to .NET 4 C#. –  Petr Krebs Aug 3 '10 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. –  Kirk Kuykendall Aug 3 '10 at 17:59
    
@Petr how's that sample coming ;) –  blah238 Jul 27 '11 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 Jul 27 '11 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...) –  Reed Copsey Jul 27 '11 at 16:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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