This project has moved and is read-only. For the latest updates, please go here.

Expando Intellisense

Dec 23, 2011 at 4:45 PM

When running in the interactive window and using an ExpandoObject, we are able to get intellisense for newly created properties on the expando object. However if we use any object that is derived from DynamicObject, we are unable to get any intellisense for any of the object's properties. Also any object that only implements IDynamicMetaObjectProvider doesn't get intellisense either.

I'm just wondering what is the mechanism that makes intellisense work for only ExpandoObjects?

Dec 23, 2011 at 7:57 PM

You need to override GetDynamicMemberNames on the subclasss of DynamicObject for the member names to be available - this ultimately get exposed via the IDMOP implementation for DynamicObject by overriding GetDynamicMemberNames on the DynamicMetaObject implementation.  ExpandoObject knows what its members are so it implements this already.

Dec 27, 2011 at 3:55 PM

Thanks that works!

Jan 5, 2012 at 12:40 AM

This feature is great, however I notice that after calling GetDynamicMemberNames the interactive window then calls TryGetMember on all member names. This slows down intellisense and often it times out. Is there a way to shut this off?

Jan 5, 2012 at 5:09 PM

I tried converting some dynamic properties to dynamic methods using the TryInvokeMember method. However, it seems like only dynamic properties are supported because TryInvokeMember is never invoked and TryGetMember is invoked instead. Is there a way to get dynamic methods to work?