-
Notifications
You must be signed in to change notification settings - Fork 711
LockRecursionException after update #703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is strange. I've never seen this. Does this happen all the time or only some of the time? I can't think of any change that would cause this and not be caught in some form of testing. How are you hosting? IIS? self-host? I've seen different hosts cause issues and I don't the resource to test on every host. Thanks |
IIS express from Visual Studio 2017 or 2019 on two separate windows 10 pc's. |
A repro with all the setup and configuration you used is always best. It's not supposed to matter, but there are edge cases where the hosting model causes variations. I've had a few such edge cases with IIS and/or IIS Express. I've moved away from them for testing and samples to more closely align between Classic ASP.NET and ASP.NET Core. The self-host approach also executes much faster with far less configuration. |
Here you go, confirmed same error on both my windows 10 iis express in vs2019, and on server 2012 r2 iis 8.5 |
I also have this issue with version 4.1.1, but only if I use the constraints parameter of MapHttpRoute. If I instead use a Route attribute on the controller, it works fine. Hosted on Windows 10 IIS, VS 2019. |
Any news on this one. Same issue here. 4.1.1 EDIT: downgraded to 4.0.0 temporarily (which IS working) |
Apologies. Apparently, I missed this issue during sweeping status updates the past couple of weeks. I thought this was perhaps related to #705, but after further analysis, I don't think it is. This issue appears to be caused by an update that adds explicit route value evaluation here. This only happens when hosted using the IIS implementation (which is infuriating 😠). This would be the 4th or 5th time there has been a runtime difference in hosts. There isn't a clear and straight forward way to determine whether I need to confirm that will work with the provided repro, but I suspect that it will. TL;DR@EdwardFinn I also noticed that you are mixing convention and attribute-based routing methods. I strongly advise against that; especially in Web API. Attribute-based routing was bolted on after the fact. Mixing the two can lead to a lot of confusion for debugging and maintenance. The example you provided just so happens to illustrate this problem. The following appears to use attribute-routing, but insufficient attributes have been provided. Since a convention has been defined, the routing system will fall back and match a convention-based route pattern. This is a false negative as it should have failed. [RoutePrefix("v{version:apiVersion}/GlobalSettings")] // ← a prefix is defined, but this attribute does nothing!
public class GlobalSettingsController : ApiController
{
[HttpGet]
// TODO: for this to use attribute routing, you need the following attribute:
// [Route("{key}")]
public string GetSetting(string key) => "TEST"; // ← this action is actually routed by convention
// also note that 'key' will always be null because the
// expected parameter name is 'id' in your route template
} The repro appears to Web API and MVC together. That's fine, but remember that they each their own routing systems. You can elect to only use attribute routing in Web API, while only using convention-based routing in MVC. You can mix styles if you really want to, but be warned - there be dragons. There are certain edge cases where API Versioning will not work properly. As long as you don't mix routing styles between controllers logically grouped together across versions, you should be fine. This issue is most pervasive when using Web API with OData. |
Updating via Nuget from Microsoft.AspNet.WebApi.Versioning 4.0.0 to 4.1.0 results in System.Threading.LockRecursionException
Error is thrown from
System.Web.Http.HttpRequestMessageExtensions.ApiVersionProperties( this HttpRequestMessage request )
configuration is by namespace
And not sure its if matters but version is single number
The text was updated successfully, but these errors were encountered: