Glimpse Logo

Glimpse Debugging for Sitecore

Posted 03/28/2012 by techphoria414

Posted in

While I have my gripes about the implementation of Sitecore.Context as essentially a repository for global variables, there is no doubt that the concept provides a great deal of the flexibility of the platform. But this flexibility can also create headaches in debugging. Context item, database, language, device... and further how they're used to construct and apply renderings. There's a lot going on in constructing just a single page. How can we securely expose information about the context to help debug published pages, even in production?

Glimpse is a debugging tool which espouses that "what Firebug is for the client, Glimpse does for the server." It securely and transparently adds a client-side debugging interface to your output pages.

Out of the box, Glimpse provides all kinds of information on what's going on with the server side of your ASP.NET Webforms or MVC application. What if we could extend this UI to include information about the Sitecore Context and other page information? The Glimpse site already provides a lot of great information on what Glimpse does and how to install Glimpse. It also provides a nice tutorial on its dead-simple plugin architecture.

To create a Sitecore plugin for Glimpse:

  • Install Glimpse using NuGet.
  • Create a new class library in your solution.
  • Reference Glimpse.Core, System.ComponentModel.Composition, and System.Web assemblies
  • Create a new class that implements IGlimpsePlugin
  • Mark your class with the attribute [Glimpse.Core.Extensibility.GlimpsePluginAttribute()]
  • Implement the GetData method to return a List of object arrays containing your debugging data
  • Implement the Name property to return the string "Sitecore"
  • Drop your new assembly into your Glimpse-enabled application

The result may look something like this:

Sitecore Debugging with Glimpse
click to enlarge

Download an example Glimpse plugin for Sitecore

You can either integrate this project with your solution if you'd like to make modifications, or include the built assembly as-is in your Glimpse-enabled project. It provides some basic information about the page, but I could certainly envision extending this to include more information, akin to the Sitecore Debug view.

UPDATE: In April 2012 there was a Sitecore User's Virtual Group meeting in which David Morrison from Sitecore showed off his more advanced Sitecore Glimpse plugin.

Share:

Pre-Disqus Comments

  • Charles Boyung's gravatar Charles Boyung said:
    10/8/2012 11:17 AM

    Nick - seems like whatever Sitecore search I do, your name comes up :) In your playing with this, have you seen anything where Glimpse causes an error in the w3wp process (my guess is a buffer overrun/infinite loop)? I've never seen Glimpse do this before, but when we view any of our content items with Glimpse enabled in our Sitecore 6.6 project, it kills the web process entirely, asking me if I want to debug it. Not sure if it's a Sitecore thing, a Sitecore 6.6 thing, or something in the code we have in place.

  • Nick Wesselman's gravatar Nick Wesselman said:
    5/21/2012 8:12 PM

    No problem Kyle. I added the April 2012 SUVG meeting and a link to the Sitecore Glimpse plugin that David Morrison created. I think it's further along than mine.

  • Kyle Heon's gravatar Kyle Heon said:
    5/21/2012 12:40 PM

    Thanks for this Nick. We have an instance that uses a custom SSO and we carry along a large amount of session related information and as such we have to specifically kill access to the site when logged into the sitecore domain so getting the debugger working hasn't been very successful. This looks like it might be exactly what the doctor ordered (you file dropped in nicely, I'll see about extending it).

Sitecore MVP

Popular Posts

Archive

Syndication