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

AV0002: Invalid API version range

Value
Rule IDAV0002
CategoryUsage
Fix isBreaking

Cause

The specific API version range is invalid.

Rule Description

An API version range must express a valid interval notation.

Consider the following code:

public class Person
{
    public int Id { get; set; }

    public string FirstName { get; set; }

    [VisibleInApiVersion( ")2.0,]" )]
    public string MiddleName { get; set; }

    public string LastName { get; set; }
}

The text ")2.0,]" is not a valid API version range. This would not detected until runtime.

How to Fix Violations

Update the API version range to be well-formed.

public class Person
{
    public int Id { get; set; }

    public string FirstName { get; set; }

    [VisibleInApiVersion( "(2.0,]" )]
    public string MiddleName { get; set; }

    public string LastName { get; set; }
}

When to Suppress Warnings

It is never safe to suppress this rule because a runtime exception will be thrown when the text is parsed.