Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error when installing Glimpse nuget package for ASP.NET (Unable to cast object of type 'Castle.Proxies.RouteBaseProxy') #344

Closed
jsonmez opened this Issue · 23 comments

9 participants

@jsonmez

When using Glimpse.AspNet 1.2.2 from nuget

Unable to cast object of type 'Castle.Proxies.RouteBaseProxy' to type 'Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute'.

Occurs after installing Glimpse.

Steps to reproduce.
1. Create Web Forms Applications
2. Install Glimpse.AspNet 1.2.2 using nuget package manager
3. Run application, error occurs.

@nikmd23
Owner

Thanks for this report @jsonmez.

Did you install a special package for FriendlyUrl's? Is that package built into the WebForms project template now?

@jsonmez

I didn't install a special package, so I am assuming it must be built into the default template.

@fujiy

Same issue here

@putrtek

Same issue here. If I comment out this section.

<!-- If you are having issues with Glimpse, please include this. It will help us figure out whats going on.
-->

The error goes away. However Glimpse does not work, No Icon appears.

@avanderhoorn
Owner
@putrtek
@avanderhoorn
Owner

Wow ok. Next step if you are able to help out a little more is to try and debug with SymbolSource. This should tell us what the core exception is that you are getting. I must be happening pretty early on for logging to fail as well. Thanks for your continued help!

@putrtek
@avanderhoorn
Owner
@putrtek
@nikmd23
Owner

Well, I hate to say this, but after a bit of digging it looks like FriendlyUrl's has been implemented in a way to make it fundamentally incompatible with Glimpse. Of course, this problem is exacerbated now that Microsoft.AspNet.FriendlyUrls is included out of the box in the WebForms template.

The line in question is found in Microsoft.AspNet.FriendlyUrls.FriendlyUrlsModule.Init() (which is both internal and sealed):

FriendlyUrlRoute local_0 = (FriendlyUrlRoute) RouteTable.Routes["AspNet.FriendlyUrls"];

I'm not sure why the cast to FriendlyUrlRoute. The only place local_0 (as named by decompiler) is used is on the next line, which accepts an IFriendlyUrlRoute:

FriendlyUrlsModule.RedirectToFriendlyUrl((HttpContextBase) new HttpContextWrapper(((HttpApplication) sender).Context), (IFriendlyUrlRoute) local_0, Dependencies.VirtualPathUtility);

Either way, FriendlyUrlRoute is sealed as well as internal. (IFriendlyUrlRoute is also internal.)

If the implementation could be changed so that local_0 is cast to the interface instead, and that interface was made public, then we could do something in Glimpse to make this all work together.

I've reached out to @DamianEdwards‎ and @GrabYourPitchforks who @shanselman says are the authors of the library to see if FriendlyUrl's is open source. Fingers crossed that it is and that they will accept a pull request.


UPDATE: I've heard back from @DamianEdwards‎. FriendlyUrls is not open source but he hopes it will be one day.

@Addinho

I have the same problem. I disable the routes tab and inspector as a temporary workaround.

<glimpse ...>
    ...
    <tabs>
        <ignoredTypes>
            <add type="Glimpse.AspNet.Tab.Routes, Glimpse.AspNet" />
        </ignoredTypes>
    </tabs>
    <inspectors>
        <ignoredTypes>
            <add type="Glimpse.AspNet.Inspector.RoutesInspector, Glimpse.AspNet" />
        </ignoredTypes>
    </inspectors>
</glimpse>
@avanderhoorn

The above is the correct temp workaround. We are looking to bake a fix Ito glimpse that will just ignore these routes. It's not the best fix but it means it won't break.

@avanderhoorn

Ok the temp workaround for this is as follows: if we detect that you are using any friendly URLs we will prevent the proxy process from getting involved and return a friendly error message which states why you aren't seeing anything. In the mean time, we are working with MS to see what can be done in the future.

@avanderhoorn
Owner

Ok I have some good news. As of 1.0.2 of FriendlyUrls this issue will be fixed. Please see that update when it comes out.

@putrtek
@avanderhoorn
Owner

Not a problem :)

@avanderhoorn

Closing this off as it should be fixed with the current release of FriendlyUrls.

@putrtek
@avanderhoorn

Really glad to hear!

@IanIppolito

I just got the same error and upgrading friendly URLs fixed it for me too. Thanks so much!

@Wzack

On 10-3-13 I just installed glimpse into a brand new default asp.net web application project using nuget and ran it with the same result. Using Visual Studio 2012.

@CGijbels
Collaborator

@Wzack make sure you update the Microsoft.AspNet.FriendlyUrls NuGet package, the default VS template still contains an older version which is incompatible with Glimpse.

@gomo gomo referenced this issue in SunriseDigital/CsharpSunrise
Open

C#ポイント #1

7 of 12 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.