-
Notifications
You must be signed in to change notification settings - Fork 707
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
AdvertiseApiVersionsAttribute causes stackoverflow when enumarated #932
Comments
Confirmed. This is a 🐞 . I'm surprised this has never been caught by code analysis or a test. I just discovered a different issue related to reference assembly package. I don't understand why it ever worked, but that's probably why the test is failing. The problem happens in Visual Studio, but not the CLI. You might try I work on get a patch out. Thanks for reporting it. |
Thanks! Console.WriteLine(string.Format(new CultureInfo("nb-no"), "{0:N1}", 1)); //1,0 <-- not expected in test
Console.WriteLine(string.Format(new CultureInfo("en-us"), "{0:N1}", 1)); //1.0
Console.WriteLine(string.Format( CultureInfo.InvariantCulture, "{0:N1}", 1)); //1.0 From yield return new object[] { provider, "Major = {0:V}, Minor = {0:v}, Iteration = {1:N1}", 1, "Major = 1, Minor = 0, Iteration = 1.0" }; In Culture "nb-no" a comma is used as decimal seperator which doesn't follow Microsoft API versioning guidelines as far as I can tell, but I must admit I don't know what the "Iteration" argument is used for. Looking around if I can spot why, but if it's an automatic for you, at least the information is shared 😄 |
Whoah! That is a good find. I guess I never thought about that (yay
This is a fixable problem. I'll update the test harness so that it explicitly sets the Thanks for taking the time to try and sharing the results. |
|
Using I tried to create a PR for this, excuse my novice OSS contribution knowledge: #936 |
No problem. Looks good for a simple change. Are you using Visual Studio, VS Code, or some other editor? I did notice a nitpick on the format spacing. I curious because the build is supposed to fail for violations and VS or VS Code should have been able to detect and apply a Quick Fix from |
VS Code, but i am not sure why the |
I believe VS Code has native |
Is there an existing issue for this?
Describe the bug
Adding
[AdvertiseApiVersions]
attribute to either Controller or Method causes stack overflow exception when enumarted.Because
AdvertiseApiVersionsAttribute.GetHashCode()
doesn't callbase.GetHashCode()
it causes a stackoverflow when enumerated. I.e when Swagger generates docs (Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateResponse
)AdvertiseApiVersionsAttribute
Expected Behavior
Adding
[AdvertiseApiVersions]
does not cause stack overflow when enumerated.Steps To Reproduce
Add
[AdvertiseApiVersions(3.0)]
attribute to a controllerV2/Controllers/OrdersController.cs
in your example (AspNetCore/OpenApiExample)Exceptions (if any)
If I completely misunderstand the reason for [AdvertiseApiVersions]
.NET Version
7.0.100
Anything else?
I was unable to get the FormatProviderTest to run locally, otherwise this would've been a PR 😢
The text was updated successfully, but these errors were encountered: