Compartilhar via


CandidateReason Enum

Definition

Indicates the reasons why a candidate (or set of candidate) symbols were not considered correct in SemanticInfo. Higher values take precedence over lower values, so if, for example, there a symbol with a given name that was inaccessible, and other with the wrong arity, only the inaccessible one would be reported in the SemanticInfo.

public enum class CandidateReason
public enum CandidateReason
type CandidateReason = 
Public Enum CandidateReason
Inheritance
CandidateReason

Fields

Ambiguous 15

Multiple ambiguous symbols were available with the same name. This can occur if "using" statements bring multiple namespaces into scope, and the same type is available in multiple. This can also occur if multiple properties of the same name are available in a multiple interface inheritance situation.

Inaccessible 8

The candidate symbol had an accessibility modifier (private, protected, ...) that made it inaccessible.

LateBound 14

Method could not be selected statically. The candidate symbols are the methods there were considered during overload resolution (which may or may not be applicable methods).

MemberGroup 16

CandidateSymbols are members of a group of results. This is used when there isn't a problem, but there is more than one result, for example nameof(int.ToString).

None 0

No CandidateSymbols.

NotAnAttributeType 4

Only an attribute type was valid in the given location, but the candidate symbol was of the wrong kind.

NotAnEvent 2

Only an event was valid in the given location, but the candidate symbols was of the wrong kind.

NotATypeOrNamespace 1

Only a type or namespace was valid in the given location, but the candidate symbols was of the wrong kind.

NotAValue 9

The candidate symbol was in a place where a value was required, but was not a value (e.g., was a type or namespace).

NotAVariable 10

The candidate symbol was in a place where a variable (or sometimes, a property) was required, but was not allowed there because it isn't a symbol that can be assigned to. For example, the left hand side of an assignment, or a ref or out parameter.

NotAWithEventsMember 3

The candidate symbol must be a WithEvents member, but it was not.

NotCreatable 6

The candidate symbol existed, but was not allowed to be created in a new expression. For example, interfaces, static classes, and unconstrained type parameters.

NotInvocable 11

The candidate symbol was used in a way that an invocable member (method, or variable of delegate type) was required, but the candidate symbol was not invocable.

NotReferencable 7

The candidate symbol existed, but was not allowed to be referenced. For example, the "get_XXX" method used to implement a property named "XXX" may not be directly referenced. Similarly, the type "System.Void" can not be directly referenced. Also occurs if "this" is used in a context (static method or field initializer) where "this" is not available.

OverloadResolutionFailure 13

Overload resolution did not choose a method. The candidate symbols are the methods there were considered during overload resolution (which may or may not be applicable methods).

StaticInstanceMismatch 12

The candidate symbol must be an instance variable, but was used as static, or the reverse.

WrongArity 5

The candidate symbol takes a different number of type parameters that was required.

Applies to