/// <summary>
        /// Initializes a new instance of the <see cref="TraceMethod"/> class.
        /// </summary>
        /// <param name="ri">The ri.</param>
        /// <param name="message">The message.</param>
        internal TraceMethod(ReflectInsight ri, String message)
        {
            RI       = ri;
            Message  = message ?? "(null)";
            Disposed = false;

            ControlValues = RequestManager.GetRequestObject();
            TraceStates   = ControlValues.GetState <TraceMethodState>("TraceMethodState");

            if (TraceStates == null)
            {
                // must be parent trace method
                TraceStates = new TraceMethodState()
                {
                    TraceLevel = 0, ExceptionHandled = false
                };
                ControlValues.AddState("TraceMethodState", TraceStates);
            }

            RICustomData cData = null;

            if (cData == null)
            {
                RI.EnterMethod(Message);
            }
            else
            {
                FSendMethodInfo.Invoke(RI, new object[] { MessageType.EnterMethod, message, cData, new object[] { } });
            }

            LastIndentLevel = ReflectInsight.IndentLevel;
            TraceStates.TraceLevel++;
        }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            lock (this)
            {
                if (!Disposed)
                {
                    Disposed = true;
                    GC.SuppressFinalize(this);

                    TraceStates.TraceLevel--;
                    if (TraceStates.TraceLevel == 0)
                    {
                        // must be parent trace method
                        ControlValues.RemoveState("TraceMethodState");
                    }

                    Int32 currentIndentLevel = ReflectInsight.IndentLevel;
                    while (currentIndentLevel > LastIndentLevel)
                    {
                        RI.ExitMethod("Matching ExitMethod was missing...");
                        currentIndentLevel--;
                    }

                    RI.ExitMethod(Message);
                }
            }
        }
        /// <summary>
        /// Assigns to package.
        /// </summary>
        /// <param name="controlValue">The control value.</param>
        /// <param name="package">The package.</param>
        static internal void AssignToPackage(ControlValues controlValue, ReflectInsightPackage package)
        {
            List <ReflectInsightExtendedProperties> propertyList = new List <ReflectInsightExtendedProperties>();

            lock (AllRequests)
            {
                AppendExtendedProperties(propertyList, AllRequests);
            }

            AppendExtendedProperties(propertyList, controlValue.RequestMessageProperties);
            AppendExtendedProperties(propertyList, controlValue.SingleMessageProperties);

            if (propertyList.Count > 0)
            {
                package.FExtPropertyContainer = new ReflectInsightPropertiesContainer(propertyList.ToArray());
                controlValue.ResetSingleRequestProperties();
            }
        }
 public ControlValuesContainer(ControlValues values)
 {
     Disposed       = false;
     FControlValues = values;
 }