Ejemplo n.º 1
0
        /// <summary>
        /// Called by the Win32 handle collector when a new handle is created.
        /// </summary>
        private void OnHandleRemove(string handleName, IntPtr handle, int HandleCount)
        {
            HandleType type = (HandleType)s_handleTypes[handleName];

            bool removed = false;

            if (type != null)
            {
                removed = type.Remove(handle);
            }

            if (!removed)
            {
                if (CompModSwitches.HandleLeak.Level >= TraceLevel.Error)
                {
                    // It seems to me we shouldn't call HandleCollector.Remove more than once
                    // for a given handle, but we do just that for HWND's (NativeWindow.DestroyWindow
                    // and Control.WmNCDestroy).
                    Debug.WriteLine("*************************************************");
                    Debug.WriteLine("While removing, couldn't find handle: " + Convert.ToString(unchecked ((int)handle), 16));
                    Debug.WriteLine("Handle Type      : " + handleName);
                    Debug.WriteLine(Environment.StackTrace);
                    Debug.WriteLine("-------------------------------------------------");
                }
            }
        }
Ejemplo n.º 2
0
        private void OnHandleRemove(string handleName, IntPtr handle, int HandleCount)
        {
            HandleType type = (HandleType)handleTypes[handleName];
            bool       flag = false;

            if (type != null)
            {
                flag = type.Remove(handle);
            }
            if (!flag)
            {
                TraceLevel level = System.ComponentModel.CompModSwitches.HandleLeak.Level;
            }
        }
        /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.OnHandleRemove"]/*' />
        /// <devdoc>
        ///     Called by the Win32 handle collector when a new handle is created.
        /// </devdoc>
        /** @conditional(DEBUG) */
        private void OnHandleRemove(string handleName, IntPtr handle, int HandleCount)
        {
            HandleType type = (HandleType)handleTypes[handleName];

            if (type != null)
            {
                bool removed = type.Remove(handle);
                // It seems to me we shouldn't call HandleCollector.Remove more than once
                // for a given handle, but we do just that for HWND's (NativeWindow.DestroyWindow
                // and Control.WmNCDestroy).
                // Debug.Assert(removed, "Couldn't find handle " + Convert.ToString(handle, 16) + " of type "
                //              + handleName + " when asked to remove it");
            }
        }