Provides a way to ensure that any cecil references are resolved as well as providing information about whether then needed to be resolved.
Пример #1
0
        /// <summary>
        /// Invokes the behavior.
        /// </summary>
        /// <param name="item">Item on which to invoke the behavior.</param>
        /// <returns>Result of the invocation.</returns>
        private TReturn InvokeForItem(object item)
        {
            Contract.Requires(item != null);

            if (DynamicResolver.DynamicTryResolve(item, out object resolvedItem))
            {
                // if a resolvable reference was passed in, that would be considered an
                // error because it means that the source graph may contain a reference where
                // a definition was expected
                throw new InvalidOperationException(string.Format(
                                                        "Cannot invoke on resolvable items of type {0}. Resolve the item first.",
                                                        item.GetType().FullName));
            }

            return(this.InvokeForNonILItem(item));
        }