Glimpse.Mvc5 1.5.3 breaks ApiExplorer

158 views
Skip to first unread message

Todd Smith

unread,
Mar 5, 2014, 9:00:20 AM3/5/14
to getglim...@googlegroups.com
I have a functioning Mvc 5.1 web api + OWIN 2.1 project integrated with swagger.net and swagger-ui. If I add Glimpse.Mvc5 1.5.3 and associated dependencies to my project it breaks the following method call which then returns 0 results:

GlobalConfiguration.Configuration.Services.GetApiExplorer ().ApiDescriptions

After uninstalling Glimpse.Mvc5 the call to ApiDescriptions works as normal.

Anthony van der Hoorn

unread,
Mar 5, 2014, 11:24:07 AM3/5/14
to getglim...@googlegroups.com
Do you know what Swagger is doing under the hood here? For instance, is it looking through your route table to build the list up?

If this is the case and if its basing its logic on the `type` of the route it finds, its probably looking for webapi routes, but to do what glimpse does, we replace these with proxied version of the same routes. In a future version we can probably make sure that this works a little better, but for the moment thats my guess. Are you able to confirm this?

For the current release version, the temp fix would be to blacklist the glimpse route tab/inspector (the glimpse.axd page shows you how to do that).

Let me know how you go.


--
You received this message because you are subscribed to the Google Groups "GetGlimpse-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to getglimpse-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Todd Smith

unread,
Mar 5, 2014, 7:26:32 PM3/5/14
to getglim...@googlegroups.com
Swagger just runs off of GlobalConfiguration.Configuration.Services.GetApiExplorer () and by default looks for routes who's url starts with /api. The only thing swagger does that's special is it takes all the api meta data from ApiExplorer and outputs JSON that describes the api.

After futher analysis it looks like ApiExplorer is failing when it attempts to iterate over the route collection by casting the routes to IHttpRoute but all of the routes are now of type Castle.Proxies.RouteProxy.
Capture.PNG

Anthony van der Hoorn

unread,
Mar 5, 2014, 9:03:39 PM3/5/14
to getglim...@googlegroups.com
This is why I expected might be happening. Let me have a look in the morning and I'll see if what we might be able to do to improve this.  

Paul Atkins

unread,
Mar 10, 2014, 4:31:58 PM3/10/14
to getglim...@googlegroups.com
Todd,

My guess would be it's related to this fix to Glimpse.AspNet (which is used by Glimpse.Mvc5): The update to RouteInspector to ignore non AspNet routes doesn't work for WebHosted WebAPIs

It's due to be included in the next release, but in the meantime you could try compiling the latest source from GitHub and copying the Glimpse.AspNet.dll into your project. (the Glimpse Nightly and Milestone feeds seem a little out of date when I tried the links from the wiki). This should fix the issue with the routes being replaced.
To unsubscribe from this group and stop receiving emails from it, send an email to getglimpse-dev+unsubscribe@googlegroups.com.

avanderhoorn

unread,
Mar 11, 2014, 7:23:34 AM3/11/14
to getglim...@googlegroups.com
This fix should be live now. Its gone out in Glimpse ASP.NET v1.8.1. If you could test it out and let me know that would be great!

Todd Smith

unread,
Mar 12, 2014, 7:27:56 PM3/12/14
to getglim...@googlegroups.com
Tested with Glimpse ASP.NET v1.8.1 and it's working now.

Anthony van der Hoorn

unread,
Mar 12, 2014, 8:13:11 PM3/12/14
to getglim...@googlegroups.com
GREAT!!! Thanks for letting us know.

Thanks to Paul for the fix!


--
You received this message because you are subscribed to the Google Groups "GetGlimpse-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to getglimpse-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages