Question

I installed Twitter.Bootstrap.mvc4 in a VS2010 project. I also installed Glimpse.

I found that the Menus using Navigation Routes that the Twitter.Bootstrap.mvc4 offers is "broken" by Glimpse. In the NavigationExensions.cs file, the RouteCollection is wrapped in Castle proxies causing the variable navigationRoutes to always return 0.

        public static IEnumerable<NamedRoute> GetRoutesForCurrentRequest(RouteCollection routes,IEnumerable<INavigationRouteFilter> routeFilters)
    {
        var navigationRoutes = routes.OfType<NamedRoute>().Where(r=>r.IsChild==false).ToList();

I can see the information in the watch window and even get the information to show in the Immediate window using "((Castle.Proxies.RouteProxy_1)routes[5]).__target". So I thought to loop through the routes and looked for a named route. However, I don't know what to do to get the references I need to access the proxies. The Castle code is buried in the Glimpse.Core library.

I uninstalled Glimpse to make sure that was causing the problem (it is).

Was it helpful?

Solution

There is currently an issue which reflects the same problem, albeit in a different context.

There is currently no real fix, since GetRoutesForCurrentRequest checks for NamedRoute instances and Glimpse uses proxies, but you can always disable a part of Glimpse so that the navigation issue is fixed in the meanwhile.

To make it work again, you

  1. must disable the RouteInspector of Glimpse
  2. (optionally) remove the Routes tab from the Glimpse dashboard, since it will now show only partial information due to the missing inspector. Although this option is not required and the Routes tab might still show you some information you might want to see.

This can be done in the configuration section of Glimpse

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
  <inspectors>
    <ignoredTypes>
      <add type="Glimpse.AspNet.Inspector.RoutesInspector, Glimpse.AspNet"/>
    </ignoredTypes>
  </inspectors>
  <tabs>
    <ignoredTypes>
      <add type="Glimpse.AspNet.Tab.Routes, Glimpse.AspNet"/>
    </ignoredTypes>
  </tabs>
</glimpse>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top