Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AV0010: Unexpected API version format

Value
Rule IDAV0010
CategoryUsage
Fix isNon-breaking

Cause

An API version format specifier is unexpected.

Rule Description

When an API version is formatted, it must use a valid format specifier.

Consider the following code:

Console.WriteLine(new ApiVersion(2026, 1, 1).ToString("VVVVV"));

The format specifier V is only meaningful up to 4 times. Repeating it 5 times does not produce the expected result; the extra specifier is silently reinterpreted rather than reported. This would not be detected until runtime.

How to Fix Violations

Update the API version format so that the specifier is not repeated beyond its maximum.

Console.WriteLine(new ApiVersion(2026, 1, 1).ToString("VVVV"));

When to Suppress Warnings

It is never safe to suppress this rule. Incorrect or unexpected output will be generated.