Esempio n. 1
0
        private static object TryBind(CallableMember member, object receiver)
        {
            Contract.Requires(member != null && receiver != null);

            var memberType = member.GetType();
            var method     = memberType.GetMethod("Bind");     // this method only exists on CallableMember<T> but not on CallableMember

            return(method.Invoke(member, new[] { receiver })); // returns CallableValue<T>
        }
Esempio n. 2
0
        private object TryBind(CallableMember member, object receiver)
        {
            Contract.Requires(member != null && receiver != null);

            try
            {
                var memberType = member.GetType();
                var method     = memberType.GetMethod("Bind");     // this method only exists on CallableMember<T> but not on CallableMember
                return(method.Invoke(member, new[] { receiver })); // returns CallableValue<T>
            }
            catch (Exception e)
            {
                // should not happen, because all our CallableMember objects are also CallableMember<T>,
                // and the only client of this method ('GetAmbientProperties') ensures that 'receiver' is of type T.
                m_state.Logger.ReportDebuggerRendererFailedToBindCallableMember(m_state.LoggingContext, member.GetType().FullName, receiver.GetType().FullName, e.GetLogEventMessage());
                return(null);
            }
        }