I have tried to create a debug button as shown below taking reference from link#3 in bottom, I have compiled and configured the button in core database and configured the Commands.config but I am getting error message on the master database when I click from ribbon and sitecore admin client is restarted. I am not getting what the error message is points to.. !
Ribbon Button screen

Error Message Text
Control "system" does not exist on form. at Sitecore.Shell.Framework.Commands.CommandManager.GetMethodCommand(String command) at Sitecore.Shell.Framework.Commands.CommandManager.GetDispatchCommand(String command) at Sitecore.Web.UI.Sheer.ClientPage.Dispatch(String command) at Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent() at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
Error Message screen

One more thing the link#2 mentioned in the bottom does not seems to contain the 'prototype zip available in the Resources section' as said by John in the blog post here.. can anyone see If I'm not wrong?
PS: link#1 is the old post to the link#2
Debug.cs code
using System;
namespace SitecoreDemo.Shell.Framework.Commands.System
{
[Serializable]
// implements the debug command on the Sitecore menu of the desktop
// and in the ribbon of the Content Editor
public class Debug : Sitecore.Shell.Framework.Commands.System.Debug
{
public override void Execute(Sitecore.Shell.Framework.Commands.CommandContext context)
{
// validate arguments and processing context
Sitecore.Diagnostics.Assert.ArgumentNotNull(context, "context");
Sitecore.Diagnostics.Assert.IsNotNull(Sitecore.Context.ClientPage, "ClientPage");
Sitecore.Diagnostics.Assert.IsNotNull(Sitecore.Context.ClientPage, "ClientResponse");
// ensure the new browser window authenticates as the current CMS user
// (in case the user formerly previewed as another user)
Sitecore.Publishing.PreviewManager.RestoreUser();
// open the new browser window
Sitecore.Web.UI.Sheer.SheerResponse.Eval("window.open('" + this.GetDebuggingUrl(context) + "', '_blank');");
}
// construct a URL to launch the debugger
private string GetDebuggingUrl(Sitecore.Shell.Framework.Commands.CommandContext context)
{
// whether to use the sc_lang query string parameter to specify the language
bool includeLanguage = Sitecore.Links.LinkManager.LanguageEmbedding != Sitecore.Links.LanguageEmbedding.Never;
// URL of the debugging window defaults to home page of managed site
Sitecore.Text.UrlString url = new Sitecore.Text.UrlString("/");
// enable all debugging options
url.Add("sc_debug", "1"); // enable the debugger
url.Add("sc_prof", "1"); // enable profiling
url.Add("sc_trace", "1"); // enable tracing
url.Add("sc_ri", "1"); // enable rendering information
// if the user has selected an item, ensure they have saved,
// then debug the item in the database and language associated with that item
if (context != null && context.Items != null && context.Items.Length > 0 && context.Items[0] != null)
{
Sitecore.Context.ClientPage.ClientResponse.CheckModified(false);
Sitecore.Data.Items.Item item = context.Items[0];
url.Add("sc_database", item.Database.Name);
url.Add("sc_itemid", item.ID.ToString());
if (includeLanguage)
{
url.Add("sc_lang", item.ID.ToString());
}
}
// if the user has not selected an item,
// if there is a content database, debug that database
// using the content language
else if (Sitecore.Context.ContentDatabase != null)
{
url.Add("sc_database", Sitecore.Context.ContentDatabase.Name);
if (includeLanguage)
{
url.Add("sc_lang", Sitecore.Context.ContentLanguage.Name);
}
}
// return a URL to open the debugger
return url.GetUrl();
}
public override Sitecore.Shell.Framework.Commands.CommandState QueryState(Sitecore.Shell.Framework.Commands.CommandContext context)
{
// if the user has selected at least one item
if (context.Items != null && context.Items.Length > 0 && context.Items[0] != null)
{
// if that item does not specify a layout for any device, disable this command
if (!this.HasLayoutForAnyDevice(context.Items[0]))
{
return Sitecore.Shell.Framework.Commands.CommandState.Disabled;
}
}
return base.QueryState(context);
}
// returns true if the item specifies a layout for any device
protected bool HasLayoutForAnyDevice(Sitecore.Data.Items.Item item)
{
Sitecore.Diagnostics.Assert.IsNotNull(item, "item");
// evaluate each device in the database containing the item
foreach (Sitecore.Data.Items.DeviceItem compare in item.Database.Resources.Devices.GetAll())
{
// if the item specifies layout details for that device, return true
if (item.Visualization.GetLayout(compare) != null)
{
return true;
}
}
// layout details for the item do not specify a layout for any device
return false;
}
}
}

Error Message Textin the question and dialog content heading isSitecore has encountered a problem and needs to close. We are sorry for the inconvenience.. - Harsh Baid