private void btnDebug_Click(object sender, EventArgs e) { RelativeFile item = listBoxFiles.SelectedItem as RelativeFile; if (item == null) { return; } Variables.Root variables = GenerateVariables(item.File); variables.CheckFlag(""); // keep the object alive for debugging Debugger.Break(); }