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

Closed
jsonmez opened this Issue May 14, 2013 · 24 comments

Comments

Projects
None yet
10 participants

jsonmez commented May 14, 2013

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.
Owner

nikmd23 commented May 14, 2013

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 commented May 14, 2013

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

fujiy commented Jun 27, 2013

Same issue here

putrtek commented Jun 30, 2013

Same issue here. If I comment out this section.


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

Owner

avanderhoorn commented Jul 1, 2013

Humm still wondering what this could be. Any chances someone could create a
simple project that duplicates this error or turn on logging and see if it
shows anything - http://getglimpse.com/Help/Configuration (see at the
bottom).

On Sunday, June 30, 2013, putrtek wrote:

Same issue here. If I comment out this section.

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


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-20242087
.

putrtek commented Jul 1, 2013

Anthony,

I don't think I can turn on Logging because the section that is causing the
error is the section where logging is turned on.

If I comment out the code above in my web.config the error goes away, but Glimpse does not work. I can get to ~/glimpse.axd and click the 'Turn ON' button and it says that glipmse is now ON but when I go back to my app I DO NOT get a Glimpse icon in the lower right hand corner. I added glimpse to an already existing app that also has ELMAH running.

If you would like, tonight I will create a new project and install Glimpse
and see if I get the same error.

Mark Buckley
putrtek@gmail.com

On Mon, Jul 1, 2013 at 1:12 AM, Anthony van der Hoorn <
notifications@github.com> wrote:

Humm still wondering what this could be. Any chances someone could create
a
simple project that duplicates this error or turn on logging and see if it
shows anything - http://getglimpse.com/Help/Configuration (see at the
bottom).

On Sunday, June 30, 2013, putrtek wrote:

Same issue here. If I comment out this section.

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


Reply to this email directly or view it on GitHub<
https://github.com/Glimpse/Glimpse/issues/344#issuecomment-20242087>
.


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-20263679
.

Owner

avanderhoorn commented Jul 1, 2013

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 commented Jul 1, 2013

I will be happy to help trouble shoot this error. I would really like to
get glimpse to work with my app.
I will setup a new project and install Glimpse fresh an see if I still get
this error. If so then I'll look at the SymbolSource page.
I'll report back later today.
Mark Buckley
putrtek@gmail.com
757-818-9902 or 252-332-3862

On Mon, Jul 1, 2013 at 7:42 AM, Anthony van der Hoorn <
notifications@github.com> wrote:

Wow ok. Next step if you are able to help out a little more is to try and
debug with (SymbolSource)[
http://getglimpse.com/Help/Debugging-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!


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-20276758
.

Owner

avanderhoorn commented Jul 1, 2013

Huge thanks mate!

On Mon, Jul 1, 2013 at 10:10 PM, putrtek notifications@github.com wrote:

I will be happy to help trouble shoot this error. I would really like to
get glimpse to work with my app.
I will setup a new project and install Glimpse fresh an see if I still get
this error. If so then I'll look at the SymbolSource page.
I'll report back later today.
Mark Buckley
putrtek@gmail.com
757-818-9902 or 252-332-3862

On Mon, Jul 1, 2013 at 7:42 AM, Anthony van der Hoorn <
notifications@github.com> wrote:

Wow ok. Next step if you are able to help out a little more is to try
and
debug with (SymbolSource)[
http://getglimpse.com/Help/Debugging-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!


Reply to this email directly or view it on GitHub<
https://github.com/Glimpse/Glimpse/issues/344#issuecomment-20276758>
.


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-20277776
.

putrtek commented Jul 2, 2013

Fresh Setup New Web Forms Project
Build and Run... work fine
Install-Package Glimpse.AspNet from NuGet
Nothing else installed.
Build and Run... get the error list show below
As before, If I comment out this section:

The application runs fine but Glimpse does not work

I Will look at SymbolSource next

Unable to cast object of type 'Castle.Proxies.RouteBaseProxy' to type
'Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute'.
*Description: *An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error
and where it originated in the code.

*Exception Details: *System.InvalidCastException: Unable to cast object of
type 'Castle.Proxies.RouteBaseProxy' to type
'Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute'.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.
Stack Trace:

[InvalidCastException: Unable to cast object of type
'Castle.Proxies.RouteBaseProxy' to type
'Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute'.]
Microsoft.AspNet.FriendlyUrls.FriendlyUrlsModule.b__0(Object
sender, EventArgs e) +110
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +69

Mark Buckley
putrtek@gmail.com
757-818-9902 or 252-332-3862

On Mon, Jul 1, 2013 at 8:21 AM, Anthony van der Hoorn <
notifications@github.com> wrote:

Huge thanks mate!

On Mon, Jul 1, 2013 at 10:10 PM, putrtek notifications@github.com
wrote:

I will be happy to help trouble shoot this error. I would really like to
get glimpse to work with my app.
I will setup a new project and install Glimpse fresh an see if I still
get
this error. If so then I'll look at the SymbolSource page.
I'll report back later today.
Mark Buckley
putrtek@gmail.com
757-818-9902 or 252-332-3862

On Mon, Jul 1, 2013 at 7:42 AM, Anthony van der Hoorn <
notifications@github.com> wrote:

Wow ok. Next step if you are able to help out a little more is to try
and
debug with (SymbolSource)[
http://getglimpse.com/Help/Debugging-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!


Reply to this email directly or view it on GitHub<
https://github.com/Glimpse/Glimpse/issues/344#issuecomment-20276758>
.


Reply to this email directly or view it on GitHub<
https://github.com/Glimpse/Glimpse/issues/344#issuecomment-20277776>
.


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-20278200
.

Owner

nikmd23 commented Jul 2, 2013

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 commented Jul 26, 2013

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>
Owner

avanderhoorn commented Jul 26, 2013

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.

Owner

avanderhoorn commented Jul 31, 2013

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.

Owner

avanderhoorn commented Aug 1, 2013

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 commented Aug 1, 2013

Thank You for staying on top of this. Much appreciated. Glimpse is an
AWESOME product. Keep up the great work.

Mark Buckley
putrtek@gmail.com

On Thu, Aug 1, 2013 at 8:25 AM, Anthony van der Hoorn <
notifications@github.com> wrote:

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.


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-21932595
.

Owner

avanderhoorn commented Aug 1, 2013

Not a problem :)

Owner

avanderhoorn commented Sep 10, 2013

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

putrtek commented Sep 10, 2013

Yup it is... I updated to the current release of FriendlyUrls about two
weeks ago and everything is working fine now. Thanks again for staying on
top of this.

Mark Buckley
putrtek@gmail.com
757-818-9902 or 252-332-3862

On Tue, Sep 10, 2013 at 3:30 PM, Anthony van der Hoorn <
notifications@github.com> wrote:

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


Reply to this email directly or view it on GitHubhttps://github.com/Glimpse/Glimpse/issues/344#issuecomment-24187657
.

Owner

avanderhoorn commented Sep 11, 2013

Really glad to hear!

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

Wzack commented Oct 3, 2013

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.

Collaborator

CGijbels commented Oct 3, 2013

@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.

fomenta commented Aug 12, 2015

On 12-aug-2015 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. The error came back up. What can I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment