Skip to content

ASP0023 warning is incorrect #53333

Open
Open
@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


This code causes an ASP0023 warning on both [HttpGet("[action]")] statements. The warning is incorrect because the [action] route makes the two endpoints unique.

[ApiController]
[Route("v{version:apiVersion}/Test")]
[ApiVersion("1.0")]
[Authorize]
public class TestController : ControllerBase
{
	/// <summary> /v1/Test/SomeAction [GET] </summary>
	[HttpGet("[action]")]
	public IActionResult SomeAction()
	{
		return Ok();
	}

/// <summary> /v1/Test/AnotherAction [GET] </summary>
	[HttpGet("[action]")]
	public IActionResult AnotherAction()
	{
		return Ok();
	}
}

Original Comments

Feedback Bot on 1/7/2024, 09:34 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Author: Migration Bot 🤖The issue was created by a issue mover bot. The author may not be the actual author.analyzerIndicates an issue which is related to analyzer experiencearea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions