Troubleshooting - Glimpse/Glimpse GitHub Wiki

Having a problem with Glimpse? Here are a few common troubleshooting tips. If looking through these tips or the rest of the documentation doesn't fix your issue, and you think Glimpse could be causing the issue:

Debugging Glimpse

If you haven't been able to fix your problem, The first step is to enable Glimpse's internal logging mechanism, as described in the Logging section of Configuration. You can also debug Glimpse code by loading symbol files as described in Debugging with SymbolSource

Problem: Glimpse icon does not appear

If the Glimpse log file contains the warning:

Unable to locate '</body>' with content encoding '{response encoding}'. Response may be compressed.

Than ensure that the page contains a closed body tag (</body>). In situations where HTML content is compressed, Glimpse will be unable to find the required closed body tag. In these cases, Glimpse requires additional configuration.

One possible scenario where HTML content is compressed is by using IIS URL Compression. One way this can be enabled is from the following Web.config setting:

<system.webServer>
  <urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
</system.webServer>

In this case, to get glimpse working you would set the value of the dynamicCompressionBeforeCache attribute to false.

For projects using ASP.NET MVC, add the GlimpseClient HtmlHelper to the end of the view or layout:

@Html.GlimpseClient()

For projects using ASP.NET WebForms, first register the Glimpse controls:

<%@ Register TagPrefix="glimpse" Namespace="Glimpse.AspNet.Controls" Assembly="Glimpse.AspNet" %>

then add the Client control to the end of .aspx or .master file:

	<!-- page/master contents -->
    <glimpse:Client runat="server"/>
  </body>
</html>

Problem: Glimpse does not work on remote servers

To run Glimpse on a remote server (like a server in Windows Azure), disable the LocalPolicy:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd" >
	<runtimePolicies>
		<ignoredTypes>
			<add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"/>
		</ignoredTypes>
	</runtimePolicies>
</glimpse>

Problem: Getting Glimpse to work with manual created SQL Connections/Commands

To retrieve data for the SQL tab, Glimpse attaches itself by providing its own GlimpseDbProviderFactory which wraps the standard ones. This lets it collect information about how you're using your data connections.

If you're not using an ADO connection that uses the DbProviderFactories as part of its infrastructure, Glimpse won't collect any data for the SQL tab (out of the box). You can fix this by manually providing a Glimpse-wrapped IDbConnection.

To find out more about setting this up, read the following:

Problem: Configuration exception with child application

If you have a child application, you may see exceptions like this:

The value of the property 'type' cannot be parsed. The error is: Could not load file or assembly 'Glimpse.{X}' or one of its dependencies. The system cannot find the file specified.

This problem can be solved by wrapping the <glimpse> element in a <location> section:

<location path="." inheritInChildApplications="false">
  <glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    ...
  </glimpse>
</location>

Question: How can I see the Post data in the case of the PRG scenario?

By default, Glimpse shows you the data associated with the last request (whether that be a Post or Get), you may not see binding information in Post/Redirect/Get scenarios - As the binding Information is associated with the original Post but then the following Get is what Glimpse will show.

In the near future (hopefully release v2 timeframe) we will make this experience better. In the mean time you can use the History tab to pull out the original Post request from the session.

Problem: Getting a System.NullReferenceException in one of the Tabs when accessing the Session object

Most of the AspNet tabs executes on the RuntimeEvent.EndRequest event, this means that the tab will execute after the Http Request has ended, which also happens after access to the Session object has ended, if for some reason Glimpse tries to access the Session object to render the contents of a tab you may get a System.NullReferenceException.

A possible scenario would be if your code access the Session object in a method that is used to render a property in your view:

public static string ToStringCurrentCulture(this decimal obj)
{
    return obj.ToString("N2", (CultureInfo)HttpContext.Current.Session["culture"]);
}

The code above would result in a System.NullReferenceException in the Metadata Tab because it runs after Glimpse can no longer access the Session object.

This problem can be solved by implementing your own custom tab that would run on RuntimeEvent.EndSessionAccess:

public class MyMetadataTab : Glimpse.Mvc.Tab.Metadata
{
    public override RuntimeEvent ExecuteOn
    {
        get { return RuntimeEvent.EndSessionAccess; }
    }
}

Then you must ignore the original Metadata tab by adapting your web.config:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    ...
    <tabs>
        <ignoredTypes>
            <add type="Glimpse.Mvc.Tab.Metadata, Glimpse.Mvc" />
        </ignoredTypes>
    </tabs>
</glimpse>

That way Glimpse can access the Session object to render your tab.

⚠️ **GitHub.com Fallback** ⚠️