11

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 ?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 30, 2010 at 21:21
3
  • 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)? 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. 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. Commented Aug 22, 2010 at 19:07

1 Answer 1

4

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.

answered Aug 2, 2010 at 19:27
5
  • Since this problem interests me a lot, I'll try to port the ESRI's sample to .NET 4 C#. 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 ;) 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. 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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.