public void DisableDebugger() { if (InvokeRequired) { new Thread(() => { var del = new DisableDebuggerDelegate(DisableDebugger); Invoke(del, null); }).Start(); } else { StackView.Enabled = false; ObjectDataGrid.Enabled = false; } }