AV0006: Invalid API version month
| Value | |
|---|---|
| Rule ID | AV0006 |
| Category | Usage |
| Fix is | Breaking |
Cause
An API version expressed an invalid month.
Rule Description
When an API version is expressed as a date, the specified month must be valid.
Consider the following code:
[ApiController]
[ApiVersion(2026, 13, 1)]
[Route("[controller]")]
public class ExampleController : ControllerBase
{
[HttpGet]
public IActionResult Get() => Ok();
}
The month 13 is not a valid API version. The month must be between 1 and 12. This would not detected until runtime.
How to Fix Violations
Update the API version to be well-formed.
[ApiController]
[ApiVersion(2026, 1, 1)]
[Route("[controller]")]
public class ExampleController : ControllerBase
{
[HttpGet]
public IActionResult Get() => Ok();
}
When to Suppress Warnings
It is never safe to suppress this rule because a runtime exception will be thrown when the attribute is initialized.