This project has moved. For the latest updates, please go here.

Expando Intellisense

Dec 23, 2011 at 3: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 6: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 2:55 PM

Thanks that works!

Jan 4, 2012 at 11:40 PM

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 4: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?