AV0002: Invalid API version range
| Value | |
|---|---|
| Rule ID | AV0002 |
| Category | Usage |
| Fix is | Breaking |
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.