Code: Developer Dashboard Enabler/Disabler

Computer Code Randomizzzer.jpg

The SharePoint 2010 Developer Dashboard Enabler/Disabler.

As already mentioned, the Developer Dashboard can be enabled or disabled by the developer, through one of three ways: stsadm, Powershell and VS code.

All three of those options have their pros and cons. For example, the stsadm approach, is the fastest of the three as it only requires a sinle line of code for the Developer Dashboard to enable as “full on” or “on-deman on”. However, using the Visual Studio approach gives more versatility and control to the developer. For example, the developer can leverage more options and fine-tune some others that default to specific values when the Dashboard is kickstarted through both stsadm and the Powershell.

For my needs, I found that creating a Visual Web Part that enables and disables the Developer Dashboard at will was the way to go. So, I created the Developer Dashboard Enabler/Disabler which provides me with the following:

1. only users that are allowed to Manage Web sites are allowed to install the web part.
2. the web part is smart enough to know whether the dashboard is on or off and perform the required operations to turn it off or on accordingly.
3. the critical calls that are being monitored are raised to 999 (the default is 50).
4. the SQL queries that are being monitored are also raised to 999 (the default is 50).
5. calls the Update method to set the aforementioned options and
6. reloads the webpage that initiated the Developer Dashboard so that it will appear in the lower part of the screen (otherwise a manual refresh would be required).

Remember that the web part needs to be installed in the Central Administration (as mentioned in the “Explained: the Developer Dashboard” article) as it is a farm-wide feature and will raise a security exception if you try to install it anywhere but there.

The project files are located here .

NOTES: Make sure to point it to your own Central Administration URL and that you build the project targeting the x64 CPU architecture. In case you have not installed a Web Part in the 2010 version of SharePoint, I have to tell you it’s a matter of two clicks. Just build the solution and then, in the build menu of Visual Studio 2010, click on deploy. You no longer have to get messy with the GAC and the moving .dll files (as was the case with the 2007 version of SharePoint). Once you have deployed the solution, navigate to your Central Administration in your browser, click on Site Settings, navigate to Web Parts and you will see the new DevDashEnabler webpart in the Custom web parts. You could (and should) rename the web part and provide both a title and description. Once you’re done, you can go back to Central Administration, edit the page and add the web part in whichever Web Part Zone you wish. If all the steps have been followed correctly, you should be looking at an button that once clicked, will display the Developer Dashboard at the bottom of your screen (and if clicked again, it will disable the dashboard).

Also, please do note this is not a Sandboxed solution. Farm wide solutions are always full-trust.

MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

One thought on “Code: Developer Dashboard Enabler/Disabler

  1. […] on this later… edit: Version Alpha has been posted here. A future Nuclear Version is now officially announced. Tags: .net framework, announcement, code, […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.