private void OnHandleRemove(string handleName, IntPtr handle, int HandleCount) {
HandleType type = (HandleType)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((int)handle, 16));
Debug.WriteLine("Handle Type : " + handleName);
Debug.WriteLine(Environment.StackTrace);
Debug.WriteLine("-------------------------------------------------");
}
}
}