Microsoft.CodeAnalysis.CSharp A Binder converts names in to symbols and syntax nodes into bound trees. It is context dependent, relative to a location in source code. This portion of the binder converts a AnonymousObjectCreationExpressionSyntax into a bound anonymous object creation node This portion of the binder converts an AwaitExpressionSyntax into a BoundExpression This portion of the binder converts deconstruction-assignment syntax (AssignmentExpressionSyntax nodes with the left being a tuple expression or declaration expression) into a BoundDeconstructionAssignmentOperator (or bad node). The BoundDeconstructionAssignmentOperator will have: - a BoundTupleLiteral as its Left, - a BoundConversion as its Right, holding: - a tree of Conversion objects with Kind=Deconstruction, information about a Deconstruct method (optional) and an array of nested Conversions (like a tuple conversion), - a BoundExpression as its Operand. This portion of the binder converts an into a . This portion of the binder converts an into a . This portion of the binder converts a QueryExpressionSyntax into a BoundExpression This portion of the binder reports errors arising from resolving queries. This portion of the binder converts StatementSyntax nodes into BoundStatements This portion of the binder converts a into a . Used to create a root binder. Get the next binder in which to look up a name, if not found by this binder. Get the next binder in which to look up a name, if not found by this binder, asserting if `Next` is null. if we are in an explicitly checked context (within checked block or expression). if we are in an explicitly unchecked context (within unchecked block or expression). otherwise. True if instructions that check overflow should be generated. Spec 7.5.12: For non-constant expressions (expressions that are evaluated at run-time) that are not enclosed by any checked or unchecked operators or statements, the default overflow checking context is unchecked unless external factors (such as compiler switches and execution environment configuration) call for checked evaluation. True if the compiler should check for overflow while evaluating constant expressions. Spec 7.5.12: For constant expressions (expressions that can be fully evaluated at compile-time), the default overflow checking context is always checked. Unless a constant expression is explicitly placed in an unchecked context, overflows that occur during the compile-time evaluation of the expression always cause compile-time errors. Some nodes have special binders for their contents (like Blocks) Gets a binder for a node that must be not null, and asserts if it is not. Get locals declared immediately in scope designated by the node. Get local functions declared immediately in scope designated by the node. If this binder owns a scope for locals, return syntax node that is used as the scope designator. Otherwise, null. True if this is the top-level binder for a local function or lambda (including implicit lambdas from query expressions). The member containing the binding context. Note that for the purposes of the compiler, a lambda expression is considered a "member" of its enclosing method, field, or lambda. Are we in a context where un-annotated types should be interpreted as non-null? Is the contained code within a member method body? May be false in lambdas that are outside of member method bodies, e.g. lambdas in field initializers. Is the contained code within an iterator block? Will be false in a lambda in an iterator. Is the contained code within the syntactic span of an iterator method? Will be true in a lambda in an iterator. If we are inside a context where a break statement is legal, returns the that a break statement would branch to. Returns null otherwise. If we are inside a context where a continue statement is legal, returns the that a continue statement would branch to. Returns null otherwise. Get the element type of this iterator. Element type of the current iterator, or an error type. The imports for all containing namespace declarations (innermost-to-outermost, including global), or null if there are none. Get that can be used to quickly check for certain attribute applications in context of this binder. The type containing the binding context Returns true if the binder is binding top-level script code. Issue an error or warning for a symbol if it is Obsolete. If there is not enough information to report diagnostics, then store the symbols so that diagnostics can be reported at a later stage. This method is introduced to move the implicit conversion operator call from the caller so as to reduce the caller stack frame size Issue an error or warning for a symbol if it is Obsolete. If there is not enough information to report diagnostics, then store the symbols so that diagnostics can be reported at a later stage. Report diagnostics that should be reported when using a synthesized attribute. Adds diagnostics that should be reported when using a synthesized attribute. Should only be used with scopes that could declare local functions. Follows the logic of and Follows the logic of Follows the logic of Follows the logic of Follows the logic of Follows the logic of Follows the logic of Follows the logic of Follows the logic of Follows the logic of Outside of checked, unchecked expression/block. Within unchecked expression/block. Within checked expression/block. We represent the set of query variables in scope at a particular point by a RangeVariableMap. Each query variable in scope has a key in this map. If the corresponding value is empty, then that query variable is represented directly by a lambda parameter. If it is non-empty, then to get the value of that query variable one starts with the first parameter of the current lambda (the first parameter is always the transparent one), and dot through its members using the names in the value list, in reverse order. So, for example, if the query variable "x" has a value in this map of ["Item2", "Item1", "Item1"], then the way to compute the value of that query variable is starting with the current lambda's first parameter P, compute "P.Item1.Item1.Item2". See also WithQueryLambdaParametersBinder. Expression capabilities and requirements. Expression can be an RHS of an assignment operation. The following are rvalues: values, variables, null literals, properties and indexers with getters, events. The following are not rvalues: namespaces, types, method groups, anonymous functions. Expression can be the LHS of a simple assignment operation. Example: property with a setter Expression represents a location. Often referred as a "variable" Examples: local variable, parameter, field Expression can be the LHS of a ref-assign operation. Example: ref local, ref parameter, out parameter, ref field Expression is the RHS of an assignment operation and may be a method group. Basically an RValue, but could be treated differently for the purpose of error reporting Expression can be an LHS of a compound assignment operation (such as +=). Expression can be the operand of an increment or decrement operation. Same as CompoundAssignment, the distinction is really just for error reporting. Expression is a r/o reference. Expression can be the operand of an address-of operation (&). Same as ReadonlyRef. The difference is just for error reporting. Expression is the receiver of a fixed buffer field access Same as ReadonlyRef. The difference is just for error reporting. Expression is passed as a ref or out parameter or assigned to a byref variable. Expression is returned by an ordinary r/w reference. Same as RefOrOut. The difference is just for error reporting. Check the expression is of the required lvalue and rvalue specified by valueKind. The method returns the original expression if the expression is of the required type. Otherwise, an appropriate error is added to the diagnostics bag and the method returns a BoundBadExpression node. The method returns the original expression without generating any error if the expression has errors. The purpose of this method is to determine if the expression satisfies desired capabilities. If it is not then this code gives an appropriate error message. To determine the appropriate error message we need to know two things: (1) What capabilities we need - increment it, assign, return as a readonly reference, . . . ? (2) Are we trying to determine if the left hand side of a dot is a variable in order to determine if the field or property on the right hand side of a dot is assignable? (3) The syntax of the expression that started the analysis. (for error reporting purposes). SPEC: When a property or indexer declared in a struct-type is the target of an SPEC: assignment, the instance expression associated with the property or indexer SPEC: access must be classified as a variable. If the instance expression is SPEC: classified as a value, a compile-time error occurs. Because of 7.6.4, SPEC: the same rule also applies to fields. NOTE: The spec fails to impose the restriction that the event receiver must be classified as a variable (unlike for properties - 7.17.1). This seems like a bug, but we have production code that won't build with the restriction in place (see DevDiv #15674). Checks if expression directly or indirectly represents a value with its own home. In such cases it is possible to get a reference without loading into a temporary. Special HasHome for fields. A field has a readable home unless the field is a constant. A ref readonly field doesn't have a writable home. Other fields have a writable home unless the field is a readonly value and is used outside of a constructor or init method. Actually, defines if an error ERR_AnonymousTypeNotAvailable is to be generated; Dev10 rules (which are based on BindingContext::InMethod()) are difficult to reproduce, so this implementation checks both current symbol as well as syntax nodes. Returns the type to be used as a field type; generates errors in case the type is not supported for anonymous type fields. The caller is responsible for freeing and . Gets the rewritten attribute constructor arguments, i.e. the arguments are in the order of parameters, which may differ from the source if named constructor arguments are used. For example: void Goo(int x, int y, int z, int w = 3); Goo(0, z: 2, y: 1); Arguments returned: 0, 1, 2, 3 Rewritten attribute constructor arguments Walk a custom attribute argument bound node and return a TypedConstant. Verify that the expression is a constant expression. Return true iff an await with this subexpression would be legal where the expression appears. Assuming we are in an async method, return true if we're in a context where await would be illegal. Specifically, return true if we're in a lock or catch filter. Reports an error if the await expression did not occur in an async context. True if the expression contains errors. Report diagnostics if the await expression occurs in a context where it is not allowed. True if errors were found. Finds and validates the required members of an awaitable expression, as described in spec 7.7.7.1. True if the expression is awaitable; false otherwise. Validates the awaited expression, returning true if no errors are found. Finds the GetAwaiter method of an awaitable expression. Spec 7.7.7.1: An awaitable expression t has an accessible instance or extension method called GetAwaiter with no parameters and no type parameters, and a return type A that meets the additional requirements for an Awaiter. NOTE: this is an error in the spec. An extension method of the form Awaiter<T> GetAwaiter<T>(this Task<T>) may be used. Finds the IsCompleted property of an Awaiter type. Spec 7.7.7.1: An Awaiter A has an accessible, readable instance property IsCompleted of type bool. Checks that the Awaiter implements System.Runtime.CompilerServices.INotifyCompletion. Spec 7.7.7.1: An Awaiter A implements the interface System.Runtime.CompilerServices.INotifyCompletion. Finds the GetResult method of an Awaiter type. Spec 7.7.7.1: An Awaiter A has an accessible instance method GetResult with no parameters and no type parameters. Return a collection of bound constraint clauses indexed by type parameter ordinal. All constraint clauses are bound, even if there are multiple constraints for the same type parameter, or constraints for unrecognized type parameters. Extra constraints are not included in the returned collection however. Bind and return a single type parameter constraint clause along with syntax nodes corresponding to type constraints. Constraints are checked for invalid types, duplicate types, and accessibility. Returns true if the constraint is valid. Otherwise returns false and generates a diagnostic. If the element is from a collection type where elements are added with collection initializers, return the argument to the collection initializer Add method or null if the element is not a collection initializer node. Otherwise, return the element as is. Rewrite the subexpressions in a conditional expression to convert the whole thing to the destination type. Rewrite the expressions in the switch expression arms to add a conversion to the destination type. This method implements the algorithm in spec section 7.6.5.1. For method group conversions, there are situations in which the conversion is considered to exist ("Otherwise the algorithm produces a single best method M having the same number of parameters as D and the conversion is considered to exist"), but application of the conversion fails. These are the "final validation" steps of overload resolution. True if there is any error, except lack of runtime support errors. Performs the following checks: Spec 7.6.5: Invocation expressions (definition of Final Validation) The method is validated in the context of the method group: If the best method is a static method, the method group must have resulted from a simple-name or a member-access through a type. If the best method is an instance method, the method group must have resulted from a simple-name, a member-access through a variable or value, or a base-access. If neither of these requirements is true, a binding-time error occurs. (Note that the spec omits to mention, in the case of an instance method invoked through a simple name, that the invocation must appear within the body of an instance method) Spec 7.5.4: Compile-time checking of dynamic overload resolution If F is a static method, the method group must have resulted from a simple-name, a member-access through a type, or a member-access whose receiver can't be classified as a type or value until after overload resolution (see §7.6.4.1). If F is an instance method, the method group must have resulted from a simple-name, a member-access through a variable or value, or a member-access whose receiver can't be classified as a type or value until after overload resolution (see §7.6.4.1). True if there is any error. Was the receiver expression compiler-generated? This method implements the checks in spec section 15.2. This method combines final validation (section 7.6.5.1) and delegate compatibility (section 15.2). CSharpSyntaxNode of the expression requiring method group conversion. Conversion to be performed. Optional receiver. Method invoked as extension method. Target delegate type. Where diagnostics should be added. True if a diagnostic has been added. This method is a wrapper around MethodGroupConversionHasErrors. As a preliminary step, it checks whether a conversion exists. We can't use BindNamespaceOrTypeSymbol, since it doesn't return inaccessible symbols (directly). Guaranteed not to return null. CONSIDER: As in dev11, we don't handle ambiguity at this level. Hypothetically, we could just pick one, though an "ideal" solution would probably involve a search down all ambiguous branches. Perform lookup (optionally, in a specified container). If nothing is found and the member name matches the containing type name, then use the instance constructors of the type instead. The resulting symbols are sorted since tie-breaking is based on order and we want cref binding to be repeatable. Never returns null. Given a list of viable lookup results (based on the name, arity, and containing symbol), attempt to select one. At this point, we have a list of viable symbols and no parameter list with which to perform overload resolution. We'll just return the first symbol, giving a diagnostic if there are others. Caveat: If there are multiple candidates and only one is from source, then the source symbol wins and no diagnostic is reported. Replace any named type in the symbol list with its instance constructors. Construct all candidates with the implicitly-declared CrefTypeParameterSymbols. Given a list of method and/or property candidates, choose the first one (if any) with a signature that matches the parameter list in the cref. Return null if there isn't one. Produces a diagnostic for ambiguous matches, but not for unresolved members - WRN_BadXMLRef is handled in BindMemberCref. If the member is generic, construct it with the CrefTypeParameterSymbols that should be in scope. Keep in sync with CSharpSemanticModel.GetSpeculativelyBoundExpressionWithoutNullability. Bind a deconstruction assignment. The deconstruction operation The left (tuple) operand The right (deconstructable) operand Where to report diagnostics A variable set to the first variable declaration found in the left A variable set to the first expression in the left that isn't a declaration or discard The expression evaluator needs to bind deconstructions (both assignments and declarations) as expression-statements and still access the returned value When boundRHS is a tuple literal, fix it up by inferring its types. Recursively builds a Conversion object with Kind=Deconstruction including information about any necessary Deconstruct method and any element-wise conversion. Note that the variables may either be plain or nested variables. The variables may be updated with inferred types if they didn't have types initially. Returns false if there was an error. Inform the variables about found types. Find any deconstruction locals that are still pending inference and fail their inference. Set the safe-to-escape scope for all deconstruction locals. Holds the variables on the LHS of a deconstruction as a tree of bound expressions. For cases where the RHS of a deconstruction-declaration is a tuple literal, we merge type information from both the LHS and RHS. For cases where the RHS of a deconstruction-assignment is a tuple literal, the type information from the LHS determines the merged type, since all variables have a type. Returns null if a merged tuple type could not be fabricated. Extract inferred name from a single deconstruction variable. Find the Deconstruct method for the expression on the right, that will fit the number of assignable variables on the left. Returns an invocation expression if the Deconstruct method is found. If so, it outputs placeholders that were coerced to the output types of the resolved Deconstruct method. The overload resolution is similar to writing receiver.Deconstruct(out var x1, out var x2, ...). Prepares locals (or fields in global statement) and lvalue expressions corresponding to the variables of the declaration. The locals/fields/lvalues are kept in a tree which captures the nesting of variables. Each local or field is either a simple local or field access (when its type is known) or a deconstruction variable pending inference. The caller is responsible for releasing the nested ArrayBuilders. In embedded statements, returns a BoundLocal when the type was explicit. In global statements, returns a BoundFieldAccess when the type was explicit. Otherwise returns a DeconstructionVariablePendingInference when the type is implicit. Determines whether "this" reference is available within the current context. The reference was explicitly specified in syntax. True if "this" is not available due to the current method/property/field initializer being static. True if a reference to "this" is available. Returns true if the node is in a position where an unbound type such as (C<,>) is allowed. Generates a new with no known type Generates a new with no known type, and the given bound child. Generates a new with no known type, and the given bound children. Generates a new with no known type, given lookup resultKind. Generates a new with no known type, given lookup resultKind and the given bound child. Generates a new with no known type, given lookupResultKind and given symbols for GetSemanticInfo API. Generates a new with no known type, given lookupResultKind and given symbols for GetSemanticInfo API, and the given bound child. Generates a new with no known type, given lookupResultKind and given symbols for GetSemanticInfo API, and the given bound children. Helper method to generate a bound expression with HasErrors set to true. Returned bound expression is guaranteed to have a non-null type, except when is an unbound lambda. If already has errors and meets the above type requirements, then it is returned unchanged. Otherwise, if is a BoundBadExpression, then it is updated with the and non-null type. Otherwise, a new wrapping is returned. The returned expression has not been converted if needed, so callers need to make sure that the expression is converted before being put into the bound tree. Make sure to test with unconverted constructs such as switch expressions, target-typed new, or interpolated strings. Returned expression need not be a , but is guaranteed to have HasErrors set to true. Bind the expression and verify the expression matches the combination of lvalue and rvalue requirements given by valueKind. If the expression was bound successfully, but did not meet the requirements, the return value will be a that (typically) wraps the subexpression. When binding a switch case's expression, it is possible that it resolves to a type (technically, a type pattern). This implementation permits either an rvalue or a BoundTypeExpression. Bind an rvalue expression to its natural type. For example, a switch expression that has not been converted to another type has to be converted to its own natural type by applying a conversion to that type to each of the arms of the switch expression. This method is a bottleneck for ensuring that such a conversion occurs when needed. It also handles tuple expressions which need to be converted to their own natural type because they may contain switch expressions. Bind a declaration variable where it isn't permitted. The caller is expected to produce a diagnostic. Removes duplicate entries in and frees it if only nulls remain. This can be reached for the qualified name on the right-hand-side of an `is` operator. For compatibility we parse it as a qualified name, as the is-type expression only permitted a type on the right-hand-side in C# 6. But the same syntax now, in C# 7 and later, can refer to a constant, which would normally be represented as a *simple member access expression*. Since the parser cannot distinguish, it parses it as before and depends on the binder to handle a qualified name appearing as an expression. Called when an "attribute-dependent" type such as 'dynamic', 'string?', etc. is not permitted. true if managed type-related errors were found, otherwise false. true if managed type-related errors were found, otherwise false. Binds a simple identifier. Is this is an _ identifier in a context where discards are allowed? This implements the casting behavior described in section 6.2.3 of the spec: - If the nullable conversion is from S to T?, the conversion is evaluated as the underlying conversion from S to T followed by a wrapping from T to T?. This particular check is done in the binder because it involves conversion processing rules (like overflow checking and constant folding) which are not handled by Conversions. Gets the NameSyntax associated with the syntax node If no syntax is attached it sets the nameString to plain text name and returns a null NameSyntax Syntax node Plain text name Gets the plain text name associated with the expression syntax node Expression syntax node Plain text name Reports an error when a bad special by-ref local was found. Bind argument and verify argument matches rvalue or out param requirements. This method walks through the array's InitializerExpressionSyntax and binds all the initializer expressions recursively. NOTE: It doesn't convert the bound initializer expressions to array's element type. NOTE: This is done separately in ConvertAndBindArrayInitialization method below. Initializer Syntax. Bound expression builder. Diagnostics. Current array dimension being processed. Rank of the array type. Given an array of bound initializer expressions, this method converts these bound expressions to array's element type and generates a BoundArrayInitialization with the converted initializers. Diagnostics. Initializer Syntax. Array type. Known array bounds. Current array dimension being processed. Array of bound initializer expressions. Index into the array of bound initializer expressions to fetch the next bound expression. Bind the (implicit or explicit) constructor initializer of a constructor symbol (in source). Null for implicit, , or for explicit. Constructor containing the initializer. Accumulates errors (e.g. unable to find constructor to invoke). A bound expression for the constructor initializer call. This method should be kept consistent with Compiler.BindConstructorInitializer (e.g. same error codes). Helper method to create a synthesized constructor invocation. Shouldn't be null if is not null. Given the type containing constructors, gets the list of candidate instance constructors and uses overload resolution to determine which one should be called. The containing type of the constructors. The already bound arguments to the constructor. The name to use in diagnostics if overload resolution fails. The location at which to report overload resolution result diagnostics. True to suppress overload resolution result diagnostics (but not argument diagnostics). Where diagnostics will be reported. If this method returns true, then it will contain a valid MethodResolutionResult. Otherwise, it may contain a MethodResolutionResult for an inaccessible constructor (in which case, it will incorrectly indicate success) or nothing at all. Candidate instance constructors of type used for overload resolution. It is always legal to access a protected base class constructor via a constructor initializer, but not from an object creation expression. True if overload resolution successfully chose an accessible constructor. The two-pass algorithm (accessible constructors, then all constructors) is the reason for the unusual signature of this method (i.e. not populating a pre-existing ). Presently, rationalizing this behavior is not worthwhile. Binds a member access expression Attempt to bind the LHS of a member access expression. If this is a Color Color case (spec 7.6.4.1), then return a BoundExpression if we can easily disambiguate or a BoundTypeOrValueExpression if we cannot. If this is not a Color Color case, then return null. Bind the RHS of a member access expression, given the bound LHS. It is assumed that CheckValue has not been called on the LHS. If new checks are added to this method, they will also need to be added to . Create a value from the expression that can be used as a left-hand-side of a member access. This method special-cases method and property groups only. All other expressions are returned as is. Report the error from member access lookup. Or, if there was no explicit error from lookup, report "no such member". Return true if the given type is or implements a WinRTAsyncInterface. Return a BoundExpression representing the invalid member. Combine the receiver and arguments of an extension method invocation into a single argument list to allow overload resolution to treat the invocation as a static method invocation with no receiver. Binds a static or instance member access. Given a viable LookupResult, report any ambiguity errors and return either a single non-method symbol or a method or property group. If the result set represents a collection of methods or a collection of properties where at least one of the properties is an indexed property, then 'methodOrPropertyGroup' is populated with the method or property group and the method returns null. Otherwise, the method returns a single symbol and 'methodOrPropertyGroup' is empty. (Since the result set is viable, there must be at least one symbol.) If the result set is ambiguous - either containing multiple members of different member types, or multiple properties but no indexed properties - then a diagnostic is reported for the ambiguity and a single symbol is returned. Finds pattern-based implicit indexer and Length/Count property. Perform lookup and overload resolution on methods defined directly on the class and any extension methods in scope. Lookup will occur for extension methods in all nested scopes as necessary until an appropriate method is found. If analyzedArguments is null, the first method group is returned, without overload resolution being performed. That method group will either be the methods defined on the receiver class directly (no extension methods) or the first set of extension methods. The node associated with the method group The arguments of the invocation (or the delegate type, if a method group conversion) If a method group conversion, the desired ref kind of the delegate If a method group conversion, the desired return type of the delegate. May be null during inference if the return type of the delegate needs to be computed. Returns one of the methods from the method group if all methods in the method group have the same signature, ignoring parameter names and custom modifiers. The particular method returned is not important since the caller is interested in the signature only. For C# 13 onwards, returns one of the methods from the method group if all instance methods, or extension methods in the nearest scope, have the same signature ignoring parameter names and custom modifiers. The particular method returned is not important since the caller is interested in the signature only. Represents a small change from the enclosing/next binder. Can specify a BindingLocation and a ContainingMemberOrLambda. Represents a small change from the enclosing/next binder. Can specify a receiver Expression for containing conditional member access. It seems to be common to do both of these things at once, so provide a way to do so without adding two links to the binder chain. In regular C#, all field initializers are assignments to fields and the assigned expressions may not reference instance members. In script C#, some field initializers are assignments to fields and others are global statements. There are no restrictions on accessing instance members. Helper method to create a synthesized method invocation expression. Syntax Node. Receiver for the method call. Method to be invoked on the receiver. Arguments to the method call. Diagnostics. Optional type arguments syntax. Optional type arguments. The syntax for the query clause generating this invocation expression, if any. True to allow invocation of fields and properties of delegate type. Only methods are allowed otherwise. True to prevent selecting a params method in unexpanded form. Synthesized method invocation expression. Bind an expression as a method invocation. Bind an expression as a method invocation. Perform overload resolution on the method group or expression (BoundMethodGroup) and arguments and return a BoundExpression representing the invocation. Invocation syntax node. The syntax for the invoked method, including receiver. Name of the invoked method. Overload resolution result for method group executed by caller. Arguments bound by the caller. Method group if the invocation represents a potentially overloaded member. Delegate type if method group represents a delegate. Diagnostics. The syntax for the query clause generating this invocation expression, if any. BoundCall or error expression representing the invocation. Returns false if an implicit 'this' copy will occur due to an instance member invocation in a readonly member. Invocation syntax node. The syntax for the invoked method, including receiver. Replace a BoundTypeOrValueExpression with a BoundExpression for either a type (if useType is true) or a value (if useType is false). Any other node is bound to its natural type. Call this once overload resolution has succeeded on the method group of which the BoundTypeOrValueExpression is the receiver. Generally, useType will be true if the chosen method is static and false otherwise. Return the delegate type if this expression represents a delegate. Compute the type of the corresponding parameter, if any. This is used to improve error recovery, for bad invocations, not for semantic analysis of correct invocations, so it is a heuristic. If no parameter appears to correspond to the given argument, we return null. The analyzed argument list The index of the argument The parameter list to match against The type of the corresponding parameter. Absent parameter types to bind the arguments, we simply use the arguments provided for error recovery. Returns true if syntax form is OK (so no errors were reported) Helper method that checks whether there is an invocable 'nameof' in scope. Performs name lookup for simple generic or non-generic name within an optional qualifier namespace or type symbol. If LookupOption.AttributeTypeOnly is set, then it performs attribute type lookup which involves attribute name lookup with and without "Attribute" suffix. Look for any symbols in scope with the given name and arity. Makes a second attempt if the results are not viable, in order to produce more detailed failure information (symbols and diagnostics). If qualifierOpt is null, look for any symbols in scope with the given name and arity. Otherwise look for symbols that are members of the specified qualifierOpt. Look for symbols that are members of the specified namespace or type. Lookup a member name in a submission chain. We start with the current submission class and walk the submission chain back to the first submission. The search has two phases 1) We are looking for any symbol matching the given name, arity, and options. If we don't find any the search is over. If we find and overloadable symbol(s) (a method or an indexer) we start looking for overloads of this kind (lookingForOverloadsOfKind) of symbol in phase 2. 2) If a visited submission contains a matching member of a kind different from lookingForOverloadsOfKind we stop looking further. Otherwise, if we find viable overload(s) we add them into the result. Note that indexers are not supported in script but we deal with them here to handle errors. Lookup extension methods by name and arity in the given binder and check viability in this binder. The lookup is performed on a single binder because extension method search stops at the first applicable method group from the nearest enclosing namespace. Lookup attribute name in the given binder. By default two name lookups are performed: (1) With the provided name (2) With an Attribute suffix added to the provided name Lookup with Attribute suffix is performed only if LookupOptions.VerbatimAttributeName is not set. If either lookup is ambiguous, we return the corresponding result with ambiguous symbols. Else if exactly one result is single viable attribute type, we return that result. Otherwise, we return a non-viable result with LookupResult.NotAnAttributeType or an empty result. Return the extension methods from this specific binding scope that match the name and optional arity. Since the lookup of extension methods is iterative, proceeding one binding scope at a time, GetCandidateExtensionMethods should not defer to the next binding scope. Instead, the caller is responsible for walking the nested binding scopes from innermost to outermost. This method is overridden to search the available members list in binding types that represent types, namespaces, and usings. If the type implements one of a select few WinRT interfaces, the interface type is projected to the CLR collection type (e.g., IVector to IList). When importing a winmd type it may implement one or more winmd collection interfaces. When the collection interfaces are projected, we may need to add the projected members to the imported type so that calls to those members succeed as normal. This method adds the interface methods to the lookup, if necessary. The CLR understands that a call to the .NET interface should be projected onto the WinRT interface method. This helper is used to determine whether this symbol hides / is hidden based on its signature, as opposed to its name. CONSIDER: It might be nice to generalize this - maybe an extension method on Symbol (e.g. IsOverloadable or HidesByName). Distinguish from , which performs an analogous task for Add*LookupSymbolsInfo*. Used by Add*LookupSymbolsInfo* to determine whether the symbol is of interest. Distinguish from , which performs an analogous task for LookupSymbols*. Does not consider - that is left to the caller. A symbol is accessible for referencing in a cref if it is in the same assembly as the reference or the symbols's effective visibility is not private. Check whether "symbol" is accessible from this binder. Also checks protected access via "accessThroughType". Check whether "symbol" is accessible from this binder. Also checks protected access via "accessThroughType", and sets "failedThroughTypeCheck" if fails the protected access check. Should only be called by , which will already have checked for . Look for names in scope Look for names of members Don't call this one directly - call one of the helpers. For "receiver.event += expr", produce "receiver.add_event(expr)". For "receiver.event -= expr", produce "receiver.remove_event(expr)". Performs some validation of the accessor that couldn't be done in CheckEventValueKind, because the specific accessor wasn't known. If one of the (unconverted) operands has constant value null and the other has a null constant value other than null, then they are definitely not equal and we can give a constant value for either == or !=. This is a spec violation that we retain from Dev10. The operator kind. Nothing will happen if it is not a lifted equality operator. The left-hand operand of the operation (possibly wrapped in a conversion). The right-hand operand of the operation (possibly wrapped in a conversion). If the operator represents lifted equality, then constant value true if both arguments have constant value null, constant value false if exactly one argument has constant value null, and null otherwise. If the operator represents lifted inequality, then constant value false if both arguments have constant value null, constant value true if exactly one argument has constant value null, and null otherwise. SPEC VIOLATION: according to the spec (section 7.19) constant expressions cannot include implicit nullable conversions or nullable subexpressions. However, Dev10 specifically folds over lifted == and != (see ExpressionBinder::TryFoldingNullableEquality). Dev 10 does do compile-time evaluation of simple lifted operators, but it does so in a rewriting pass (see NullableRewriter) - they are not treated as constant values. Returns ConstantValue.Bad if, and only if, the resulting string length exceeds . Returns false if reported an error, true otherwise. Checks to see whether an expression is a "moveable" variable according to the spec. Moveable variables have underlying memory which may be moved by the runtime. The spec defines anything not fixed as moveable and specifies the expressions which are fixed. Possible return values: - - - - compiler doesn't support the type check, i.e. cannot perform it, even at runtime - 'null' value - result is not known at compile time Possible return values: - - - compiler doesn't support the type check, i.e. cannot perform it, even at runtime - 'null' value - result is not known at compile time From ExpressionBinder::EnsureQMarkTypesCompatible: The v2.0 specification states that the types of the second and third operands T and S of a conditional operator must be TT and TS such that either (a) TT==TS, or (b), TT->TS or TS->TT but not both. Unfortunately that is not what we implemented in v2.0. Instead, we implemented that either (a) TT=TS or (b) T->TS or S->TT but not both. That is, we looked at the convertibility of the expressions, not the types. Changing that to the algorithm in the standard would be a breaking change. b ? (Func<int>)(delegate(){return 1;}) : (delegate(){return 2;}) and b ? 0 : myenum would suddenly stop working. (The first because o2 has no type, the second because 0 goes to any enum but enum doesn't go to int.) It gets worse. We would like the 3.0 language features which require type inference to use a consistent algorithm, and that furthermore, the algorithm be smart about choosing the best of a set of types. However, the language committee has decided that this algorithm will NOT consume information about the convertibility of expressions. Rather, it will gather up all the possible types and then pick the "largest" of them. To maintain backwards compatibility while still participating in the spirit of consistency, we implement an algorithm here which picks the type based on expression convertibility, but if there is a conflict, then it chooses the larger type rather than producing a type error. This means that b?0:myshort will have type int rather than producing an error (because 0->short, myshort->int). Constant folding for conditional (aka ternary) operators. Types which list-patterns can be used on (ie. countable and indexable ones) are assumed to have non-negative lengths. Binds the expression for a pattern. Sets if it was a type rather than an expression, and in that case it returns a . Binds the expression for an is-type right-hand-side, in case it does not bind as a type. Check that the pattern type is valid for the operand. Return true if an error was reported. Does an expression of type "match" a pattern that looks for type ? - if the matched type catches all of them - if it catches none of them - - compiler doesn't support the type check, i.e. cannot perform it, even at runtime - 'null' if it might catch some of them. Check that the given name designates a tuple element at the given index, and return that element. Compute the type code for the comparison operator to be used. When comparing `byte`s for example, the compiler actually uses the operator on the type `int` as there is no corresponding operator for the type `byte`. This is a clone of the Dev10 logic for reporting query errors. This is the set of parameters and local variables that were used as arguments to lock or using statements in enclosing scopes. using (x) { } // x counts using (IDisposable y = null) { } // y does not count Noteworthy override is in MemberSemanticModel.IncrementalBinder (used for caching). Report an error if this is an awaitable async method invocation that is not being awaited. The checks here are equivalent to StatementBinder::CheckForUnobservedAwaitable() in the native compiler. Checks for a Dispose method on and returns its if found. Expression on which to perform lookup The syntax node to perform lookup on Populated with invocation errors, and warnings of near misses The of the Dispose method if one is found, otherwise null. Wrap the initializer in a BoundFixedLocalCollectionInitializer so that the rewriter will have the information it needs (e.g. conversions, helper methods). There are two BadEventUsage error codes and this method decides which one should be used for a given event. Like BindForEachParts, but only bind the deconstruction part of the foreach, for purpose of inferring the types of the declared locals. Wrap a given expression e into a block as either { e; } or { return e; } Shared between lambda and expression-bodied method binding. Binds an expression-bodied member with expression e as either { return e; } or { e; }. Binds a lambda with expression e as either { return e; } or { e; }. Bind the implicit constructor initializer of a constructor symbol. Constructor method. Accumulates errors (e.g. access "this" in constructor initializer). Used to retrieve binder. A bound expression for the constructor initializer call. If this binder owns the scope that can declare extern aliases, a set of declared aliases should be returned (even if empty). Otherwise, a default instance should be returned. If this binder owns the scope that can declare using aliases, a set of declared aliases should be returned (even if empty). Otherwise, a default instance should be returned. Note, only aliases syntactically declared within the enclosing declaration are included. For example, global aliases declared in a different compilation units are not included. Perform a lookup for the specified method on the specified expression by attempting to invoke it The expression to perform pattern lookup on Method to search for. The expression for which lookup is being performed Populated with binding diagnostics. The method symbol that was looked up, or null A value with the outcome of the lookup Binds the type for the syntax taking into account possibility of "var" type. Type syntax to bind. Diagnostics. Set to false if syntax binds to a type in the current context and true if syntax is "var" and it binds to "var" keyword in the current context. Bound type if syntax binds to a type in the current context and null if syntax binds to "var" keyword in the current context. Binds the type for the syntax taking into account possibility of "unmanaged" type. Type syntax to bind. Diagnostics. Set to if syntax binds to a type in the current context, otherwise syntax binds to the corresponding keyword in the current context. Bound type if syntax binds to a type in the current context and null if syntax binds to a contextual constraint keyword. Binds the type for the syntax taking into account possibility of "var" type. Type syntax to bind. Diagnostics. Set to false if syntax binds to a type in the current context and true if syntax is "var" and it binds to "var" keyword in the current context. Alias symbol if syntax binds to an alias. Bound type if syntax binds to a type in the current context and null if syntax binds to "var" keyword in the current context. Binds the type for the syntax taking into account possibility of "var" type. If the syntax binds to an alias symbol to a type, it returns the alias symbol. Type syntax to bind. Diagnostics. Set to false if syntax binds to a type or alias to a type in the current context and true if syntax is "var" and it binds to "var" keyword in the current context. Bound type or alias if syntax binds to a type or alias to a type in the current context and null if syntax binds to "var" keyword in the current context. Binds the type for the syntax taking into account possibility of the type being a keyword. If the syntax binds to an alias symbol to a type, it returns the alias symbol. PREREQUISITE: syntax should be checked to match the keyword, like or . Otherwise, call instead. The immediately containing namespace or named type, or the global namespace if containing symbol is neither a namespace or named type. This method is used in deeply recursive parts of the compiler and requires a non-trivial amount of stack space to execute. Preventing inlining here to keep recursive frames small. Bind the syntax into a namespace, type or alias symbol. This method is used in deeply recursive parts of the compiler. Specifically this and are mutually recursive. The non-recursive parts of this method tend to reserve significantly large stack frames due to their use of large struct like . To keep the stack frame size on recursive paths small the non-recursive parts are factored into local functions. This means we pay their stack penalty only when they are used. They are themselves big enough they should be disqualified from inlining. In the future when attributes are allowed on local functions we should explicitly mark them as Binds a simple name or the simple name portion of a qualified name. If the node is "nint" or "nuint" and not alone inside nameof, return the corresponding native integer symbol. Otherwise return null. Keep check and error in sync with ConstructBoundMethodGroupAndReportOmittedTypeArguments. Keep check and error in sync with ConstructNamedTypeUnlessTypeArgumentOmitted. Check generic type constraints unless the type is used as part of a type or method declaration. In those cases, constraints checking is handled by the caller. This is a layer on top of the Compilation version that generates a diagnostic if the special member isn't found. Reports use-site diagnostics and dependencies for the specified symbol. True if there was an error among the reported diagnostics Reports use-site diagnostics and dependencies for the specified symbol. True if there was an error among the reported diagnostics This is a layer on top of the Compilation version that generates a diagnostic if the well-known type isn't found. This is a layer on top of the Compilation version that generates a diagnostic if the well-known type isn't found. This is a layer on top of the Compilation version that generates a diagnostic if the well-known type isn't found. This is a layer on top of the Compilation version that generates a diagnostic if the well-known type isn't found. Retrieves a well-known type member and reports diagnostics. Null if the symbol is missing. Returns -1 if None. Prefers symbols from source module, then from added modules, then from referenced assemblies. Returns true if values were swapped. Returns true if the second is a better location than the first. Prefer symbols from source module, then from added modules, then from referenced assemblies. This is only intended to be called when the type isn't found (i.e. not when it is found but is inaccessible, has the wrong arity, etc). Look for a type forwarder for the given type in the containing assembly and any referenced assemblies. The name of the (potentially) forwarded type. The arity of the forwarded type. The namespace of the potentially forwarded type. If none is provided, will try Usings of the current import for eligible namespaces and return the namespace of the found forwarder, if any. Will be used to report non-fatal errors during look up. Location to report errors on. Returns the Assembly to which the type is forwarded, or null if none is found. Since this method is intended to be used for error reporting, it stops as soon as it finds any type forwarder (or an error to report). It does not check other assemblies for consistency or better results. Callback function that computes the location to report the diagnostics at if a diagnostic should be reported. Should always be passed a static/cached callback to prevent allocations of the delegate. If the left and right are tuples of matching cardinality, we'll try to bind the operator element-wise. When that succeeds, the element-wise conversions are collected. We keep them for semantic model. The element-wise binary operators are collected and stored as a tree for lowering. Binds: 1. dynamically, if either side is dynamic 2. as tuple binary operator, if both sides are tuples of matching cardinalities 3. as regular binary operator otherwise If an element-wise binary operator returns a non-bool type, we will either: - prepare a conversion to bool if one exists - prepare a truth operator: op_false in the case of an equality (a == b will be lowered to !((a == b).op_false)) or op_true in the case of inequality, with the conversion being used for its input. If an element in a tuple literal has an explicit name which doesn't match the name on the other side, we'll warn. The user can either remove the name, or fix it. This method handles two expressions, each of which is either a tuple literal or an expression with tuple type. In a tuple literal, each element can have an explicit name, an inferred name or no name. In an expression of tuple type, each element can have a name or not. Given a tuple literal or expression, we'll get two arrays: - the elements from the literal, or some placeholder with proper type (for tuple expressions) - the elements' names Make a tuple type (with appropriate nesting) from the types (on the left or on the right) collected from binding element-wise binary operators. If any of the elements is typeless, then the tuple is typeless too. True if we are currently in an unsafe region (type, member, or block). Does not imply that this compilation allows unsafe regions (could be in an error recovery scenario). To determine that, check this.Compilation.Options.AllowUnsafe. True if a diagnostic was reported True if a diagnostic was reported The spec describes an algorithm for finding the following types: 1) Collection type 2) Enumerator type 3) Element type The implementation details are a bit different. If we're iterating over a string or an array, then we don't need to record anything but the inferredType (in case the iteration variable is implicitly typed). If we're iterating over anything else, then we want the inferred type plus a ForEachEnumeratorInfo.Builder with: 1) Collection type 2) Element type 3) GetEnumerator (or GetAsyncEnumerator) method of the collection type (return type will be the enumerator type from the spec) 4) Current property and MoveNext (or MoveNextAsync) method of the enumerator type The caller will have to do some extra conversion checks before creating a ForEachEnumeratorInfo for the BoundForEachStatement. Builder to fill in (partially, all but conversions). The expression over which to iterate. Populated with binding diagnostics. Partially populated (all but conversions) or null if there was an error. Check for a GetEnumerator (or GetAsyncEnumerator) method on collectionExprType. Failing to satisfy the pattern is not an error - it just means that we have to check for an interface instead. Expression over which to iterate. Populated with *warnings* if there are near misses. Builder to fill in. set if the pattern in satisfied. True if the method was found (still have to verify that the return (i.e. enumerator) type is acceptable). Only adds warnings, so does not affect control flow (i.e. no need to check for failure). Perform a lookup for the specified method on the specified type. Perform overload resolution on the lookup results. Type to search. Method to search for. Passed in for reusability. True if failures should result in warnings; false if they should result in errors. Populated with binding diagnostics. The desired method or null. The overload resolution portion of FindForEachPatternMethod. If no arguments are passed in, then an empty argument list will be used. Called after it is determined that the expression being enumerated is of a type that has a GetEnumerator (or GetAsyncEnumerator) method. Checks to see if the return type of the GetEnumerator method is suitable (i.e. has Current and MoveNext for regular case, or Current and MoveNextAsync for async case). Must be non-null and contain a non-null GetEnumeratorMethod. Will be populated with pattern diagnostics. True if the return type has suitable members. It seems that every failure path reports the same diagnostics, so that is left to the caller. Checks if the given type implements (or extends, in the case of an interface), System.Collections.IEnumerable or System.Collections.Generic.IEnumerable<T>, (or System.Collections.Generic.IAsyncEnumerable<T>) for at least one T. builder to fill in CollectionType. Type to check. True if multiple T's are found. True if some IEnumerable is found (may still be ambiguous). Report appropriate diagnostics when lookup of a pattern member (i.e. GetEnumerator, Current, or MoveNext) fails. Failed lookup result. Type in which member was looked up. Name of looked up member. True if failures should result in warnings; false if they should result in errors. Populated appropriately. If method is an extension method, this must be non-null. Encapsulates a symbol used in ref safety analysis. For properties and indexers this captures the accessor(s) on it that were used. The particular accessor used is important as it can impact ref safety analysis. This is the primary used in ref safety analysis. This will be null in error scenarios. For example when an indexer with only a set method is used in a get scenario. That will lead to a non-null but a null value here. In the case of a compound operation on non-ref return property or indexer will represent the `get` accessor and this will represent the `set` accessor. The destination in a method arguments must match (MAMM) check. This is created primarily for ref and out arguments of a ref struct. It also applies to function pointer this and arglist arguments. In the case this is the argument for a ref / out parameter this will refer to the corresponding parameter. This will be null in cases like arguments passed to an arglist. This destination can only be written to by arguments that have an equal or wider escape level. An destination that is can never be written to by an argument that has a level of . Represents an argument being analyzed for escape analysis purposes. This represents the argument as written. For example a `ref x` will only be represented by a single . This will be null in cases like arglist or a function pointer receiver. Represents a value being analyzed for escape analysis purposes. This represents the value as it contributes to escape analysis which means arguments can show up multiple times. For example `ref x` will be represented as both a val and ref escape. This will be null in cases like arglist or a function pointer receiver. This is _only_ useful when calculating MAMM as it dictates to what level the value escaped to. That allows it to be filtered against the parameters it could possibly write to. For the purpose of escape verification we operate with the depth of local scopes. The depth is a uint, with smaller number representing shallower/wider scopes. 0, 1 and 2 are special scopes - 0 is the "calling method" scope that is outside of the containing method/lambda. If something can escape to scope 0, it can escape to any scope in a given method through a ref parameter or return. 1 is the "return-only" scope that is outside of the containing method/lambda. If something can escape to scope 1, it can escape to any scope in a given method or can be returned, but it can't escape through a ref parameter. 2 is the "current method" scope that is just inside the containing method/lambda. If something can escape to scope 1, it can escape to any scope in a given method, but cannot be returned. n + 1 corresponds to scopes immediately inside a scope of depth n. Since sibling scopes do not intersect and a value cannot escape from one to another without escaping to a wider scope, we can use simple depth numbering without ambiguity. Generally these values are expressed via the following parameters: - escapeFrom: the scope in which an expression is being evaluated. Usually the current local scope - escapeTo: the scope to which the values are being escaped to. Computes the scope to which the given invocation can escape NOTE: the escape scope for ref and val escapes is the same for invocations except for trivial cases (ordinary type returned by val) where escape is known otherwise. Therefore we do not have two ref/val variants of this. NOTE: we need scopeOfTheContainingExpression as some expressions such as optional in parameters or ref dynamic behave as local variables declared at the scope of the invocation. Validates whether given invocation can allow its results to escape from level to level. The result indicates whether the escape is possible. Additionally, the method emits diagnostics (possibly more than one, recursively) that would help identify the cause for the failure. NOTE: we need scopeOfTheContainingExpression as some expressions such as optional in parameters or ref dynamic behave as local variables declared at the scope of the invocation. Returns the set of arguments to be considered for escape analysis of a method invocation. This set potentially includes the receiver of the method call. Each argument is returned (only once) with the corresponding parameter and ref kind. No filtering like removing non-reflike types is done by this method. It is the responsibility of the caller to determine which arguments impact escape analysis. Returns the set of arguments to be considered for escape analysis of a method invocation. Each argument is returned with the correponding parameter and whether analysis should consider value or ref escape. Not all method arguments are included, and some arguments may be included twice - once for value, once for ref. Returns the set of to an invocation that impact ref analysis. This will filter out everything that could never meaningfully contribute to ref analysis. Returns the set of to an invocation that impact ref analysis. This will filter out everything that could never meaningfully contribute to ref analysis. For example: - For ref arguments it will return an for both ref and value escape (if appropriate based on scoped-ness of associated parameters). - It will remove value escape for args which correspond to scoped parameters. - It will remove value escape for non-ref struct. - It will remove ref escape for args which correspond to scoped refs. Optionally this will also return all of the that result from this invocation. That is useful for MAMM analysis. Returns the set of to an invocation that impact ref analysis. This will filter out everything that could never meaningfully contribute to ref analysis. For example: - For ref arguments it will return an for both ref and value escape. - It will remove value escape for non-ref struct. - It will remove ref escape for args which correspond to any refs as old rules couldn't escape refs Note: this does not consider scoped-ness as it was not present in old rules Validates whether the invocation is valid per no-mixing rules. Returns when it is not valid and produces diagnostics (possibly more than one recursively) that helps to figure the reason. Checks whether given expression can escape from the current scope to the . Computes the widest scope depth to which the given expression can escape by reference. NOTE: in a case if expression cannot be passed by an alias (RValue and similar), the ref-escape is scopeOfTheContainingExpression There are few cases where RValues are permitted to be passed by reference which implies that a temporary local proxy is passed instead. We reflect such behavior by constraining the escape value to the narrowest scope possible. A counterpart to the GetRefEscape, which validates if given escape demand can be met by the expression. The result indicates whether the escape is possible. Additionally, the method emits diagnostics (possibly more than one, recursively) that would help identify the cause for the failure. Computes the widest scope depth to which the given expression can escape by value. NOTE: unless the type of expression is ref-like, the result is Binder.ExternalScope since ordinary values can always be returned from methods. The escape value of an object initializer is calculated by looking at all of the expressions that can be stored into the implicit receiver. That means arguments passed to an indexer for example only matter if they can escape into the receiver as a stored field. A counterpart to the GetValEscape, which validates if given escape demand can be met by the expression. The result indicates whether the escape is possible. Additionally, the method emits diagnostics (possibly more than one, recursively) that would help identify the cause for the failure. Get the name of the method so that it can be looked up in the containing type. Non-null declaration syntax. Binder for the scope around the method (may be null for operators, constructors, and destructors). Get the name of the property, indexer, or event so that it can be looked up in the containing type. Non-null declaration syntax. Non-null binder for the scope around the member. Returns true if the location is within the syntax tree and span. Returns true if one of the locations is within the syntax tree and span. Returns true if containingNode has a child that contains the specified position and has kind UsingDirective. Usings can't see other usings, so this is extra info when looking at a namespace or compilation unit scope. Used to detect whether we are in a cref parameter type. Used to detect whether we are in a cref return type. We're in a <param> or <paramref> element, so we want a binder that can see the parameters of the associated member and nothing else. We're in a <typeparam> or <typeparamref> element, so we want a binder that can see the type parameters of the associated member and nothing else. Given a CrefSyntax and an associated member declaration syntax node, construct an appropriate binder for binding the cref. Cref that will be bound. The member to which the documentation comment (logically) containing the cref syntax applies. Corresponding binder factory. True to get a special binder for cref parameter and return types. The CrefSyntax does not actually have to be within the documentation comment on the member - it could be included from another file. Internal version of MakeCrefBinder that allows the caller to explicitly set the underlying binder. Walk up from an XML syntax node (attribute or tag) to the enclosing documentation comment trivia. Return binder for binding at node. and are optional syntax and symbol for the member containing . If provided, the will use the member symbol rather than looking up the member in the containing type, allowing this method to be called while calculating the member list. Note, there is no guarantee that the factory always gives back the same binder instance for the same node. A specific location for binding. Indicates that the current context allows unsafe constructs. NOTE: Dev10 doesn't seem to treat attributes as being within the unsafe region. Fortunately, not following this behavior should not be a breaking change since attribute arguments have to be constants and there are no constants of unsafe types. Indicates that the unsafe diagnostics are not reported in the current context, regardless of whether or not it is (part of) an unsafe region. Indicates that this binder is being used to answer SemanticModel questions (i.e. not for batch compilation). Imports touched by a binder with this flag set are not consider "used". Remarks, mutually exclusive with . Remarks, mutually exclusive with . In the debugger, one can take the address of a moveable variable. In the debugger, the context is always unsafe, but one can still await. Ignore duplicate types from the cor library. This is a , or has as its parent. Are we binding for the purpose of an Expression Evaluator Skip binding type arguments (we use instead). For example, currently used when type constraints are bound in some scenarios. The current context is an expression tree Indicates the binder is used during collection expression conversion to verify applicable methods are available. Extension methods for the type. Get an instance suitable for concurrent additions to both underlying bags. A binder that knows no symbols and will not delegate further. * In non-speculative scenarios, the identifier for the file being bound. * In speculative scenarios, the identifier for the file from the original compilation used as the speculation context. * In EE scenarios, the identifier for the file from the original compilation used as the evaluation context. This is in some scenarios, such as the binder used for or the binder used to bind usings in . Get that can be used to quickly check for certain attribute applications in context of this binder. Keeps track of the type for which we are trying to bind a collection initializer. This is used while computing the values of constant fields. Since they can depend on each other, we need to keep track of which ones we are currently computing in order to avoid (and report) cycles. This binder keeps track of the set of constant fields that are currently being evaluated so that the set can be passed into the next call to SourceFieldSymbol.ConstantValue (and its callers). Each application of an attribute is effectively a constructor call. Since the attribute constructor might have a CallerMemberName parameter, we need to keep track of which method/property/event the attribute is on/in (e.g. on a parameter) so that we can use the name of that member as the CallerMemberName argument. This binder is also needed when a introduces type parameters to a scope within an attribute. Next binder in the chain (enclosing). Symbol to which the attribute was applied (e.g. a parameter). We're binding an attribute and this is the member to/in which the attribute was applied. Method, property, event, or null. A virtual property on Binder (i.e. our usual pattern) would be more robust, but the applicability of this property is so narrow that it doesn't seem worthwhile. Walk up to the nearest method/property/event. A utility class for making a decision dag (directed acyclic graph) for a pattern-matching construct. A decision dag is represented by the class and is a representation of a finite state automaton that performs a sequence of binary tests. Each node is represented by a . There are four kind of nodes: performs one of the binary tests; simply performs some computation and stores it in one or more temporary variables for use in subsequent nodes (think of it as a node with a single successor); represents the test performed by evaluating the expression of the when-clause of a switch case; and represents a leaf node when we have finally determined exactly which case matches. Each test processes a single input, and there are four kinds: tests a value for null; tests that a value is not null; checks if the value is of a given type; and checks if the value is equal to a given constant. Of the evaluations, there are which represents an invocation of a type's "Deconstruct" method; reads a field; reads a property; and converts a value from one type to another (which is performed only after testing that the value is of that type). In order to build this automaton, we start (in ) by computing a description of the initial state in a , and then for each such state description we decide what the test or evaluation will be at that state, and compute the successor state descriptions. A state description represented by a is a collection of partially matched cases represented by . When we have computed descriptions for all of the states, we create a new for each of them, containing the state transitions (including the test to perform at each node and the successor nodes) but not the state descriptions. A containing this set of nodes becomes part of the bound nodes (e.g. in and ) and is used for semantic analysis and lowering. We might need to build a dedicated dag for lowering during which we avoid synthesizing tests to relate alternative indexers. This won't affect code semantics but it results in a better code generation. Create a decision dag for a switch statement. Create a decision dag for a switch expression. Translate the pattern of an is-pattern expression. Used to create a decision dag for a switch expression. Compute the set of remaining tests for a pattern. Make the tests and variable bindings for the given pattern with the given input. The pattern's "output" value is placed in . The output is defined as the input narrowed according to the pattern's *narrowed type*; see https://github.com/dotnet/csharplang/issues/2850. Get the earliest input of which the symbol is a member. A BoundDagTypeEvaluation doesn't change the underlying object being pointed to. So two evaluations act on the same input so long as they have the same original input. We use this method to compute the original input for an evaluation. Generate a not-null check and a type check. Compute and translate the decision dag, given a description of its initial state and a default decision when no decision appears to match. This implementation is nonrecursive to avoid overflowing the compiler's evaluation stack when compiling a large switch statement. Make a (state machine) starting with the given set of cases in the root node, and return the node for the root. Compute the corresponding to each of the given and store it in . Given that the test has occurred and produced a true/false result, set some flags indicating the implied status of the test. The possible values of test.Input when has succeeded. The possible values of test.Input when has failed. set if being true would permit to succeed set if a false result on would permit to succeed set if being true means has been proven true set if being false means has been proven true Returns true if the tests are related i.e. they have the same input, otherwise false. The pre-condition under which these tests are related. A possible assignment node which will correspond two non-identical but related test inputs. Determine what we can learn from one successful runtime type test about another planned runtime type test for the purpose of building the decision tree. We accommodate a special behavior of the runtime here, which does not match the language rules. A value of type `int[]` is an "instanceof" (i.e. result of the `isinst` instruction) the type `uint[]` and vice versa. It is similarly so for every pair of same-sized numeric types, and arrays of enums are considered to be their underlying type. We need the dag construction to recognize this runtime behavior, so we pretend that matching one of them gives no information on whether the other will be matched. That isn't quite correct (nothing reasonable we do could be), but it comes closest to preserving the existing C#7 behavior without undesirable side-effects, and permits the code-gen strategy to preserve the dynamic semantic equivalence of a switch (on the one hand) and a series of if-then-else statements (on the other). See, for example, https://github.com/dotnet/roslyn/issues/35661 A representation of the entire decision dag and each of its states. The starting point for deciding which case matches. A successor function used to topologically sort the DagState set. Produce the states in topological order. Topologically sorted nodes. True if the graph was acyclic. This is a readonly wrapper around an array builder. It ensures we can benefit from the pooling an array builder provides, without having to incur intermediary allocations for s. The state at a given node of the decision finite state automaton. This is used during computation of the state machine (), and contains a representation of the meaning of the state. Because we always make forward progress when a test is evaluated (the state description is monotonically smaller at each edge), the graph of states is acyclic, which is why we call it a dag (directed acyclic graph). For each dag temp of a type for which we track such things (the integral types, floating-point types, and bool), the possible values it can take on when control reaches this state. If this dictionary is mutated after , , and are computed (for example to merge states), they must be cleared and recomputed, as the set of possible values can affect successor states. A absent from this dictionary means that all values of the type are possible. The set of cases that may still match, and for each of them the set of tests that remain to be tested. Created an instance of . Will take ownership of . That will be returned to its pool when is called on this. Decide on what test to use at this node of the decision dag. This is the principal heuristic we can change to adjust the quality of the generated decision automaton. See https://www.cs.tufts.edu/~nr/cs257/archive/norman-ramsey/match.pdf for some ideas. An equivalence relation between dag states used to dedup the states during dag construction. After dag construction is complete we treat a DagState as using object equality as equivalent states have been merged. As part of the description of a node of the decision automaton, we keep track of what tests remain to be done for each case. A number that is distinct for each case and monotonically increasing from earlier to later cases. Since we always keep the cases in order, this is only used to assist with debugging (e.g. see DecisionDag.Dump()). Is the pattern in a state in which it is fully matched and there is no when clause? Is the pattern fully matched and ready for the when clause to be evaluated (if any)? Is the clause impossible? We do not consider a when clause with a constant false value to cause the branch to be impossible. Note that we do not include the possibility that a when clause is the constant false. That is treated like any other expression. A set of tests to be performed. This is a discriminated union; see the options (nested types) for more details. Take the set of tests and split them into two, one for when the test has succeeded, and one for when the test has failed. Rewrite nested length tests in slice subpatterns to check the top-level length property instead. No tests to be performed; the result is true (success). No tests to be performed; the result is false (failure). A single test to be performed, described by a . Note that the test might be a , in which case it is deemed to have succeeded after being evaluated. A sequence of tests that must be performed, each of which must succeed. The sequence is deemed to succeed if no element fails. A sequence of tests that must be performed, any of which must succeed. The sequence is deemed to succeed if some element succeeds. This is a special binder used for decoding some special well-known attributes very early in the attribute binding phase. It only binds those attribute argument syntax which can produce valid attribute arguments, but doesn't report any diagnostics. Subsequent binding phase will rebind such erroneous attributes and generate appropriate diagnostics. Since this method is expected to be called on every nested expression of the argument, it doesn't need to recurse (directly). This binder owns the scope for an embedded statement. This binder owns and lazily creates the map of SyntaxNodes to Binders associated with the syntax with which it is created. This binder is not created in reaction to any specific syntax node type. It is inserted into the binder chain between the binder which it is constructed with and those that it constructs via the LocalBinderFactory. Make a variable for a declaration expression other than a deconstruction left-hand-side. The only other legal place for a declaration expression today is an out variable declaration; this method handles that and the error cases as well. Make a variable for a declaration expression appearing as one of the declared variables of the left-hand-side of a deconstruction assignment. A distinct scope that may expose extension methods. For a particular Binder, there are two possible scopes: one for the namespace, and another for any using statements in the namespace. The namespace scope is searched before the using scope. An enumerable collection of extension method scopes in search order, from the given Binder, out through containing Binders. An enumerator over ExtensionMethodScopes. Information to be deduced while binding a foreach loop so that the loop can be lowered to a while over an enumerator. Not applicable to the array or string forms. A loop binder that (1) knows how to bind foreach loops and (2) has the foreach iteration variable in scope. This binder produces BoundForEachStatements. The lowering described in the spec is performed in ControlFlowRewriter. Bind the ForEachStatementSyntax at the root of this binder. Like BindForEachParts, but only bind the deconstruction part of the foreach, for purpose of inferring the types of the declared locals. Tracks fields that are being bound while binding their initializers. Used to detect circular references like: var x = y; var y = x; Represents symbols imported to the binding scope via using namespace, using alias, and extern alias. Does not preserve diagnostics. A binder that places the members of a symbol in scope. Creates a binder for a container. A binder for a method body, which places the method's parameters in scope and notes if the method is an iterator method. Note: instances of this type can be re-used across different attempts at compiling the same method (caching by binder factory). A binder that places the members of a submission class and aliases in scope. Get that can be used to quickly check for certain attribute applications in context of this binder. The LocalBinderFactory is used to build up the map of all Binders within a method body, and the associated CSharpSyntaxNode. To do so it traverses all the statements, handling blocks and other statements that create scopes. For efficiency reasons, it does not traverse into all expressions. This means that blocks within lambdas and queries are not created. Blocks within lambdas are bound by their own LocalBinderFactory when they are analyzed. For reasons of lifetime management, this type is distinct from the BinderFactory which also creates a map from CSharpSyntaxNode to Binder. That type owns its binders and that type's lifetime is that of the compilation. Therefore we do not store binders local to method bodies in that type's cache. Some statements by default do not introduce its own scope for locals. For example: Expression Statement, Return Statement, etc. However, when a statement like that is an embedded statement (like IfStatementSyntax.Statement), then it should introduce a scope for locals declared within it. Here we are detecting such statements and creating a binder that should own the scope. This binder keeps track of the local variable (if any) that is currently being evaluated so that it can be passed into the next call to LocalSymbol.GetConstantValue (and its callers). Call this when you are sure there is a local declaration on this token. Returns the local. This type exists to share code between UsingStatementBinder and LockBinder. This class exists so these two fields can be set atomically. CONSIDER: If this causes too many allocations, we could use start and end flags plus spinlocking as for completion parts. Options that can be used to modify the symbol lookup mechanism. Multiple options can be combined together. LookupOptions.AreValid checks for valid combinations. Consider all symbols, using normal accessibility rules. Consider only namespace aliases and extern aliases. Consider only namespaces and types. Consider non-members, plus invocable members. Consider only symbols that are instance members. Valid with IncludeExtensionMethods since extension methods are invoked on an instance. Do not consider symbols that are instance members. Do not consider symbols that are namespaces. Consider methods of any arity when arity zero is specified. Because type parameters can be inferred, it is often desired to consider generic methods when no type arguments were present. Look only for label symbols. This must be exclusive of all other options. Usually, when determining if a member is accessible, both the type of the receiver and the type containing the access are used. If this flag is specified, then only the containing type will be used (i.e. as if you've written base.XX). Include extension methods. Consider only attribute types. Consider lookup name to be a verbatim identifier. If this flag is specified, then only one lookup is performed for attribute name: lookup with the given name, and attribute name lookup with "Attribute" suffix is skipped. Consider named types of any arity when arity zero is specified. It is specifically desired for nameof in such situations: nameof(System.Collections.Generic.List) Do not consider symbols that are method type parameters. Consider only symbols that are abstract or virtual. Do not consider symbols that are parameters. Are these options valid in their current combination? Some checks made here: - Default is valid. - If LabelsOnly is set, it must be the only option. - If one of MustBeInstance or MustNotBeInstance are set, the other one must not be set. - If any of MustNotBeInstance, MustBeInstance, or MustNotBeNonInvocableMember are set, the options are considered valid. - If MustNotBeNamespace is set, neither NamespaceAliasesOnly nor NamespacesOrTypesOnly must be set. - Otherwise, only one of NamespaceAliasesOnly, NamespacesOrTypesOnly, or AllMethodsOnArityZero must be set. represents one-to-one symbol -> SingleLookupResult filter. A LookupResult summarizes the result of a name lookup within a scope It also allows combining name lookups from different scopes in an easy way. A LookupResult can be ONE OF: empty - nothing found. a viable result - this kind of result prevents lookup into further scopes of lower priority. Viable results should be without error; ambiguity is handled in the caller. (Note that handling multiple "viable" results is not the same as in the VB compiler) a non-accessible result - this kind of result means that search continues into further scopes of lower priority for a viable result. An error is attached with the inaccessibility errors. Non-accessible results take priority over non-viable results. a non-viable result - a result that means that the search continues into further scopes of lower priority for a viable or non-accessible result. An error is attached with the error that indicates why the result is non-viable. A typical reason would be that it is the wrong kind of symbol. Note that the class is poolable so its instances can be obtained from a pool via GetInstance. Also it is a good idea to call Free on instances after they no longer needed. The typical pattern is "caller allocates / caller frees" - var result = LookupResult.GetInstance(); scope.Lookup(result, "goo"); ... use result ... result.Clear(); anotherScope.Lookup(result, "moo"); ... use result ... result.Free(); //result and its content is invalid after this Currently LookupResult is intended only for name lookup, not for overload resolution. It is not clear if overload resolution will work with the structure as is, require enhancements, or be best served by an alternate mechanism. We might want to extend this to a more general priority scheme. Return the single symbol if there is exactly one, otherwise null. Is the result viable with one or more symbols? NOTE: Even there is a single viable symbol, it may be an error type symbol. Set current result according to another. Set current result according to another. Merge another result with this one, with the symbols combined if both this and other are viable. Otherwise the highest priority result wins (this if equal priority and non-viable.) Classifies the different ways in which a found symbol might be incorrect. Higher values are considered "better" than lower values. These values are used in a few different places: 1) Inside a LookupResult to indicate the quality of a symbol from lookup. 2) Inside a bound node (for example, BoundBadExpression), to indicate the "binding quality" of the symbols referenced by that bound node. 3) Inside an error type symbol, to indicate the reason that the candidate symbols in the error type symbols were not good. While most of the values can occur in all places, some of the problems are not detected at lookup time (e.g., NotAVariable), so only occur in bound nodes. This enumeration is parallel to and almost the same as the CandidateReason enumeration. Changes to one should usually result in changes to the other. There are two enumerations because: 1) CandidateReason in language-independent, while this enum is language specific. 2) The name "CandidateReason" didn't make much sense in the way LookupResultKind is used internally. 3) Viable isn't used in CandidateReason, but we need it in LookupResultKind, and there isn't a a way to have internal enumeration values. Maps a LookupResultKind to a CandidateReason. Should not be called on LookupResultKind.Viable! Information about the arguments of a call that can turned into a BoundCall later without recalculating default arguments. Packages up the various parts returned when resolving a method group. If a proper method named "nameof" exists in the outer scopes, is false and this binder does nothing. Otherwise, it relaxes the instance-vs-static requirement for top-level member access expressions and when inside an attribute on a method it adds type parameters from the target of that attribute. To do so, it works together with . For other attributes (on types, type parameters or parameters) we use a WithTypeParameterBinder directly in the binder chain and some filtering () to keep pre-existing behavior. This binder keeps track of the type for which we are trying to determine whether it is a valid 'params' collection type. Find the shortest path from the root node to the node of interest. The set of nodes in topological order. The node of interest. Whether to permit following paths that test for null. set to true if the returned path requires some when clause to evaluate to 'false' The shortest path, excluding the node of interest. Enumerates the paths from the root node to the node of interest, and invokes the handler on each one until the handler returns false. The order is deterministic, but we're not starting from the shortest path. The root node of the DAG. The node of interest. Whether to permit following paths that test for null. Handler to call back for every path to the target node. Return a sample pattern that would lead to the given decision dag node. A topologically sorted list of nodes in the decision dag. A node of interest (typically, the default node for a non-exhaustive switch). Permit the use of "null" paths on tests which check for null. The Lookup was successful A member was found, but it was not a method A member was found, but it was not callable The lookup failed to find anything One or more errors occurred while performing the lookup Contains the code for determining C# accessibility rules. Checks if 'symbol' is accessible from within assembly 'within'. Checks if 'symbol' is accessible from within type 'within', with an optional qualifier of type "throughTypeOpt". Checks if 'symbol' is accessible from within type 'within', with a qualifier of type "throughTypeOpt". Sets "failedThroughTypeCheck" to true if it failed the "through type" check. Returns true if the symbol is effectively public or internal based on the declared accessibility of the symbol and any containing symbols. Checks if 'symbol' is accessible from within 'within', which must be a NamedTypeSymbol or an AssemblySymbol. Note that NamedTypeSymbol, if available, is the type that is associated with the binder that found the 'symbol', not the inner-most type that contains the access to the 'symbol'. If 'symbol' is accessed off of an expression then 'throughTypeOpt' is the type of that expression. This is needed to properly do protected access checks. Sets "failedThroughTypeCheck" to true if this protected check failed. This function is expected to be called a lot. As such, it avoids memory allocations in the function itself (including not making any iterators). This means that certain helper functions that could otherwise be called are inlined in this method to prevent the overhead of returning collections or enumerators. Is the named type accessible from within , which must be a named type or an assembly. Is a top-level type with accessibility "declaredAccessibility" inside assembly "assembly" accessible from "within", which must be a named type of an assembly. Is a member with declared accessibility "declaredAccessibility" accessible from within "within", which must be a named type or an assembly. Is a protected symbol inside "originalContainingType" accessible from within "within", which much be a named type or an assembly. Is the type "withinType" nested within the original type "originalContainingType". Determine if "type" inherits from or implements "baseType", ignoring constructed types, and dealing only with original types. Does the assembly has internal accessibility to "toAssembly"? The assembly wanting access. The assembly possibly providing symbols to be accessed. This method finds the best common type of a set of expressions as per section 7.5.2.14 of the specification. NOTE: If some or all of the expressions have error types, we return error type as the inference result. This method implements best type inference for the conditional operator ?:. NOTE: If either expression is an error type, we return error type as the inference result. Returns the better type amongst the two, with some possible modifications (dynamic/object or tuple names). Summarizes whether a conversion is allowed, and if so, which kind of conversion (and in some cases, the associated symbol). Returns true if the conversion exists, either as an implicit or explicit conversion. The existence of a conversion does not necessarily imply that the conversion is valid. For example, an ambiguous user-defined conversion may exist but may not be valid. Returns true if the conversion is implicit. Implicit conversions are described in section 6.1 of the C# language specification. Returns true if the conversion is explicit. Explicit conversions are described in section 6.2 of the C# language specification. Returns true if the conversion is an identity conversion. Identity conversions are described in section 6.1.1 of the C# language specification. Returns true if the conversion is a stackalloc conversion. Returns true if the conversion is an implicit numeric conversion or explicit numeric conversion. Implicit and explicit numeric conversions are described in sections 6.1.2 and 6.2.1 of the C# language specification. Returns true if the conversion is an implicit enumeration conversion or explicit enumeration conversion. Implicit and explicit enumeration conversions are described in sections 6.1.3 and 6.2.2 of the C# language specification. Returns true if the conversion is an implicit throw conversion. Returns true if the conversion is an implicit object creation expression conversion. Returns true if the conversion is an implicit collection expression conversion. Returns true if the conversion is an implicit switch expression conversion. Returns true if the conversion is an implicit conditional expression conversion. Returns true if the conversion is an interpolated string conversion. The interpolated string conversion described in section 6.1.N of the C# language specification. Returns true if the conversion is an interpolated string builder conversion. Returns true if the conversion is an inline array conversion. Returns true if the conversion is an implicit nullable conversion or explicit nullable conversion. Implicit and explicit nullable conversions are described in sections 6.1.4 and 6.2.3 of the C# language specification. Returns true if the conversion is an implicit tuple literal conversion or explicit tuple literal conversion. Returns true if the conversion is an implicit tuple conversion or explicit tuple conversion. Returns true if the conversion is an implicit reference conversion or explicit reference conversion. Implicit and explicit reference conversions are described in sections 6.1.6 and 6.2.4 of the C# language specification. Returns true if the conversion is an implicit user-defined conversion or explicit user-defined conversion. Implicit and explicit user-defined conversions are described in section 6.4 of the C# language specification. Returns true if the conversion is an implicit boxing conversion. Implicit boxing conversions are described in section 6.1.7 of the C# language specification. Returns true if the conversion is an explicit unboxing conversion. Explicit unboxing conversions as described in section 6.2.5 of the C# language specification. Returns true if the conversion is an implicit null literal conversion. Null literal conversions are described in section 6.1.5 of the C# language specification. Returns true if the conversion is an implicit default literal conversion. Returns true if the conversion is an implicit dynamic conversion. Implicit dynamic conversions are described in section 6.1.8 of the C# language specification. Returns true if the conversion is an implicit constant expression conversion. Implicit constant expression conversions are described in section 6.1.9 of the C# language specification. Returns true if the conversion is an implicit anonymous function conversion. Implicit anonymous function conversions are described in section 6.5 of the C# language specification. Returns true if the conversion is an implicit method group conversion. Implicit method group conversions are described in section 6.6 of the C# language specification. Returns true if the conversion is a pointer conversion Pointer conversions are described in section 18.4 of the C# language specification. Returns true if the conversion is a conversion a) from a pointer type to void*, b) from a pointer type to another pointer type (other than void*), c) from the null literal to a pointer type, d) from an integral numeric type to a pointer type, e) from a pointer type to an integral numeric type, or d) from a function pointer type to a function pointer type. Does not return true for user-defined conversions to/from pointer types. Does not return true for conversions between pointer types and IntPtr/UIntPtr. Returns true if the conversion is a conversion to or from IntPtr or UIntPtr. Returns true if the conversion is a conversion to or from IntPtr or UIntPtr. This includes: IntPtr to/from int IntPtr to/from long IntPtr to/from void* UIntPtr to/from int UIntPtr to/from long UIntPtr to/from void* Returns the method used to create the delegate for a method group conversion if is true or the method used to perform the conversion for a user-defined conversion if is true. Otherwise, returns null. Method group conversions are described in section 6.6 of the C# language specification. User-defined conversions are described in section 6.4 of the C# language specification. Type parameter which runtime type will be used to resolve virtual invocation of the , if any. Null if is resolved statically, or is null. Gives an indication of how successful the conversion was. Viable - found a best built-in or user-defined conversion. Empty - found no applicable built-in or user-defined conversions. OverloadResolutionFailure - found applicable conversions, but no unique best. Conversion applied to operand of the user-defined conversion. Conversion applied to the result of the user-defined conversion. The user-defined operators that were considered when attempting this conversion (i.e. the arguments to overload resolution). Creates a from this C# conversion. The that represents this conversion. This is a lossy conversion; it is not possible to recover the original from the struct. Returns a string that represents the of the conversion. A string that represents the of the conversion. Determines whether the specified object is equal to the current object. The object to compare with the current object. true if the specified object is equal to the current object; otherwise, false. Determines whether the specified object is equal to the current object. The object to compare with the current object. true if the specified object is equal to the current object; otherwise, false. Returns a hash code for the current object. A hash code for the current object. Returns true if the specified objects are equal and false otherwise. The first object. The second object. Returns false if the specified objects are equal and true otherwise. The first object. The second object. Stores all the information from binding for calling a Deconstruct method. An optional clone of this instance with distinct IncludeNullability. Used to avoid unnecessary allocations when calling WithNullability() repeatedly. Returns this instance if includeNullability is correct, and returns a cached clone of this instance with distinct IncludeNullability otherwise. Derived types should provide non-null value for proper classification of conversions from expression. Determines if the source expression is convertible to the destination type via any built-in or user-defined implicit conversion. Determines if the source type is convertible to the destination type via any built-in or user-defined implicit conversion. Helper method that calls or depending on whether the types are instances. Used by method type inference and best common type only. Determines if the source expression of given type is convertible to the destination type via any built-in or user-defined conversion. This helper is used in rare cases involving synthesized expressions where we know the type of an expression, but do not have the actual expression. The reason for this helper (as opposed to ClassifyConversionFromType) is that conversions from expressions could be different from conversions from type. For example expressions of dynamic type are implicitly convertable to any type, while dynamic type itself is not. Determines if the source expression is convertible to the destination type via any conversion: implicit, explicit, user-defined or built-in. It is rare but possible for a source expression to be convertible to a destination type by both an implicit user-defined conversion and a built-in explicit conversion. In that circumstance, this method classifies the conversion as the implicit conversion or explicit depending on "forCast" Determines if the source type is convertible to the destination type via any conversion: implicit, explicit, user-defined or built-in. It is rare but possible for a source type to be convertible to a destination type by both an implicit user-defined conversion and a built-in explicit conversion. In that circumstance, this method classifies the conversion as the implicit conversion or explicit depending on "forCast" Determines if the source expression is convertible to the destination type via any conversion: implicit, explicit, user-defined or built-in. It is rare but possible for a source expression to be convertible to a destination type by both an implicit user-defined conversion and a built-in explicit conversion. In that circumstance, this method classifies the conversion as the built-in conversion. An implicit conversion exists from an expression of a dynamic type to any type. An explicit conversion exists from a dynamic type to any type. When casting we prefer the explicit conversion. Determines if the source type is convertible to the destination type via any conversion: implicit, explicit, user-defined or built-in. It is rare but possible for a source type to be convertible to a destination type by both an implicit user-defined conversion and a built-in explicit conversion. In that circumstance, this method classifies the conversion as the built-in conversion. Attempt a quick classification of builtin conversions. As result of "no conversion" means that there is no built-in conversion, though there still may be a user-defined conversion if compiling against a custom mscorlib. Determines if the source type is convertible to the destination type via any standard implicit or standard explicit conversion. Not all built-in explicit conversions are standard explicit conversions. Determines if the source type is convertible to the destination type via any standard implicit or standard explicit conversion. Not all built-in explicit conversions are standard explicit conversions. IsBaseInterface returns true if baseType is on the base interface list of derivedType or any base class of derivedType. It may be on the base interface list either directly or indirectly. * baseType must be an interface. * type parameters do not have base interfaces. (They have an "effective interface list".) * an interface is not a base of itself. * this does not check for variance conversions; if a type inherits from IEnumerable<string> then IEnumerable<object> is not a base interface. returns true when implicit conversion is not necessarily the same as explicit conversion Returns true if: - Either type has no nullability information (oblivious). - Both types cannot have different nullability at the same time, including the case of type parameters that by themselves can represent nullable and not nullable reference types. Returns false if source type can be nullable at the same time when destination type can be not nullable, including the case of type parameters that by themselves can represent nullable and not nullable reference types. When either type has no nullability information (oblivious), this method returns true. Returns false if the source does not have an implicit conversion to the destination because of either incompatible top level or nested nullability. NOTE: Keep this method in sync with . This method find the set of applicable user-defined and lifted conversion operators, u. The set consists of the user-defined and lifted implicit conversion operators declared by the classes and structs in d that convert from a type encompassing source to a type encompassed by target. However if allowAnyTarget is true, then it considers all operators that convert from a type encompassing source to any target. This flag must be set only if we are computing user defined conversions from a given source type to any target type. Currently allowAnyTarget flag is only set to true by , where we must consider user defined implicit conversions from the type of the switch expression to any of the possible switch governing types. Find the most specific among a set of conversion operators, with the given constraint on the conversion. NOTE: Keep this method in sync with AnalyzeImplicitUserDefinedConversion. Resolve method group based on the optional delegate invoke method. If the invoke method is null, ignore arguments in resolution. Return the Invoke method symbol if the type is a delegate type and the Invoke method is available, otherwise null. Returns this instance if includeNullability is correct, and returns a cached clone of this instance with distinct IncludeNullability otherwise. Remove candidates to a delegate conversion where the method's return ref kind or return type is wrong. The ref kind of the delegate's return, if known. This is only unknown in error scenarios, such as a delegate type that has no invoke method. The return type of the delegate, if known. It isn't known when we're attempting to infer the return type of a method group for type inference. Does override or the thing that it originally overrides, but in a more derived class? Set to false if the caller has already checked that is in a type that derives from the type containing . Does the member group contain an override of or the method it overrides, but in a more derived type? Set to false if the caller has already checked that are all in a type that derives from the type containing . This is specifically a private helper function (rather than a public property or extension method) because applying this predicate to a non-method member doesn't have a clear meaning. The goal was simply to avoid repeating ad-hoc code in a group of related collections. Returns the parameter corresponding to the given argument index. Returns true if the overload required a function type conversion to infer generic method type arguments or to convert to parameter types. To duplicate native compiler behavior for some scenarios we force a priority among operators. If two operators are both applicable and both have a non-null Priority, the one with the numerically lower Priority value is preferred. Abstraction for use in , to allow it to work generically with all member resolution types (method, unary operator, binary operator). A bit vector representing whose true bits indicate indices of bad arguments The capacity of this BitVector might not match the parameter count of the method overload being resolved. For example, if a method overload has 5 parameters and the second parameter is the only bad parameter, then this BitVector could end up with Capacity being 2 where BadArguments[0] is false and BadArguments[1] is true. Omit ref feature for COM interop: We can pass arguments by value for ref parameters if we are invoking a method/property on an instance of a COM imported type. This property returns a flag indicating whether we had any ref omitted argument for the given call. Returns false for because those diagnostics are only reported if no other candidates are available. Indicates why the compiler accepted or rejected the member during overload resolution. No resolution has (yet) been determined. The candidate member was accepted in its normal (non-expanded) form. The candidate member was accepted in its expanded form, after expanding a "params" parameter. The candidate member was rejected because an inferred type argument is inaccessible. The candidate member was rejected because an argument was specified that did not have a corresponding parameter. The candidate member was rejected because a named argument was specified that did not have a corresponding parameter. The candidate member was rejected because there were two named arguments with the same parameter name. The candidate member was rejected because a required parameter had no corresponding argument. The candidate member was rejected because a named argument was used that corresponded to a previously-given positional argument. The candidate member was rejected because a named argument was used out-of-position and followed by unnamed arguments. The candidate member was rejected because it is not supported by the language or cannot be used given the current set of assembly references. The candidate member was rejected because it is not supported by the language. No diagnostics will be reported for such candidates unless they "win" overload resolution. The candidate member was rejected because an argument could not be converted to the appropriate parameter type. The candidate member was rejected because type inference failed. The extension method candidate was rejected because type inference based on the "instance" argument failed. The candidate member was rejected because a constraint on the type of a parameter was not satisfied. The candidate method's type arguments do not satisfy their constraints. The candidate member was rejected because it was an instance member accessed from a type, or a static member accessed from an instance. The candidate member was rejected because its calling convention did not match the function pointer calling convention. The candidate method in a delegate conversion was rejected because the ref kind of its return does not match the delegate. The candidate method in a delegate conversion was rejected because its return type does not match the return type of the delegate. The candidate member was rejected because another member further down in the inheritance hierarchy was present. The candidate member was rejected because it was considered worse that another member (according to section 7.5.3.2 of the language specification). Same as , but the candidate shouldn't be mentioned in an ambiguity diagnostics. Represents the results of overload resolution for a single member. At least one type argument was inferred from a function type. The member considered during overload resolution. The least overridden member that is accessible from the call site that performed overload resolution. Typically a virtual or abstract method (but not necessarily). The member whose parameter types and params modifiers were considered during overload resolution. Indicates why the compiler accepted or rejected the member during overload resolution. Returns true if the compiler accepted this member as the sole correct result of overload resolution. The result of member analysis. At least one type argument was inferred from a function type. For error recovery, we allow a mismatch between the number of arguments and parameters during type inference. This sometimes enables inferring the type for a lambda parameter. Return the interface with an original definition matches the original definition of the target. If the are no matches, or multiple matches, the return value is null. Return the inferred type arguments using null for any type arguments that were not inferred. This is a comparer that ignores differences in dynamic-ness and tuple names. But it has a special case for top-level object vs. dynamic for purpose of method type inference. Summarizes the results of an overload resolution analysis, as described in section 7.5 of the language specification. Describes whether overload resolution succeeded, and which method was selected if overload resolution succeeded, as well as detailed information about each method that was considered. True if overload resolution successfully selected a single best method. If overload resolution successfully selected a single best method, returns information about that method. Otherwise returns null. If there was a method that overload resolution considered better than all others, returns information about that method. A method may be returned even if that method was not considered a successful overload resolution, as long as it was better that any other potential method considered. Returns information about each method that was considered during overload resolution, and what the results of overload resolution were for that method. Returns true if one or more of the members in the group are applicable. (Note that Succeeded implies IsApplicable but IsApplicable does not imply Succeeded. It is possible that no applicable member was better than all others.) Returns all methods in the group that are applicable, . Called when overload resolution has failed. Figures out the best way to describe what went wrong. Overload resolution (effectively) starts out assuming that all candidates are valid and then gradually disqualifies them. Therefore, our strategy will be to perform our checks in the reverse order - the farther a candidate got through the process without being flagged, the "better" it was. Note that "final validation" is performed after overload resolution, so final validation errors are not seen here. Final validation errors include violations of constraints on method type parameters, static/instance mismatches, and so on. The base class for all symbols (namespaces, classes, method, parameters, etc.) that are exposed by the compiler. Checks if 'symbol' is accessible from within named type 'within'. If 'symbol' is accessed off of an expression then 'throughTypeOpt' is the type of that expression. This is needed to properly do protected access checks. Checks if 'symbol' is accessible from within assembly 'within'. Checks if this symbol is a definition and its containing module is a SourceModuleSymbol. Return whether the symbol is either the original definition or distinct from the original. Intended for use in Debug.Assert only since it may include a deep comparison. Returns a list of attributes to emit to CustomAttribute table. The builder is freed after all its items are enumerated. True if this Symbol should be completed by calling ForceComplete. Intuitively, true for source entities (from any compilation). Gets the name of this symbol. Symbols without a name return the empty string; null is never returned. Gets the name of a symbol as it appears in metadata. Most of the time, this is the same as the Name property, with the following exceptions: 1) The metadata name of generic types includes the "`1", "`2" etc. suffix that indicates the number of type parameters (it does not include, however, names of containing types or namespaces). 2) The metadata name of explicit interface names have spaces removed, compared to the name property. Gets the token for this symbol as it appears in metadata. Most of the time this is 0, as it is when the symbol is not loaded from metadata. Gets the kind of this symbol. Get the symbol that logically contains this symbol. Returns the nearest lexically enclosing type, or null if there is none. Gets the nearest enclosing namespace for this namespace or type. For a nested type, returns the namespace that contains its container. Returns the assembly containing this symbol. If this symbol is shared across multiple assemblies, or doesn't belong to an assembly, returns null. For a source assembly, the associated compilation. For any other assembly, null. For a source module, the DeclaringCompilation of the associated source assembly. For any other module, null. For any other symbol, the DeclaringCompilation of the associated module. We're going through the containing module, rather than the containing assembly, because of /addmodule (symbols in such modules should return null). Remarks, not "ContainingCompilation" because it isn't transitive. Returns the module containing this symbol. If this symbol is shared across multiple modules, or doesn't belong to a module, returns null. The index of this member in the containing symbol. This is an optional property, implemented by anonymous type properties only, for comparing symbols in flow analysis. Should this be used for tuple fields as well? The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. Returns true if this is the original definition of this symbol. Get a source location key for sorting. For performance, it's important that this be able to be returned from a symbol without doing any additional allocations (even if nothing is cached yet.) Only (original) source symbols and namespaces that can be merged need implement this function if they want to do so for efficiency. Gets the locations where this symbol was originally defined, either in source or metadata. Some symbols (for example, partial classes) may be defined in more than one location. Determines if there is a location (see ) for this symbol whose span is in and is contained within . Subclasses can override this to be more efficient if desired (especially if avoiding allocations of the array is desired). Get the syntax node(s) where this symbol was declared in source. Some symbols (for example, partial classes) may be defined in more than one location. This property should return one or more syntax nodes only if the symbol was declared in source code and also was not implicitly declared (see the property). Note that for namespace symbol, the declaring syntax might be declaring a nested namespace. For example, the declaring syntax node for N1 in "namespace N1.N2 {...}" is the entire for N1.N2. For the global namespace, the declaring syntax will be the . The syntax node(s) that declared the symbol. If the symbol was declared in metadata or was implicitly declared, returns an empty read-only array. To go the opposite direction (from syntax node to symbol), see . Helper for implementing for derived classes that store a location but not a or . Get this accessibility that was declared on this symbol. For symbols that do not have accessibility declared on them, returns . Returns true if this symbol is "static"; i.e., declared with the static modifier or implicitly static. Returns true if this symbol is "virtual", has an implementation, and does not override a base class member; i.e., declared with the virtual modifier. Does not return true for members declared as abstract or override. Returns true if this symbol was declared to override a base class member; i.e., declared with the override modifier. Still returns true if member was declared to override something, but (erroneously) no member to override exists. Even for metadata symbols, = true does not imply that will be non-null. Returns true if this symbol was declared as requiring an override; i.e., declared with the abstract modifier. Also returns true on a type declared as "abstract", all interface types, and members of interface types. Returns true if this symbol was declared to override a base class member and was also sealed from further overriding; i.e., declared with the sealed modifier. Also set for types that do not allow a derived class (declared with sealed or static or struct or enum or delegate). Returns true if this symbol has external implementation; i.e., declared with the extern modifier. Returns true if this symbol was automatically created by the compiler, and does not have an explicit corresponding source code declaration. This is intended for symbols that are ordinary symbols in the language sense, and may be used by code, but that are simply declared implicitly rather than with explicit language syntax. Examples include (this list is not exhaustive): the default constructor for a class or struct that is created if one is not provided, the BeginInvoke/Invoke/EndInvoke methods for a delegate, the generated backing field for an auto property or a field-like event, the "this" parameter for non-static methods, the "value" parameter for a property setter, the parameters on indexer accessor methods (not on the indexer itself), methods in anonymous types, anonymous functions Returns true if this symbol can be referenced by its name in code. Examples of symbols that cannot be referenced by name are: constructors, destructors, operators, explicit interface implementations, accessor methods for properties and events, array types. As an optimization, viability checking in the lookup code should use this property instead of . The full name check will then be performed in the . This property exists purely for performance reasons. Perform additional checks after the member has been added to the member list of the containing type. Compare two symbol objects to see if they refer to the same symbol. You should always use and , or the method, to compare two symbols for equality. Compare two symbol objects to see if they refer to the same symbol. You should always use == and !=, or the Equals method, to compare two symbols for equality. Returns a string representation of this symbol, suitable for debugging purposes, or for placing in an error message. This will provide a useful representation, but it would be clearer to call directly and provide an explicit format. Sealed so that and can't get out of sync. Build and add synthesized attributes for this symbol. Convenience helper called by subclasses to add a synthesized attribute to a collection of attributes. effective for this symbol (type or DllImport method). Nothing if isn't applied on the containing module or it doesn't apply on this symbol. Determined based upon value specified via applied on the containing module. Always prefer . Unfortunately, when determining overriding/hiding/implementation relationships, we don't have the "current" compilation available. We could, but that would clutter up the API without providing much benefit. As a compromise, we consider all compilations "current". Unlike in VB, we are not allowing retargeting symbols. This method is used as an approximation for when a compilation is not available and that method will never return true for retargeting symbols. Returns the Documentation Comment ID for the symbol, or null if the symbol doesn't support documentation comments. Fetches the documentation comment for this element with a cancellation token. Optionally, retrieve the comments formatted for a particular culture. No impact on source documentation comments. Optionally, expand ]]> elements. No impact on non-source documentation comments. Optionally, allow cancellation of documentation comment retrieval. The XML that would be written to the documentation file for the symbol. True if the symbol has a use-site diagnostic with error severity. Returns diagnostic info that should be reported at the use site of the symbol, or default if there is none. Returns true if the error code is the highest priority while calculating use site error for this symbol. Supposed to be ErrorCode, but it causes inconsistent accessibility error. Indicates that this symbol uses metadata that cannot be supported by the language. Examples include: - Pointer types in VB - ByRef return type - Required custom modifiers This is distinguished from, for example, references to metadata symbols defined in assemblies that weren't referenced. Symbols where this returns true can never be used successfully, and thus should never appear in any IDE feature. This is set for metadata symbols, as follows: Type - if a type is unsupported (e.g., a pointer type, etc.) Method - parameter or return type is unsupported Field - type is unsupported Event - type is unsupported Property - type is unsupported Parameter - type is unsupported Merges given diagnostic to the existing result diagnostic. Merges given diagnostic and dependencies to the existing result. Reports specified use-site diagnostic to given diagnostic bag. This method should be the only method adding use-site diagnostics to a diagnostic bag. It performs additional adjustments of the location for unification related diagnostics and may be the place where to add more use-site location post-processing. True if the diagnostic has error severity. Derive use-site info from a type symbol. True if this symbol has been marked with the attribute. This property returns if the attribute hasn't been cracked yet. True if this symbol has been marked with the System.Diagnostics.CodeAnalysis.ExperimentalAttribute attribute. This property returns if the attribute hasn't been cracked yet. Returns data decoded from /Experimental attribute or null if there is no /Experimental attribute. This property returns if attribute arguments haven't been decoded yet. True if the symbol is declared outside of the scope of the containing symbol Gets the attributes for this symbol. Returns an empty if there are no attributes. Gets the attribute target kind corresponding to the symbol kind If attributes cannot be applied to this symbol kind, returns an invalid AttributeTargets value of 0 AttributeTargets or 0 Method to early decode the type of well-known attribute which can be queried during the BindAttributeType phase. This method is called first during attribute binding so that any attributes that affect semantics of type binding can be decoded here. NOTE: If you are early decoding any new well-known attribute, make sure to update PostEarlyDecodeWellKnownAttributeTypes to default initialize this data. This method is called during attribute binding after EarlyDecodeWellKnownAttributeTypes has been executed. Symbols should default initialize the data for early decoded well-known attributes here. Method to early decode applied well-known attribute which can be queried by the binder. This method is called during attribute binding after we have bound the attribute types for all attributes, but haven't yet bound the attribute arguments/attribute constructor. Early decoding certain well-known attributes enables the binder to use this decoded information on this symbol when binding the attribute arguments/attribute constructor without causing attribute binding cycle. This method is called by the binder when it is finished binding a set of attributes on the symbol so that the symbol can extract data from the attribute arguments and potentially perform validation specific to some well known attributes. NOTE: If we are decoding a well-known attribute that could be queried by the binder, consider decoding it during early decoding pass. Symbol types should override this if they want to handle a specific well-known attribute. If the attribute is of a type that the symbol does not wish to handle, it should delegate back to this (base) method. Called to report attribute related diagnostics after all attributes have been bound and decoded. Called even if there are no attributes. This method is called by the binder from after it has finished binding attributes on the symbol, has executed for attributes applied on the symbol and has stored the decoded data in the lazyCustomAttributesBag on the symbol. Bound attributes haven't been stored on the bag yet. Post-validation for attributes that is dependent on other attributes can be done here. This method should not have any side effects on the symbol, i.e. it SHOULD NOT change the symbol state. Bound attributes. Syntax nodes of attributes in order they are specified in source, or null if there are no attributes. Diagnostic bag. Specific part of the symbol to which the attributes apply, or if the attributes apply to the symbol itself. Decoded well-known attribute data, could be null. This method does the following set of operations in the specified order: (1) GetAttributesToBind: Merge attributes from the given attributesSyntaxLists and filter out attributes by attribute target. (2) BindAttributeTypes: Bind all the attribute types to enable early decode of certain well-known attributes by type. (3) EarlyDecodeWellKnownAttributes: Perform early decoding of certain well-known attributes that could be queried by the binder in subsequent steps. (NOTE: This step has the side effect of updating the symbol state based on the data extracted from well known attributes). (4) GetAttributes: Bind the attributes (attribute arguments and constructor) using bound attribute types. (5) DecodeWellKnownAttributes: Decode and validate bound well known attributes. (NOTE: This step has the side effect of updating the symbol state based on the data extracted from well known attributes). (6) StoreBoundAttributesAndDoPostValidation: (a) Store the bound attributes in lazyCustomAttributes in a thread safe manner. (b) Perform some additional post attribute validations, such as 1) Duplicate attributes, attribute usage target validation, etc. 2) Post validation for attributes dependent on other attributes These validations cannot be performed prior to step 6(a) as we might need to perform a GetAttributes() call on a symbol which can introduce a cycle in attribute binding. We avoid this cycle by performing such validations in PostDecodeWellKnownAttributes after lazyCustomAttributes have been set. NOTE: PostDecodeWellKnownAttributes SHOULD NOT change the symbol state. Current design of early decoding well-known attributes doesn't permit decoding attribute arguments/constructor as this can lead to binding cycles. For well-known attributes used by the binder, where we need the decoded arguments, we must handle them specially in one of the following possible ways: (a) Avoid decoding the attribute arguments during binding and delay the corresponding binder tasks to a separate post-pass executed after binding. (b) As the cycles can be caused only when we are binding attribute arguments/constructor, special case the corresponding binder tasks based on the current BinderFlags. Specific part of the symbol to which the attributes apply, or if the attributes apply to the symbol itself. Indicates that only early decoding should be performed. WARNING: the resulting bag will not be sealed. Binder to use. If null, GetBinderFactory will be used. If specified, only load attributes that match this predicate, and any diagnostics produced will be dropped. If specified, invoked before any part of the attribute syntax is bound. If specified, invoked after any part of the attribute syntax is bound. Flag indicating whether lazyCustomAttributes were stored on this thread. Caller should check for this flag and perform NotePartComplete if true. Binds attributes applied to this symbol. Method to merge attributes from the given attributesSyntaxLists and filter out attributes by attribute target. This is the first step in attribute binding. This method can generate diagnostics for few cases where we have an invalid target specifier and the parser hasn't generated the necessary diagnostics. It should not perform any bind operations as it can lead to an attribute binding cycle. Method to early decode certain well-known attributes which can be queried by the binder. This method is called during attribute binding after we have bound the attribute types for all attributes, but haven't yet bound the attribute arguments/attribute constructor. Early decoding certain well-known attributes enables the binder to use this decoded information on this symbol when binding the attribute arguments/attribute constructor without causing attribute binding cycle. This method validates attribute usage for each bound attribute and calls on attributes with valid attribute usage. This method is called by the binder when it is finished binding a set of attributes on the symbol so that the symbol can extract data from the attribute arguments and potentially perform validation specific to some well known attributes. Validate attribute usage target and duplicate attributes. Bound attribute Syntax node for attribute specification Compilation Symbol part to which the attribute has been applied. Diagnostics Set of unique attribute types applied to the symbol Ensure that attributes are bound and the ObsoleteState/ExperimentalState of this symbol is known. This binder owns the scope for Simple Program top-level statements. This binder provides a context for binding within a specific compilation unit, but outside of top-level statements. It ensures that locals are in scope, however it is not responsible for creating the symbols. That task is actually owned by and this binder simply delegates to it when appropriate. That ensures that the same set of symbols is shared across all compilation units. Represents a result of lookup operation over a 0 or 1 symbol (as opposed to a scope). The typical use is to represent that a particular symbol is good/bad/unavailable. For more explanation of Kind, Symbol, Error - see LookupResult. Bind the switch statement, reporting in the process any switch labels that are subsumed by previous cases. Bind a pattern switch label in order to force inference of the type of pattern variables. Bind the pattern switch labels. Bind the pattern switch section. Binder for one of the arms of a switch expression. For example, in the one-armed switch expression "e switch { p when c => v }", this could be the binder for the arm "p when c => v". Build the decision dag, giving an error if some cases are subsumed and a warning if the switch expression is not exhaustive. true if there was a non-exhaustive warning reported Infer the result type of the switch expression by looking for a common type to which every arm's expression can be converted. This binder is for binding the argument to typeof. It traverses the syntax marking each open type ("unbound generic type" in the C# spec) as either allowed or not allowed, so that BindType can appropriately return either the corresponding type symbol or an error type. It also indicates whether the argument as a whole should be considered open so that the flag can be set appropriately in BoundTypeOfOperator. This visitor walks over a type expression looking for open types. Open types are allowed if an only if: 1) There is no constructed generic type elsewhere in the visited syntax; and 2) The open type is not used as a type argument or array/pointer/nullable element type. The argument to typeof. Keys are GenericNameSyntax nodes representing unbound generic types. Values are false if the node should result in an error and true otherwise. A binder that places class/interface/struct/delegate type parameters in scope The scope within a documentation cref. Contains the implicitly declared type parameters of the cref (see for details). A binder that brings extern aliases into the scope and deals with looking up names in them. A binder that brings both extern and using aliases into the scope and deals with looking up names in them. This overload is added to shadow the one from the base. Get that can be used to quickly check for certain attribute applications in context of this binder. A binder that places method type parameters in scope. Binder used to place the parameters of a method, property, indexer, or delegate in scope when binding <param> tags inside of XML documentation comments and `nameof` in certain attribute positions. Binder used to place Primary Constructor parameters, if any, in scope. A binder that represents a scope introduced by 'using' namespace or type directives and deals with looking up names in it. Look for a type forwarder for the given type in any referenced assemblies, checking any using namespaces in the current imports. The metadata name of the (potentially) forwarded type, without qualifiers. Will be used to return the namespace of the found forwarder, if any. Will be used to report non-fatal errors during look up. Location to report errors on. Returns the Assembly to which the type is forwarded, or null if none is found. Since this method is intended to be used for error reporting, it stops as soon as it finds any type forwarder (or an error to report). It does not check other assemblies for consistency or better results. Debug info associated with to support EnC. The id of the generated await. The number of async state machine states to reserve. Any time multiple s might be associated with the same syntax node we need to make sure that the same number of state machine states gets allocated for the node, regardless of the actual number of s that get emitted. To do so one or more of the emitted s may reserve additional dummy state machine states so that the total number of states (one for each plus total reserved states) is constant regardless of semantics of the syntax node. E.g. `await foreach` produces at least one and at most two s: one for MoveNextAsync and the other for DisposeAsync. If the enumerator is async-disposable it produces two s with set to 0. If the enumerator is not async-disposable it produces a single with set to 1. The states are only reserved in DEBUG builds. Debug info associated with to support EnC. The id of the generated await. The number of async state machine states to reserve. Any time multiple s might be associated with the same syntax node we need to make sure that the same number of state machine states gets allocated for the node, regardless of the actual number of s that get emitted. To do so one or more of the emitted s may reserve additional dummy state machine states so that the total number of states (one for each plus total reserved states) is constant regardless of semantics of the syntax node. E.g. `await foreach` produces at least one and at most two s: one for MoveNextAsync and the other for DisposeAsync. If the enumerator is async-disposable it produces two s with set to 0. If the enumerator is not async-disposable it produces a single with set to 1. The states are only reserved in DEBUG builds. The id of the generated await. The number of async state machine states to reserve. Any time multiple s might be associated with the same syntax node we need to make sure that the same number of state machine states gets allocated for the node, regardless of the actual number of s that get emitted. To do so one or more of the emitted s may reserve additional dummy state machine states so that the total number of states (one for each plus total reserved states) is constant regardless of semantics of the syntax node. E.g. `await foreach` produces at least one and at most two s: one for MoveNextAsync and the other for DisposeAsync. If the enumerator is async-disposable it produces two s with set to 0. If the enumerator is not async-disposable it produces a single with set to 1. The states are only reserved in DEBUG builds. Returns true if the collection expression contains any spreads. The number of elements up to and including the last spread element. If the length of the collection expression is known, this is the number of elements evaluated before any are added to the collection instance in lowering. True if all the spread elements are countable. Check if this is equivalent to the node, ignoring the input. Does this dag temp represent the original input of the pattern-matching operation? Check if this is equivalent to the node, ignoring the source. A list of all the nodes reachable from the root node, in a topologically sorted order. Rewrite a decision dag, using a mapping function that rewrites one node at a time. That function takes as its input the node to be rewritten and a function that returns the previously computed rewritten node for successor nodes. A trivial node replacement function for use with . Given a decision dag and a constant-valued input, produce a simplified decision dag that has removed all the tests that are unnecessary due to that constant value. This simplification affects flow analysis (reachability and definite assignment) and permits us to simplify the generated code. Returns true if calls and delegate invocations with this expression as the receiver should be non-virtual calls. Returns a serializable object that is used for displaying this expression in a diagnostic message. Returns true when conversion itself (not the operand) may have side-effects A typical side-effect of a conversion is an exception when conversion is unsuccessful. This method is intended for passes other than the LocalRewriter. Use MakeConversion helper method in the LocalRewriter instead, it generates a synthesized conversion in its lowered form. NOTE: This method is intended for passes other than the LocalRewriter. NOTE: Use MakeConversion helper method in the LocalRewriter instead, NOTE: it generates a synthesized conversion in its lowered form. Build an object creation expression without performing any rewriting Infer return type. If `nullableState` is non-null, nullability is also inferred and `NullableWalker.Analyze` uses that state to set the inferred nullability of variables in the enclosing scope. `conversions` is only needed when nullability is inferred. Indicates the type of return statement with no expression. Used in InferReturnType. Behavior of this function should be kept aligned with . Applies action to all the nested elements of this tuple. Returns the RefKind if the expression represents a symbol that has a RefKind, or RefKind.None otherwise. Indicates whether a bound local is also a declaration, and if so was it a declaration with an explicit or an inferred type. Ex: - In `M(x)`, `x` has `LocalDeclarationKind.None` - In `M(out int x)`, `x` has `LocalDeclarationKind.WithExplicitType` - In `M(out var x)`, `x` has `LocalDeclarationKind.WithInferredType` Set if the group has a receiver but one was not specified in syntax. Sequence points permit Syntax to be null. But all other contexts require a non-null Syntax, so we annotate it for the majority of uses. Captures the fact that consumers of the node already checked the state of the WasCompilerGenerated bit. Allows to assert on attempts to set WasCompilerGenerated bit after that. Captures the fact that the node was either converted to some type, or converted to its natural type. This is used to check the fact that every rvalue must pass through one of the two, so that expressions like tuple literals and switch expressions can reliably be rewritten once the target type is known. Set after checking if the property access should use the backing field directly. Determines if a bound node, or associated syntax or type has an error (not a warning) diagnostic associated with it. Typically used in the binder as a way to prevent cascading errors. In most other cases a more lightweight HasErrors should be used. Determines if a bound node, or any child, grandchild, etc has an error (not warning) diagnostic associated with it. The HasError bit is initially set for a node by providing it to the node constructor. If any child nodes of a node have the HasErrors bit set, then it is automatically set to true on the parent bound node. HasErrors indicates that the tree is not emittable and used to short-circuit lowering/emit stages. NOTE: not having HasErrors does not guarantee that we do not have any diagnostic associated with corresponding syntax or type. NOTE: not generally set in rewriters. Top level nullability for the node. This should not be used by flow analysis. This is for debugger display use only: will set the BoundNodeAttributes.WasTopLevelNullabilityChecked bit in the boundnode properties, which will break debugging. This allows the debugger to display the current value without setting the bit. Return a clone of the current node with the HasErrors flag set. Override this property to return the child bound nodes if the IOperation API corresponding to this bound node is not yet designed or implemented. Note that any of the child bound nodes may be null. Visits the binary operator tree of interpolated string additions in a depth-first pre-order visit, meaning parent, left, then right. controls whether to continue the visit by returning true or false: if true, the visit will continue. If false, the walk will be cut off. Rewrites a BoundBinaryOperator composed of interpolated strings (either converted or unconverted) iteratively, without recursion on the left side of the tree. Nodes of the tree are rewritten in a depth-first post-order fashion, meaning left, then right, then parent. The original top of the binary operations. The callback args. Rewriter for the BoundInterpolatedString or BoundUnconvertedInterpolatedString parts of the binary operator. Passed the callback parameter, the original interpolated string, and the index of the interpolated string in the tree. Rewriter for the BoundBinaryOperator parts fo the binary operator. Passed the callback parameter, the original binary operator, and the rewritten left and right components. Represents the operand type used for the result of a null-coalescing operator. Used when determining nullability. No valid type for operator. Type of left operand is used. Nullable underlying type of left operand is used. Type of right operand is used. Type of right operand is used and nullable left operand is converted to underlying type before converting to right operand type. Type of right operand is dynamic and is used. Sets to the inner pattern after stripping off outer s, and returns true if the original pattern is a negated form of the inner pattern. Consumers must provide implementation for . We should be intentional about behavior of derived classes regarding guarding against stack overflow. Note: do not use a static/singleton instance of this type, as it holds state. Note: do not use a static/singleton instance of this type, as it holds state. Called only for the first (in evaluation order) in the chain. A group is a common instance referenced by all BoundConversion instances generated from a single Conversion. The group is used by NullableWalker to determine which BoundConversion nodes should be considered as a unit. True if the conversion is an explicit conversion. The conversion (from Conversions.ClassifyConversionFromExpression for instance) from which all BoundConversions in the group were created. The target type of the conversion specified explicitly in source, or null if not an explicit conversion. For nodes that can generate an , this allows the Lazy implementation to get the children of this node on demand. The placeholders that are used for . Simple helper method to get the object creation expression for this data. This should only be used in scenarios where the data in is known to be valid, or it will throw. BoundExpressions to be used for emit. The expressions are assumed to be lowered and will not be visited by . A tree of binary operators for tuple comparisons. For (a, (b, c)) == (d, (e, f)) we'll hold a Multiple with two elements. The first element is a Single (describing the binary operator and conversions that are involved in a == d). The second element is a Multiple containing two Singles (one for the b == e comparison and the other for c == f). Holds the information for an element-wise comparison (like a == b as part of (a, ...) == (b, ...)) Holds the information for a tuple comparison, either at the top-level (like (a, b) == ...) or nested (like (..., (a, b)) == (..., ...)). Represents an element-wise null/null comparison. For instance, (null, ...) == (null, ...). Lambda binding state, recorded during testing only. Number of lambdas bound. Return the bound expression if the lambda has an expression body and can be reused easily. This is an optimization only. Implementations can return null to skip reuse. Produce a bound block for the expression returned from GetLambdaExpressionBody. Behavior of this key should be kept aligned with . What we need to do is find a *repeatable* arbitrary way to choose between two errors; we can for example simply take the one whose arguments are lower in alphabetical order when converted to a string. As an optimization, we compare error codes first and skip string comparison if they differ. In some cases returns are handled as gotos to return epilogue. This is used to track the state of the epilogue. Used to implement and . True if there was a anywhere in the method. This will affect whether or not we require the locals init flag to be marked, since locals init affects . Emits address as in & May introduce a temp which it will return. (otherwise returns null) Emit code for a conditional (aka ternary) operator. (b ? x : y) becomes push b if pop then goto CONSEQUENCE push y goto DONE CONSEQUENCE: push x DONE: May introduce a temp which it will return. (otherwise returns null) May introduce a temp which it will return. (otherwise returns null) Emits address of a temp. Used in cases where taking address directly is not possible (typically because expression does not have a home) Introduce a temp which it will return. May introduce a temp which it will return. (otherwise returns null) May introduce a temp which it will return. (otherwise returns null) Checks if expression directly or indirectly represents a value with its own home. In such cases it is possible to get a reference without loading into a temporary. Emits receiver in a form that allows member accesses ( O or & ). For verifier-reference types it is the actual reference. For the value types it is an address of the receiver. For generic types it is either a boxed receiver or the address of the receiver with readonly intent. addressKind - kind of address that is needed in case if receiver is not a reference type. May introduce a temp which it will return. (otherwise returns null) May introduce a temp which it will return. (otherwise returns null) Entry point to the array initialization. Assumes that we have newly created array on the stack. inits could be an array of values for a single dimensional array or an array (of array)+ of values for a multidimensional case in either case it is expected that number of leaf values will match number of elements in the array and nesting level should match the rank of the array. To handle array initialization of arbitrary rank it is convenient to approach multidimensional initialization as a recursively nested. ForAll{i, j, k} Init(i, j, k) ===> ForAll{i} ForAll{j, k} Init(i, j, k) ===> ForAll{i} ForAll{j} ForAll{k} Init(i, j, k) This structure is used for capturing initializers of a given index and the index value itself. Emits all initializers that match indices on the stack recursively. Example: if array has [0..2, 0..3, 0..2] shape and we have {1, 2} indices on the stack initializers for [1, 2, 0] [1, 2, 1] [1, 2, 2] will be emitted and the top index will be pushed off the stack as at that point we would be completely done with emitting initializers corresponding to that index. Determine if enum arrays can be initialized using block initialization. True if it's safe to use block initialization for enum arrays. In NetFx 4.0, block array initializers do not work on all combinations of {32/64 X Debug/Retail} when array elements are enums. This is fixed in 4.5 thus enabling block array initialization for a very common case. We look for the presence of which was introduced in .NET Framework 4.5 Count of all nontrivial initializers and count of those that are constants. Produces a serialized blob of all constant initializers. Non-constant initializers are matched with a zero of corresponding size. Check if it is a regular collection of expressions or there are nested initializers. Tries to emit a ReadOnlySpan construction as a wrapper for a blob rather than as a wrapper for an array construction. The type of the span being constructed. The expression being wrapped in a span. true if the result of the expression is used; false if it's required only for its side effects. A non-null expression if the construction is initializing an existing local in-place; otherwise, null. An output Boolean indicating whether a caller trying to perform in-place initialization should instead prefer to assign the local to a new value. Call sites may try to optimize an assignment to a newly-created struct by calling the constructor directly rather than assigning, but that may then inhibit the more valuable optimization of creating a span via RuntimeHelpers.CreateSpan, which needs to assign. When a caller has passed in an but CreateSpan could be used if it weren't, this method may return false and set to true to inform the caller it can try again without the . The expression for the offset into the array being wrapped in a span. The expression for the length of the subarray being wrapped in a span. true if this method successfully emit a ReadOnlySpan as a wrapper for a blob; otherwise, false. If false, nothing will have been emitted. And if false and is true (in which case must have been non-null), the caller may try again but with a null . Gets whether the element type of an array is appropriate for storing in a blob. Returns a byte blob that matches serialized content of single array initializer of constants. We must use a temp when there is a chance that evaluation of the call arguments could actually modify value of the reference type reciever. The call must use the original (unmodified) receiver. Defines sequence locals and record them so that they could be retained for the duration of the encompassing expression Use this when taking a reference of the sequence, which can indirectly refer to any of its locals. Closes the visibility/debug scopes for the sequence locals, but keep the local slots from reuse for the duration of the encompassing expression. Use this paired with DefineAndRecordLocals when taking a reference of the sequence, which can indirectly refer to any of its locals. Computes the desired refkind of the argument. Considers all the cases - where ref kinds are explicit, omitted, vararg cases. Used to decide if we need to emit call or callvirt. It basically checks if the receiver expression cannot be null, but it is not 100% precise. There are cases where it really can be null, but we do not care. checks if receiver is effectively ldarg.0 Used to decide if we need to emit 'call' or 'callvirt' for structure method. It basically checks if the method overrides any other and method's defining type is not a 'special' or 'special-by-ref' type. When array operation get long or ulong arguments the args should be cast to native int. Note that the cast is always checked. Recognizes constructors known to not have side-effects (which means they can be skipped unless the constructed object is used) Emit an element store instruction for a single dimensional array. Emit code for a conditional (aka ternary) operator. (b ? x : y) becomes push b if pop then goto CONSEQUENCE push y goto DONE CONSEQUENCE: push x DONE: Emit code for a null-coalescing operator. x ?? y becomes push x dup x if pop != null goto LEFT_NOT_NULL pop push y LEFT_NOT_NULL: Emits boolean expression without branching if possible (i.e., no logical operators, only comparisons). Leaves a boolean (int32, 0 or 1) value on the stack which conforms to sense, i.e., condition == sense. Produces opcode for a jump that corresponds to given operation and sense. Also produces a reverse opcode - opcode for the same condition with inverted sense. The interesting part in the following method is the support for exception filters. === Example: try { TryBlock } catch (ExceptionType ex) when (Condition) { Handler } gets emitted as something like ===> Try TryBlock Filter var tmp = Pop() as {ExceptionType} if (tmp == null) { Push 0 } else { ex = tmp Push Condition ? 1 : 0 } End Filter // leaves 1 or 0 on the stack Catch // gets called after finalization of nested exception frames if condition above produced 1 Pop // CLR pushes the exception object again variable ex can be used here Handler EndCatch When evaluating `Condition` requires additional statements be executed first, those statements are stored in `catchBlock.ExceptionFilterPrologueOpt` and emitted before the condition. Delegate to emit string compare call and conditional branch based on the compare result. Key to compare Node for diagnostics. Case constant to compare the key against Target label to branch to if key = stringConstant String equality method Delegate to emit ReadOnlySpanChar compare with string and conditional branch based on the compare result. Key to compare Node for diagnostics. Case constant to compare the key against Target label to branch to if key = stringConstant String equality method Gets already declared and initialized local. Gets the name and id of the local that are going to be generated into the debug metadata. Releases a local. Allocates a temp without identity. Frees a temp. Frees an optional temp. Clones all labels used in a finally block. This allows creating an emittable clone of finally. It is safe to do because no branches can go in or out of the finally handler. The argument is BoundTryStatement (and not a BoundBlock) specifically to support only Finally blocks where it is guaranteed to not have incoming or leaving branches. Perform IL specific optimizations (mostly reduction of local slots) Method body to optimize When set, do not perform aggressive optimizations that degrade debugging experience. In particular we do not do the following: 1) Do not elide any user defined locals, even if never read from. Example: { var dummy = Goo(); // should not become just "Goo" } User might want to examine dummy in the debugger. 2) Do not carry values on the stack between statements Example: { var temp = Goo(); temp.ToString(); // should not become Goo().ToString(); } User might want to examine temp in the debugger. Produced list of "ephemeral" locals. Essentially, these locals do not need to leave the evaluation stack. As such they do not require an allocation of a local slot and their load/store operations are implemented trivially. when current and other use spans are regular spans we can have only 2 conflict cases: [1, 3) conflicts with [0, 2) [1, 3) conflicts with [2, 4) NOTE: with regular spans, it is not possible for two spans to share an edge point unless they belong to the same local. (because we cannot access two real locals at the same time) specifically: [1, 3) does not conflict with [0, 1) since such spans would need to belong to the same local Dummy locals represent implicit control flow It is not allowed for a regular local span to cross into or be immediately adjacent to a dummy span. specifically: [1, 3) does conflict with [0, 1) since that would imply a value flowing into or out of a span surrounded by a branch/label Fixed-sized buffers are lowered as field accesses with pointer type, but we want to assign them to pinned ref locals before creating the pointer type, so this results in an assignment with mismatched types (pointer to managed ref). This is legal according to the CLR, but not how we usually represent things in lowering. Get the path name starting from the The command line arguments to a C# . Gets the compilation options for the C# created from the . Gets the parse options for the C# . Should the format of error messages include the line and column of the end of the offending text. Parses a command line. A collection of strings representing the command line arguments. The base directory used for qualifying file locations. The directory to search for mscorlib, or null if not available. A string representing additional reference paths. a commandlinearguments object representing the parsed command line. Diagnostic for the errorCode added if the warningOptions does not mention suppressed for the errorCode. Given a compilation and a destination directory, determine three names: 1) The name with which the assembly should be output. 2) The path of the assembly/module file. 3) The path of the pdb file. When csc produces an executable, but the name of the resulting assembly is not specified using the "/out" switch, the name is taken from the name of the file (note: file, not class) containing the assembly entrypoint (as determined by binding and the "/main" switch). For example, if the command is "csc /target:exe a.cs b.cs" and b.cs contains the entrypoint, then csc will produce "b.exe" and "b.pdb" in the output directory, with assembly name "b" and module name "b.exe" embedded in the file. Print compiler logo Print Commandline help message (up to 80 English characters per line) A binding for an attribute. Represents the result of binding an attribute constructor and the positional and named arguments. Creates an AttributeSemanticModel that allows asking semantic questions about an attribute node. Creates a speculative AttributeSemanticModel that allows asking semantic questions about an attribute node that did not appear in the original source code. Structure containing all semantic information about an await expression. Internal cache of built-in operators. Cache is compilation-specific because it uses compilation-specific SpecialTypes. The compilation object is an immutable representation of a single invocation of the compiler. Although immutable, a compilation is also on-demand, and will realize and cache data as necessary. A compilation can produce a new compilation from existing compilation with the application of small deltas. In many cases, it is more efficient than creating a new compilation from scratch, as the new compilation can reuse information from the old compilation. All imports (using directives and extern aliases) in syntax trees in this compilation. NOTE: We need to de-dup since the Imports objects that populate the list may be GC'd and re-created. Values are the sets of dependencies for corresponding directives. A conversions object that ignores nullability. Manages anonymous types declared in this compilation. Unifies types that are structurally equivalent. The for this compilation. Do not access directly, use Assembly property instead. This field is lazily initialized by ReferenceManager, ReferenceManager.CacheLockObject must be locked while ReferenceManager "calculates" the value and assigns it, several threads must not perform duplicate "calculation" simultaneously. Holds onto data related to reference binding. The manager is shared among multiple compilations that we expect to have the same result of reference binding. In most cases this can be determined without performing the binding. If the compilation however contains a circular metadata reference (a metadata reference that refers back to the compilation) we need to avoid sharing of the binding results. We do so by creating a new reference manager for such compilation. Contains the main method of this assembly, if there is one. Emit nullable attributes for only those members that are visible outside the assembly (public, protected, and if any [InternalsVisibleTo] attributes, internal members). If false, attributes are emitted for all members regardless of visibility. The set of trees for which a has been added to the queue. The set of trees for which enough analysis was performed in order to record usage of using directives. Once all trees are processed the value is set to null. Optional data collected during testing only. Used for instance for nullable analysis () and inferred delegate types (). Cache of T to Nullable<T>. Lazily caches SyntaxTrees by their mapped path. Used to look up the syntax tree referenced by an interceptor (temporary compat behavior). Must be removed prior to interceptors stable release. Lazily caches SyntaxTrees by their path. Used to look up the syntax tree referenced by an interceptor. Must be removed prior to interceptors stable release. Lazily caches SyntaxTrees by their xxHash128 checksum. Used to look up the syntax tree referenced by an interceptor. The options the compilation was created with. True when the compiler is run in "strict" mode, in which it enforces the language specification in some cases even at the expense of full compatibility. Such differences typically arise when earlier versions of the compiler failed to enforce the full language specification. True when the "peverify-compat" feature flag is set or the language version is below C# 7.2. With this flag we will avoid certain patterns known not be compatible with PEVerify. The code may be less efficient and may deviate from spec in corner cases. The flag is only to be used if PEVerify pass is extremely important. True when the "disable-length-based-switch" feature flag is set. When this flag is set, the compiler will not emit length-based switch for string dispatches. Returns true if nullable analysis is enabled in the text span represented by the syntax node. This overload is used for member symbols during binding, or for cases other than symbols such as attribute arguments and parameter defaults. Returns true if nullable analysis is enabled in the text span. This overload is used for member symbols during binding, or for cases other than symbols such as attribute arguments and parameter defaults. Returns true if nullable analysis is enabled for the method. For constructors, the region considered may include other constructors and field and property initializers. This overload is intended for callers that rely on symbols rather than syntax. The overload uses the cached value calculated during binding (from potentially several spans) from . Returns true if nullable analysis is enabled for all methods regardless of the actual nullable context. If this property returns true but IsNullableAnalysisEnabled returns false, any nullable analysis should be enabled but results should be ignored. For DEBUG builds, we treat nullable analysis as enabled for all methods unless explicitly disabled, so that analysis is run, even though results may be ignored, to increase the chance of catching nullable regressions (e.g. https://github.com/dotnet/roslyn/issues/40136). Returns Feature("run-nullable-analysis") as a bool? value: true for "always"; false for "never"; and null otherwise. The language version that was used to parse the syntax trees of this compilation. Creates a new compilation from scratch. Methods such as AddSyntaxTrees or AddReferences on the returned object will allow to continue building up the Compilation incrementally. Simple assembly name. The syntax trees with the source code for the new compilation. The references for the new compilation. The compiler options to use. A new compilation. Creates a new compilation that can be used in scripting. Create a duplicate of this compilation with different symbol instances. Creates a new compilation with the specified name. Creates a new compilation with the specified references. The new will query the given for the underlying metadata as soon as the are needed. The new compilation uses whatever metadata is currently being provided by the . E.g. if the current compilation references a metadata file that has changed since the creation of the compilation the new compilation is going to use the updated version, while the current compilation will be using the previous (it doesn't change). Creates a new compilation with the specified references. Creates a new compilation with the specified compilation options. Returns a new compilation with the given compilation set as the previous submission. Returns a new compilation with the given semantic model provider. Returns a new compilation with a given event queue. The syntax trees (parsed from source code) that this compilation was created with. Returns true if this compilation contains the specified tree. False otherwise. Creates a new compilation with additional syntax trees. Creates a new compilation with additional syntax trees. Creates a new compilation without the specified syntax trees. Preserves metadata info for use with trees added later. Creates a new compilation without the specified syntax trees. Preserves metadata info for use with trees added later. Creates a new compilation without any syntax trees. Preserves metadata info from this compilation for use with trees added later. Creates a new compilation without the old tree but with the new tree. Gets the or for a metadata reference used to create this compilation. or corresponding to the given reference or null if there is none. Uses object identity when comparing two references. All reference directives used in this compilation. Returns a metadata reference that a given #r resolves to. #r directive. Metadata reference the specified directive resolves to, or null if the doesn't match any #r directive in the compilation. Creates a new compilation with additional metadata references. Creates a new compilation with additional metadata references. Creates a new compilation without the specified metadata references. Creates a new compilation without the specified metadata references. Creates a new compilation without any metadata references Creates a new compilation with an old metadata reference replaced with a new metadata reference. Get all modules in this compilation, including the source module, added modules, and all modules of referenced assemblies that do not come from an assembly with an extern alias. Metadata imported from aliased assemblies is not visible at the source level except through the use of an extern alias directive. So exclude them from this list which is used to construct the global namespace. Return a list of assembly symbols than can be accessed without using an alias. For example: 1) /r:A.dll /r:B.dll -> A, B 2) /r:Goo=A.dll /r:B.dll -> B 3) /r:Goo=A.dll /r:A.dll -> A Gets the that corresponds to the assembly symbol. The AssemblySymbol that represents the assembly being created. The AssemblySymbol that represents the assembly being created. Get a ModuleSymbol that refers to the module being created by compiling all of the code. By getting the GlobalNamespace property of that module, all of the namespaces and types defined in source code can be obtained. Gets the root namespace that contains all namespaces and types defined in source code or in referenced metadata, merged into a single namespace hierarchy. Given for the specified module or assembly namespace, gets the corresponding compilation namespace (merged namespace representation for all namespace declarations and references with contributions for the namespaceSymbol). Can return null if no corresponding namespace can be bound in this compilation with the same name. A symbol representing the implicit Script class. This is null if the class is not defined in the compilation. Resolves a symbol that represents script container (Script class). Uses the full name of the container class stored in to find the symbol. The Script class symbol or null if it is not defined. Global imports (including those from previous submissions, if there are any). Global imports not including those from previous submissions. Imports declared by this submission (null if this isn't one). Imports from all previous submissions. Get the symbol for the predefined type from the COR Library referenced by this compilation. Given a provided , gives back constructed with that argument. This function is only intended to be used for very common instantiations produced heavily during binding. Specifically, the nullable versions of enums, and the nullable versions of core built-ins. So many of these are created that it's worthwhile to cache, keeping overall garbage low, while not ballooning the size of the cache itself. Get the symbol for the predefined type member from the COR Library referenced by this compilation. Gets the type within the compilation's assembly and all referenced assemblies (other than those that can only be referenced via an extern alias) using its canonical CLR metadata name. The TypeSymbol for the type 'dynamic' in this Compilation. The NamedTypeSymbol for the .NET System.Object type, which could have a TypeKind of Error if there was no COR Library in this Compilation. Checks if the method has an entry point compatible signature, i.e. - the return type is either void, int, or returns a , or where the return type of GetAwaiter().GetResult() is either void or int. - has either no parameter or a single parameter of type string[] Classifies a conversion from to . Source type of value to be converted Destination type of value to be converted A that classifies the conversion from the type to the type. Classifies a conversion from to according to this compilation's programming language. Source type of value to be converted Destination type of value to be converted A that classifies the conversion from the type to the type. Returns a new ArrayTypeSymbol representing an array type tied to the base types of the COR Library in this Compilation. Returns a new PointerTypeSymbol representing a pointer type tied to a type in this Compilation. Gets a new SyntaxTreeSemanticModel for the specified syntax tree. The bag in which semantic analysis should deposit its diagnostics. A bag in which diagnostics that should be reported after code gen can be deposited. Gets the diagnostics produced during the parsing stage of a compilation. There are no diagnostics for declarations or accessor or method bodies, for example. Gets the diagnostics produced during symbol declaration headers. There are no diagnostics for accessor or method bodies, for example. Gets the diagnostics produced during the analysis of method bodies and field initializers. Gets the all the diagnostics for the compilation, including syntax, declaration, and binding. Does not include any diagnostics that might be produced during emit. if file types are present in files with duplicate file paths. Otherwise, . if duplicate interceptions are present in the compilation. Otherwise, . Return true if there is a source declaration symbol name that meets given predicate. Return source declaration symbols whose name meets given predicate. Return true if there is a source declaration symbol name that matches the provided name. This will be faster than when predicate is just a simple string check. Return source declaration symbols whose name matches the provided name. This will be faster than when predicate is just a simple string check. is case sensitive. Returns if the compilation has all of the members necessary to emit metadata about dynamic types. Returns whether the compilation has the Boolean type and if it's good. Returns true if Boolean is present and healthy. Determine if enum arrays can be initialized using block initialization. True if it's safe to use block initialization for enum arrays. In NetFx 4.0, block array initializers do not work on all combinations of {32/64 X Debug/Retail} when array elements are enums. This is fixed in 4.5 thus enabling block array initialization for a very common case. We look for the presence of which was introduced in .NET Framework 4.5 An array of cached well known types available for use in this Compilation. Lazily filled by GetWellKnownType method. Lazy cache of well known members. Not yet known value is represented by ErrorTypeSymbol.UnknownResultType Returns a value indicating which embedded attributes should be generated during emit phase. The value is set during binding the symbols that need those attributes, and is frozen on first trial to get it. Freezing is needed to make sure that nothing tries to modify the value after the value is read. Lookup member declaration in well known type used by this Compilation. If a well-known member of a generic type instantiation is needed use this method to get the corresponding generic definition and to construct an instantiation. This method handles duplicate types in a few different ways: - for types before C# 7, the first candidate is returned with a warning - for types after C# 7, the type is considered missing - in both cases, when BinderFlags.IgnoreCorLibraryDuplicatedTypes is set, type from corlib will not count as a duplicate Synthesizes a custom attribute. Returns null if the symbol is missing, or any of the members in are missing. The attribute is synthesized only if present. Constructor of the attribute. If it doesn't exist, the attribute is not created. Arguments to the attribute constructor. Takes a list of pairs of well-known members and constants. The constants will be passed to the field/property referenced by the well-known member. If the well-known member does not exist in the compilation then no attribute will be synthesized. Indicates if this particular attribute application should be considered optional. Given a type , which is either dynamic type OR is a constructed type with dynamic type present in it's type argument tree, returns a synthesized DynamicAttribute with encoded dynamic transforms array. This method is port of AttrBind::CompileDynamicAttr from the native C# compiler. Used to generate the dynamic attributes for the required typesymbol. ReferenceManager encapsulates functionality to create an underlying SourceAssemblySymbol (with underlying ModuleSymbols) for Compilation and AssemblySymbols for referenced assemblies (with underlying ModuleSymbols) all properly linked together based on reference resolution between them. ReferenceManager is also responsible for reuse of metadata readers for imported modules and assemblies as well as existing AssemblySymbols for referenced assemblies. In order to do that, it maintains global cache for metadata readers and AssemblySymbols associated with them. The cache uses WeakReferences to refer to the metadata readers and AssemblySymbols to allow memory and resources being reclaimed once they are no longer used. The tricky part about reusing existing AssemblySymbols is to find a set of AssemblySymbols that are created for the referenced assemblies, which (the AssemblySymbols from the set) are linked in a way, consistent with the reference resolution between the referenced assemblies. When existing Compilation is used as a metadata reference, there are scenarios when its underlying SourceAssemblySymbol cannot be used to provide symbols in context of the new Compilation. Consider classic multi-targeting scenario: compilation C1 references v1 of Lib.dll and compilation C2 references C1 and v2 of Lib.dll. In this case, SourceAssemblySymbol for C1 is linked to AssemblySymbol for v1 of Lib.dll. However, given the set of references for C2, the same reference for C1 should be resolved against v2 of Lib.dll. In other words, in context of C2, all types from v1 of Lib.dll leaking through C1 (through method signatures, etc.) must be retargeted to the types from v2 of Lib.dll. In this case, ReferenceManager creates a special RetargetingAssemblySymbol for C1, which is responsible for the type retargeting. The RetargetingAssemblySymbols could also be reused for different Compilations, ReferenceManager maintains a cache of RetargetingAssemblySymbols (WeakReferences) for each Compilation. The only public entry point of this class is CreateSourceAssembly() method. Checks if the properties of are compatible with properties of . Reports inconsistencies to the given diagnostic bag. True if the properties are compatible and hence merged, false if the duplicate reference should not merge it's properties with primary reference. C# only considers culture when comparing weak identities. It ignores versions of weak identities and reports an error if there are two weak assembly references passed to a compilation that have the same simple name. Creates a from specified metadata. Used by EnC to create symbols for emit baseline. The PE symbols are used by . The assembly references listed in the metadata AssemblyRef table are matched to the resolved references stored on this . We assume that the dependencies of the baseline metadata are the same as the dependencies of the current compilation. This is not exactly true when the dependencies use time-based versioning pattern, e.g. AssemblyVersion("1.0.*"). In that case we assume only the version changed and nothing else. Each AssemblyRef is matched against the assembly identities using an exact equality comparison modulo version. AssemblyRef with lower version in metadata is matched to a PE assembly symbol with the higher version (provided that the assembly name, culture, PKT and flags are the same) if there is no symbol with the exactly matching version. If there are multiple symbols with higher versions selects the one with the minimal version among them. Matching to a higher version is necessary to support EnC for projects whose P2P dependencies use time-based versioning pattern. The versions of the dependent projects seen from the IDE will be higher than the one written in the metadata at the time their respective baselines are built. No other unification or further resolution is performed. A map of the PE assembly symbol identities to the identities of the original metadata AssemblyRefs. This map will be used in emit when serializing AssemblyRef table of the delta. For the delta to be compatible with the original metadata we need to map the identities of the PE assembly symbols back to the original AssemblyRefs (if different). In other words, we pretend that the versions of the dependencies haven't changed. Guarded by . Import options of the compilation being built. For testing purposes only. For testing purposes only. Represents a reference to another C# compilation. Returns the referenced Compilation. Create a metadata reference to a compilation. The compilation to reference. Extern aliases for this reference. Should interop types be embedded in the created assembly? Applies C#-specific modification and filtering of s. Modifies an input per the given options. For example, the severity may be escalated, or the may be filtered out entirely (by returning null). The input diagnostic The maximum warning level to allow. Diagnostics with a higher warning level will be filtered out. How warning diagnostics should be reported Whether Nullable Reference Types feature is enabled globally How specific diagnostics should be reported A diagnostic updated to reflect the options, or null if it has been filtered out Take a warning and return the final disposition of the given warning, based on both command line options and pragmas. The diagnostic options have precedence in the following order: 1. Warning level 2. Command line options (/nowarn, /warnaserror) 3. Custom severity configuration applied by analyzer 4. Editor config options (syntax tree level) 5. Global analyzer config options (compilation level) 6. Global warning level Pragmas are considered separately. If a diagnostic would not otherwise be suppressed, but is suppressed by a pragma, is true but the diagnostic is not reported as suppressed. Allows asking semantic questions about a tree of syntax nodes in a Compilation. Typically, an instance is obtained by a call to .. An instance of caches local symbols and semantic information. Thus, it is much more efficient to use a single instance of when asking multiple questions about a syntax tree, because information from the first question may be reused. This also means that holding onto an instance of SemanticModel for a long time may keep a significant amount of memory from being garbage collected. When an answer is a named symbol that is reachable by traversing from the root of the symbol table, (that is, from an of the ), that symbol will be returned (i.e. the returned value will be reference-equal to one reachable from the root of the symbol table). Symbols representing entities without names (e.g. array-of-int) may or may not exhibit reference equality. However, some named symbols (such as local variables) are not reachable from the root. These symbols are visible as answers to semantic questions. When the same SemanticModel object is used, the answers exhibit reference-equality. The compilation this object was obtained from. The root node of the syntax tree that this binding is based on. Gets symbol information about a syntax node. This is overridden by various specializations of SemanticModel. It can assume that CheckSyntaxNode and CanGetSemanticInfo have already been called, as well as that named argument nodes have been handled. The syntax node to get semantic information for. Options to control behavior. The cancellation token. Gets symbol information about the 'Add' method corresponding to an expression syntax within collection initializer. This is the worker function that is overridden in various derived kinds of Semantic Models. It can assume that CheckSyntaxNode has already been called and the is in the right place in the syntax tree. Gets type information about a syntax node. This is overridden by various specializations of SemanticModel. It can assume that CheckSyntaxNode and CanGetSemanticInfo have already been called, as well as that named argument nodes have been handled. The syntax node to get semantic information for. The cancellation token. Binds the provided expression in the given context. The position to bind at. The expression to bind How to speculatively bind the given expression. If this is then the provided expression should be a . The binder that was used to bind the given syntax. The symbols used in a cref. If this is not default, then the return is null. The expression that was bound. If is not default, this is null. Gets a list of method or indexed property symbols for a syntax node. This is overridden by various specializations of SemanticModel. It can assume that CheckSyntaxNode and CanGetSemanticInfo have already been called, as well as that named argument nodes have been handled. The syntax node to get semantic information for. The cancellation token. Gets a list of indexer symbols for a syntax node. This is overridden by various specializations of SemanticModel. It can assume that CheckSyntaxNode and CanGetSemanticInfo have already been called, as well as that named argument nodes have been handled. The syntax node to get semantic information for. The cancellation token. Gets the constant value for a syntax node. This is overridden by various specializations of SemanticModel. It can assume that CheckSyntaxNode and CanGetSemanticInfo have already been called, as well as that named argument nodes have been handled. The syntax node to get semantic information for. The cancellation token. Bind the given expression speculatively at the given position, and return back the resulting bound node. May return null in some error cases. Keep in sync with Binder.BindCrefParameterOrReturnType. Bind the given attribute speculatively at the given position, and return back the resulting bound node. May return null in some error cases. Gets the semantic information for an ordering clause in an orderby query clause. Gets the semantic information associated with a select or group clause. Gets the SymbolInfo for the Deconstruct method used for a deconstruction pattern clause, if any. Returns what symbol(s), if any, the given expression syntax bound to in the program. An AliasSymbol will never be returned by this method. What the alias refers to will be returned instead. To get information about aliases, call GetAliasInfo. If binding the type name C in the expression "new C(...)" the actual constructor bound to will be returned (or all constructor if overload resolution failed). This occurs as long as C unambiguously binds to a single type that has a constructor. If C ambiguously binds to multiple types, or C binds to a static class, then type(s) are returned. Given a variable designation (typically in the left-hand-side of a deconstruction declaration statement), figure out its type by looking at the declared symbol of the corresponding variable. Returns what 'Add' method symbol(s), if any, corresponds to the given expression syntax within . Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program. The syntax node to get semantic information for. The cancellation token. Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program. The syntax node to get semantic information for. The cancellation token. Returns what symbol(s), if any, the given attribute syntax bound to in the program. The syntax node to get semantic information for. The cancellation token. Gets the semantic information associated with a documentation comment cref. Binds the expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed expression. This syntax node need not and typically does not appear in the source code referred to by the SemanticModel instance. Indicates whether to binding the expression as a full expressions, or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then expression should derive from TypeSyntax. The symbol information for the topmost node of the expression. The passed in expression is interpreted as a stand-alone expression, as if it appeared by itself somewhere within the scope that encloses "position". is ignored if is within a documentation comment cref attribute value. Bind the attribute in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about an attribute that did not actually appear in the source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. In order to obtain the correct scoping rules for the attribute, position should be the Start position of the Span of the symbol that the attribute is being applied to. A syntax node that represents a parsed attribute. This syntax node need not and typically does not appear in the source code referred to SemanticModel instance. The semantic information for the topmost node of the attribute. Bind the constructor initializer in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code. NOTE: This will only work in locations where there is already a constructor initializer. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. Furthermore, it must be within the span of an existing constructor initializer. A syntax node that represents a parsed constructor initializer. This syntax node need not and typically does not appear in the source code referred to SemanticModel instance. The semantic information for the topmost node of the constructor initializer. Bind the constructor initializer in the context of the specified location and get semantic information about symbols. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code. NOTE: This will only work in locations where there is already a constructor initializer. A character position used to identify a declaration scope and accessibility. This character position must be within the span of an existing constructor initializer. A syntax node that represents a parsed constructor initializer. This syntax node need not and typically does not appear in the source code referred to SemanticModel instance. The semantic information for the topmost node of the constructor initializer. Bind the cref in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about a cref that did not actually appear in the source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. In order to obtain the correct scoping rules for the cref, position should be the Start position of the Span of the original cref. A syntax node that represents a parsed cref. This syntax node need not and typically does not appear in the source code referred to SemanticModel instance. SymbolInfo options. The semantic information for the topmost node of the cref. Gets type information about a constructor initializer. The syntax node to get semantic information for. The cancellation token. Gets type information about an expression. The syntax node to get semantic information for. The cancellation token. Gets type information about an attribute. The syntax node to get semantic information for. The cancellation token. Gets the conversion that occurred between the expression's type and type implied by the expression's context. Binds the expression in the context of the specified location and gets type information. This method is used to get type information about an expression that did not actually appear in the source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed expression. This syntax node need not and typically does not appear in the source code referred to by the SemanticModel instance. Indicates whether to binding the expression as a full expressions, or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then expression should derive from TypeSyntax. The type information for the topmost node of the expression. The passed in expression is interpreted as a stand-alone expression, as if it appeared by itself somewhere within the scope that encloses "position". Gets the conversion that occurred between the expression's type and type implied by the expression's context. Gets a list of method or indexed property symbols for a syntax node. The syntax node to get semantic information for. The cancellation token. Gets a list of method or indexed property symbols for a syntax node. The syntax node to get semantic information for. The cancellation token. Gets a list of method symbols for a syntax node. The syntax node to get semantic information for. The cancellation token. Returns the list of accessible, non-hidden indexers that could be invoked with the given expression as receiver. Potential indexer receiver. To cancel the computation. Accessible, non-hidden indexers. If the receiver is an indexer expression, the list will contain the indexers that could be applied to the result of accessing the indexer, not the set of candidates that were considered during construction of the indexer expression. Gets the semantic information associated with a query clause. If resolves to an alias name, return the AliasSymbol corresponding to A. Otherwise return null. Binds the name in the context of the specified location and sees if it resolves to an alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a name. This syntax node need not and typically does not appear in the source code referred to by the SemanticModel instance. Indicates whether to binding the name as a full expression, or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then expression should derive from TypeSyntax. The passed in name is interpreted as a stand-alone name, as if it appeared by itself somewhere within the scope that encloses "position". Gets the binder that encloses the position. Gets the MemberSemanticModel that contains the node. Given a position, locates the containing token. If the position is actually within the leading trivia of the containing token or if that token is EOF, moves one token to the left. Returns the start position of the resulting token. This has the effect of moving the position left until it hits the beginning of a non-EOF token. Throws an ArgumentOutOfRangeException if position is not within the root of this model. A convenience method that determines a position from a node. If the node is missing, then its position will be adjusted using CheckAndAdjustPosition. Gets the available named symbols in the context of the specified location and optional container. Only symbols that are accessible and visible from the given location are returned. The character position for determining the enclosing declaration scope and accessibility. The container to search for symbols within. If null then the enclosing declaration scope around position is used. The name of the symbol to find. If null is specified then symbols with any names are returned. Consider (reduced) extension methods. A list of symbols that were found. If no symbols were found, an empty list is returned. The "position" is used to determine what variables are visible and accessible. Even if "container" is specified, the "position" location is significant for determining which members of "containing" are accessible. Labels are not considered (see ). Non-reduced extension methods are considered regardless of the value of . Gets the available base type members in the context of the specified location. Akin to calling with the container set to the immediate base type of the type in which occurs. However, the accessibility rules are different: protected members of the base type will be visible. Consider the following example: public class Base { protected void M() { } } public class Derived : Base { void Test(Base b) { b.M(); // Error - cannot access protected member. base.M(); } } Protected members of an instance of another type are only accessible if the instance is known to be "this" instance (as indicated by the "base" keyword). The character position for determining the enclosing declaration scope and accessibility. The name of the symbol to find. If null is specified then symbols with any names are returned. A list of symbols that were found. If no symbols were found, an empty list is returned. The "position" is used to determine what variables are visible and accessible. Non-reduced extension methods are considered, but reduced extension methods are not. Gets the available named static member symbols in the context of the specified location and optional container. Only members that are accessible and visible from the given location are returned. Non-reduced extension methods are considered, since they are static methods. The character position for determining the enclosing declaration scope and accessibility. The container to search for symbols within. If null then the enclosing declaration scope around position is used. The name of the symbol to find. If null is specified then symbols with any names are returned. A list of symbols that were found. If no symbols were found, an empty list is returned. The "position" is used to determine what variables are visible and accessible. Even if "container" is specified, the "position" location is significant for determining which members of "containing" are accessible. Gets the available named namespace and type symbols in the context of the specified location and optional container. Only members that are accessible and visible from the given location are returned. The character position for determining the enclosing declaration scope and accessibility. The container to search for symbols within. If null then the enclosing declaration scope around position is used. The name of the symbol to find. If null is specified then symbols with any names are returned. A list of symbols that were found. If no symbols were found, an empty list is returned. The "position" is used to determine what variables are visible and accessible. Even if "container" is specified, the "position" location is significant for determining which members of "containing" are accessible. Does not return NamespaceOrTypeSymbol, because there could be aliases. Gets the available named label symbols in the context of the specified location and optional container. Only members that are accessible and visible from the given location are returned. The character position for determining the enclosing declaration scope and accessibility. The name of the symbol to find. If null is specified then symbols with any names are returned. A list of symbols that were found. If no symbols were found, an empty list is returned. The "position" is used to determine what variables are visible and accessible. Even if "container" is specified, the "position" location is significant for determining which members of "containing" are accessible. Gets the available named symbols in the context of the specified location and optional container. Only symbols that are accessible and visible from the given location are returned. The character position for determining the enclosing declaration scope and accessibility. The container to search for symbols within. If null then the enclosing declaration scope around position is used. The name of the symbol to find. If null is specified then symbols with any names are returned. Additional options that affect the lookup process. Ignore 'throughType' in accessibility checking. Used in checking accessibility of symbols accessed via 'MyBase' or 'base'. The "position" is used to determine what variables are visible and accessible. Even if "container" is specified, the "position" location is significant for determining which members of "containing" are accessible. Throws an argument exception if the passed lookup options are invalid. Remaps a local, parameter, localfunction, or lambda symbol, if that symbol or its containing symbols were reinferred. This should only be called when nullable semantic analysis is enabled. Determines if the symbol is accessible from the specified location. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. The symbol that we are checking to see if it accessible. True if "symbol is accessible, false otherwise. This method only checks accessibility from the point of view of the accessibility modifiers on symbol and its containing types. Even if true is returned, the given symbol may not be able to be referenced for other reasons, such as name hiding. Field-like events can be used as fields in types that can access private members of the declaring type of the event. Analyze control-flow within a part of a method body. The first statement to be included in the analysis. The last statement to be included in the analysis. An object that can be used to obtain the result of the control flow analysis. The two statements are not contained within the same statement list. Analyze control-flow within a part of a method body. The statement to be included in the analysis. An object that can be used to obtain the result of the control flow analysis. Analyze data-flow within an . The ctor-init within the associated SyntaxTree to analyze. An object that can be used to obtain the result of the data flow analysis. Analyze data-flow within an . The node within the associated SyntaxTree to analyze. An object that can be used to obtain the result of the data flow analysis. Analyze data-flow within an . The expression within the associated SyntaxTree to analyze. An object that can be used to obtain the result of the data flow analysis. Analyze data-flow within a part of a method body. The first statement to be included in the analysis. The last statement to be included in the analysis. An object that can be used to obtain the result of the data flow analysis. The two statements are not contained within the same statement list. Analyze data-flow within a part of a method body. The statement to be included in the analysis. An object that can be used to obtain the result of the data flow analysis. Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel and must be within the FullSpan of a Method body within the Root syntax node. A syntax node that represents a parsed method declaration. This method should not be present in the syntax tree associated with this object, but must have identical signature to the method containing the given in this SemanticModel. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel and must be within the FullSpan of a Method body within the Root syntax node. A syntax node that represents a parsed accessor declaration. This accessor should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with a type syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a type syntax that did not appear in source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed expression. This expression should not be present in the syntax tree associated with this object. Indicates whether to bind the expression as a full expression, or as a type or namespace. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with a statement that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a statement that did not appear in source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed statement. This statement should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with an initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a field initializer or default parameter value that did not appear in source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed initializer. This initializer should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation. Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with an expression body that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an expression body that did not appear in source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed expression body. This node should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation. Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code. NOTE: This will only work in locations where there is already a constructor initializer. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. Furthermore, it must be within the span of an existing constructor initializer. A syntax node that represents a parsed constructor initializer. This node should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation. Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code. NOTE: This will only work in locations where there is already a constructor initializer. A character position used to identify a declaration scope and accessibility. This character position must be within the span of an existing constructor initializer. A syntax node that represents a parsed constructor initializer. This node should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation. Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with a cref that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a cref that did not appear in source code. NOTE: This will only work in locations where there is already a cref. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. Furthermore, it must be within the span of an existing cref. A syntax node that represents a parsed cref syntax. This node should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation. Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. Get a SemanticModel object that is associated with an attribute that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an attribute that did not appear in source code. A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel. A syntax node that represents a parsed attribute. This attribute should not be present in the syntax tree associated with this object. A SemanticModel object that can be used to inquire about the semantic information associated with syntax nodes within . Flag indicating whether a speculative semantic model was created. Throws this exception if the node is contained any SyntaxTree in the current Compilation. Throws this exception if is null. Throws this exception if this model is a speculative semantic model, i.e. is true. Chaining of speculative semantic model is not supported. If this is a speculative semantic model, then returns its parent semantic model. Otherwise, returns null. The SyntaxTree that this object is associated with. Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression. An expression which much occur within the syntax tree associated with this object. The type to attempt conversion to. True if the conversion should be determined as for a cast expression. Returns a Conversion object that summarizes whether the conversion was possible, and if so, what kind of conversion it was. If no conversion was possible, a Conversion object with a false "Exists" property is returned. To determine the conversion between two types (instead of an expression and a type), use Compilation.ClassifyConversion. Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression. The character position for determining the enclosing declaration scope and accessibility. The expression to classify. This expression does not need to be present in the syntax tree associated with this object. The type to attempt conversion to. True if the conversion should be determined as for a cast expression. Returns a Conversion object that summarizes whether the conversion was possible, and if so, what kind of conversion it was. If no conversion was possible, a Conversion object with a false "Exists" property is returned. To determine the conversion between two types (instead of an expression and a type), use Compilation.ClassifyConversion. Determines what type of conversion, if any, would be used if a given expression was converted to a given type using an explicit cast. An expression which much occur within the syntax tree associated with this object. The type to attempt conversion to. Returns a Conversion object that summarizes whether the conversion was possible, and if so, what kind of conversion it was. If no conversion was possible, a Conversion object with a false "Exists" property is returned. To determine the conversion between two types (instead of an expression and a type), use Compilation.ClassifyConversion. Determines what type of conversion, if any, would be used if a given expression was converted to a given type using an explicit cast. The character position for determining the enclosing declaration scope and accessibility. The expression to classify. This expression does not need to be present in the syntax tree associated with this object. The type to attempt conversion to. Returns a Conversion object that summarizes whether the conversion was possible, and if so, what kind of conversion it was. If no conversion was possible, a Conversion object with a false "Exists" property is returned. To determine the conversion between two types (instead of an expression and a type), use Compilation.ClassifyConversion. Given a member declaration syntax, get the corresponding symbol. The syntax node that declares a member. The cancellation token. The symbol that was declared. NOTE: We have no GetDeclaredSymbol overloads for following subtypes of MemberDeclarationSyntax: NOTE: (1) GlobalStatementSyntax as they don't declare any symbols. NOTE: (2) IncompleteMemberSyntax as there are no symbols for incomplete members. NOTE: (3) BaseFieldDeclarationSyntax or its subtypes as these declarations can contain multiple variable declarators. NOTE: GetDeclaredSymbol should be called on the variable declarators directly. Given a local function declaration syntax, get the corresponding symbol. The syntax node that declares a member. The cancellation token. The symbol that was declared. Given a compilation unit syntax, get the corresponding Simple Program entry point symbol. The compilation unit that declares the entry point member. The cancellation token. The symbol that was declared. Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly. The syntax node that declares a namespace. The cancellation token. The namespace symbol that was declared by the namespace declaration. Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly. The syntax node that declares a namespace. The cancellation token. The namespace symbol that was declared by the namespace declaration. Given a type declaration, get the corresponding type symbol. The syntax node that declares a type. The cancellation token. The type symbol that was declared. NOTE: We have no GetDeclaredSymbol overloads for subtypes of BaseTypeDeclarationSyntax as all of them return a NamedTypeSymbol. Given a delegate declaration, get the corresponding type symbol. The syntax node that declares a delegate. The cancellation token. The type symbol that was declared. Given a enum member declaration, get the corresponding field symbol. The syntax node that declares an enum member. The cancellation token. The symbol that was declared. Given a base method declaration syntax, get the corresponding method symbol. The syntax node that declares a method. The cancellation token. The symbol that was declared. NOTE: We have no GetDeclaredSymbol overloads for subtypes of BaseMethodDeclarationSyntax as all of them return a MethodSymbol. Given a syntax node that declares a property, indexer or an event, get the corresponding declared symbol. The syntax node that declares a property, indexer or an event. The cancellation token. The symbol that was declared. Given a syntax node that declares a property, get the corresponding declared symbol. The syntax node that declares a property. The cancellation token. The symbol that was declared. Given a syntax node that declares an indexer, get the corresponding declared symbol. The syntax node that declares an indexer. The cancellation token. The symbol that was declared. Given a syntax node that declares a (custom) event, get the corresponding event symbol. The syntax node that declares a event. The cancellation token. The symbol that was declared. Given a syntax node of anonymous object creation initializer, get the anonymous object property symbol. The syntax node that declares a property. The cancellation token. The symbol that was declared. Given a syntax node of anonymous object creation expression, get the anonymous object type symbol. The syntax node that declares an anonymous object. The cancellation token. The symbol that was declared. Given a syntax node of a tuple expression, get the tuple type symbol. The tuple expression node. The cancellation token. The symbol that was declared. Given a syntax node of an argument expression, get the declared symbol. The argument syntax node. The cancellation token. The symbol that was declared. Generally ArgumentSyntax nodes do not declare symbols, except when used as arguments of a tuple literal. Example: var x = (Alice: 1, Bob: 2); ArgumentSyntax "Alice: 1" declares a tuple element field "(int Alice, int Bob).Alice" Given a syntax node that declares a property or member accessor, get the corresponding symbol. The syntax node that declares an accessor. The cancellation token. The symbol that was declared. Given a syntax node that declares an expression body, get the corresponding symbol. The syntax node that declares an expression body. The cancellation token. The symbol that was declared. Given a variable declarator syntax, get the corresponding symbol. The syntax node that declares a variable. The cancellation token. The symbol that was declared. Given a variable designation syntax, get the corresponding symbol. The syntax node that declares a variable. The cancellation token. The symbol that was declared. Given a labeled statement syntax, get the corresponding label symbol. The syntax node of the labeled statement. The cancellation token. The label symbol for that label. Given a switch label syntax, get the corresponding label symbol. The syntax node of the switch label. The cancellation token. The label symbol for that label. Given a using declaration get the corresponding symbol for the using alias that was introduced. The cancellation token. The alias symbol that was declared. If the using directive is an error because it attempts to introduce an alias for which an existing alias was previously declared in the same scope, the result is a newly-constructed AliasSymbol (i.e. not one from the symbol table). Given an extern alias declaration get the corresponding symbol for the alias that was introduced. The cancellation token. The alias symbol that was declared, or null if a duplicate alias symbol was declared. Given a parameter declaration syntax node, get the corresponding symbol. The syntax node that declares a parameter. The cancellation token. The parameter that was declared. Given a base field declaration syntax, get the corresponding symbols. The syntax node that declares one or more fields or events. The cancellation token. The symbols that were declared. Given a type parameter declaration (field or method), get the corresponding symbol The cancellation token. Given a foreach statement, get the symbol for the iteration variable Given a local symbol, gets an updated version of that local symbol adjusted for nullability analysis if the analysis affects the local. The original symbol from initial binding. The nullability-adjusted local, or the original symbol if the nullability analysis made no adjustments or was not run. Given a catch declaration, get the symbol for the exception variable Get the query range variable declared in a join into clause. Get the query range variable declared in a query continuation clause. Returns a list of accessible, non-hidden indexers that could be invoked with the given expression as a receiver. If the given expression is an indexer access, then this method will return the list of indexers that could be invoked on the result, not the list of indexers that were considered. The method group can contain "duplicate" symbols that we do not want to display in the IDE analysis. For example, there could be an overriding virtual method and the method it overrides both in the method group. This, strictly speaking, is a violation of the C# specification because we are supposed to strip out overriding methods from the method group before overload resolution; overload resolution is supposed to treat overridden methods as being methods of the less derived type. However, in the IDE we want to display information about the overriding method, not the overridden method, and therefore we leave both in the method group. The overload resolution algorithm has been written to handle this departure from the specification. Similarly, we might have two methods in the method group where one is a "new" method that hides another. Again, in overload resolution this would be handled by the rule that says that methods declared on more derived types take priority over methods declared on less derived types. Both will be in the method group, but in the IDE we want to only display information about the hiding method, not the hidden method. We can also have "diamond" inheritance of interfaces leading to multiple copies of the same method ending up in the method group: interface IB { void M(); } interface IL : IB {} interface IR : IB {} interface ID : IL, IR {} ... id.M(); We only want to display one symbol in the IDE, even if the member lookup algorithm is unsophisticated and puts IB.M in the member group twice. (Again, this is a mild spec violation since a method group is supposed to be a set, without duplicates.) Finally, the interaction of multiple inheritance of interfaces and hiding can lead to some subtle situations. Suppose we make a slight modification to the scenario above: interface IL : IB { new void M(); } Again, we only want to display one symbol in the method group. The fact that there is a "path" to IB.M from ID via IR is irrelevant; if the symbol IB.M is hidden by IL.M then it is hidden in ID, period. Get the semantic info of a named argument in an invocation-like expression (e.g. `x` in `M(x: 3)`) or the name in a Subpattern (e.g. either `Name` in `e is (Name: 3){Name: 3}`). Find the first parameter named "argumentName". If the call represents an extension method invocation with an explicit receiver, return the original methods as ReducedExtensionMethodSymbols. Otherwise, return the original methods unchanged. If the call represents an extension method with an explicit receiver, return a ReducedExtensionMethodSymbol if it can be constructed. Otherwise, return the original call method. Gets for each statement info. The node. Gets for each statement info. The node. Gets deconstruction assignment info. The node. Gets deconstruction foreach info. The node. Gets await expression info. The node. If the given node is within a preprocessing directive, gets the preprocessing symbol info for it. Preprocessing symbol identifier node. Options to control the internal working of GetSymbolInfoWorker. Not currently exposed to public clients, but could be if desired. When binding "C" new C(...), return the type C and do not return information about which constructor was bound to. Bind "new C(...)" to get information about which constructor was chosen. When binding "C" new C(...), return the constructor of C that was bound to, if C unambiguously binds to a single type with at least one constructor. When binding a name X that was declared with a "using X=OtherTypeOrNamespace", return OtherTypeOrNamespace. When binding a name X that was declared with a "using X=OtherTypeOrNamespace", return the alias symbol X. Given a position in the SyntaxTree for this SemanticModel returns the innermost NamedType that the position is considered inside of. Given a tuple element syntax, get the corresponding symbol. The syntax node that declares a tuple element. The cancellation token. The symbol that was declared. The representation of a deconstruction as a tree of Deconstruct methods and conversions. Methods only appear in non-terminal nodes. All terminal nodes have a Conversion. Here's an example: A deconstruction like (int x1, (long x2, long x3)) = deconstructable1 with Deconstructable1.Deconstruct(out int y1, out Deconstructable2 y2) and Deconstructable2.Deconstruct(out int z1, out int z2) is represented as 5 DeconstructionInfo nodes. The top-level node has a (Deconstructable1.Deconstruct), no , but has two nodes. Its first nested node has no , but has a (Identity). Its second nested node has a (Deconstructable2.Deconstruct), no , and two nodes. Those last two nested nodes have no , but each have a (ImplicitNumeric, from int to long). The Deconstruct method (if any) for this non-terminal position in the deconstruction tree. The conversion for a terminal position in the deconstruction tree. The children for this deconstruction node. Structure containing all semantic information about a for each statement. Whether this is an asynchronous foreach. Gets the "GetEnumerator" method. Gets the "MoveNext" method (or "MoveNextAsync" in an asynchronous foreach). Gets the "Current" property. Gets the "Dispose" method (or "DisposeAsync" in an asynchronous foreach). The intermediate type to which the output of the is converted before being converted to the iteration variable type. As you might hope, for an array, it is the element type of the array. The conversion from the to the iteration variable type. May be user-defined. The conversion from the type of the to the . Initializes a new instance of the structure. A binding for a field initializer, property initializer, constructor initializer, or a parameter default value. Represents the result of binding a value expression rather than a block (for that, use a ). Creates a SemanticModel for a true field initializer (field = value) of a named type (incl. Enums). Creates a SemanticModel for an autoprop initializer of a named type Creates a SemanticModel for a parameter default value. Creates a speculative SemanticModel for an initializer node (field initializer, constructor initializer, or parameter default value) that did not appear in the original source code. This is an implementation of a special symbol comparer, which is supposed to be used for sorting original definition symbols (explicitly or implicitly declared in source within the same compilation) in lexical order of their declarations. It will not work on anything that uses non-source locations. Binding info for expressions and statements that are part of a member declaration. Instances of this class should not be exposed to external consumers. The member symbol This will cause the bound node cache to be populated if nullable semantic analysis is enabled. Get the bound node corresponding to the root. Get the highest bound node in the tree associated with a particular syntax node. Get the lowest bound node in the tree associated with a particular syntax node. Lowest is defined as last in a pre-order traversal of the bound tree. Internal for test purposes only This overload exists for callers who already have a node in hand and don't want to search through the tree. Returned binder doesn't need to have set - the caller will add it. Performs the same function as GetEnclosingBinder, but is known to take place within a specified lambda. Walks up the syntax hierarchy until a node with an associated binder is found. CONSIDER: can this share code with MemberSemanticModel.GetEnclosingBinder? Returned binder doesn't need to have set - the caller will add it. If we're doing nullable analysis, we need to fully bind this member, and then run nullable analysis on the resulting nodes before putting them in the map. Nullable analysis does not run a subset of code, so we need to fully bind the entire member first Rewrites the given bound node with nullability information, and returns snapshots for later speculative analysis at positions inside this member. Performs the analysis step of getting nullability information for a semantic model but does not actually use the results. This gives us extra verification of nullable flow analysis. It is only used in contexts where nullable analysis is disabled in the compilation but requested through "run-nullable-analysis=always" or when the compiler is running in DEBUG. Get all bounds nodes associated with a node, ordered from highest to lowest in the bound tree. Strictly speaking, the order is that of a pre-order traversal of the bound tree. If the node is an expression, return the nearest parent node with semantic meaning. Otherwise return null. The incremental binder is used when binding statements. Whenever a statement is bound, it checks the bound node cache to see if that statement was bound, and returns it instead of rebinding it. For example, we might have: while (x > goo()) { y = y * x; z = z + y; } We might first get semantic info about "z", and thus bind just the statement "z = z + y". Later, we might bind the entire While block. While binding the while block, we can reuse the binding we did of "z = z + y". NOTE: any member overridden by this binder should follow the BuckStopsHereBinder pattern. Otherwise, a subsequent binder in the chain could suppress the caching behavior. We override GetBinder so that the BindStatement override is still in effect on nested binders. Walks the bound tree and adds all non compiler generated bound nodes whose syntax matches the given one to the cache. The root of the bound tree. The cache. The syntax node where to add bound nodes for. Decides whether to the add the bound node to the cache or not. The bound node. Allows asking semantic questions about a TypeSyntax (or its descendants) within a member, that did not appear in the original source code. Typically, an instance is obtained by a call to SemanticModel.TryGetSpeculativeSemanticModel. Creates a speculative SemanticModel for a TypeSyntax node at a position within an existing MemberSemanticModel. Initial state for a MethodBodySemanticModel. Shared between here and the . Used to make a with the required syntax and optional precalculated starting state for the model. Creates a SemanticModel for the method. Creates a speculative SemanticModel for a method body that did not appear in the original source code. Creates a speculative SemanticModel for an expression body that did not appear in the original source code. Creates a speculative SemanticModel for a constructor initializer that did not appear in the original source code. Creates a speculative SemanticModel for a constructor initializer that did not appear in the original source code. Instances of this can be exposed to external consumers. Other types of are not designed for direct exposure and their implementation might not be able to handle external requests properly. Semantic information associated with a query clause in a C# query expression. The .Cast<T>() operation generated from the query range variable's type restriction, or null if the type restriction isn't specified. The operation, when present is implemented via . To access the type, when this is non-null use [0]. If it is an extension method, it is returned in reduced form. The operation (e.g. Select(), Where(), etc) that implements the given clause. The clause can be implemented via , or or that return a delegate. If it is an extension method, it is returned in reduced form. Instances of this type represent user-facing speculative semantic models that are backed by internal . Allows asking semantic questions about a tree of syntax nodes that did not appear in the original source code. Typically, an instance is obtained by a call to SemanticModel.TryGetSpeculativeSemanticModel. Appends all trees (including any trees from #load'ed files). Collects all the trees #load'ed by (as well as itself) and populates with all the trees that are safe to remove (not #load'ed by any other tree). Mapping from a syntax tree to the last fully computed member names for each the types (in lexical order) for this file. Specifically, the key of the collection is the tree the data is cached for. The is a compact array of items, each of which corresponds to the prior type-declaration in the tree that contributed members (in lexical order). Each item in that compact array is then the member names for that particular type declaration. Member names often don't change for most edits, so being able to reuse the same set from the last time things were computed saves on a lot of memory churn producing the new set, then GC'ing the last set (esp. for very large types). The value is stored as a as the most common case for most files is a single type declaration. We store this with weak references so that we can obtain this optimization in the common case where the old declaration is still around rooting the old names. If the decls are gone though, the names are subject to being cleaned up by the GC and we may not be able to use them. Allows asking semantic questions about any node in a SyntaxTree within a Compilation. Allows asking semantic questions about any node in a SyntaxTree within a Compilation. Note, the name of this field could be somewhat confusing because it is also used to store models for attributes and default parameter values, which are not members. The compilation this object was obtained from. The root node of the syntax tree that this object is associated with. The SyntaxTree that this object is associated with. Returns true if this is a SemanticModel that ignores accessibility rules when answering semantic questions. Gets the enclosing binder associated with the node Internal for test purposes only Given a type declaration, get the corresponding type symbol. The syntax node that declares a type. The cancellation token. The type symbol that was declared. NOTE: We have no GetDeclaredSymbol overloads for subtypes of BaseTypeDeclarationSyntax as all of them return a NamedTypeSymbol. Given a delegate declaration, get the corresponding type symbol. The syntax node that declares a delegate. The cancellation token. The type symbol that was declared. Given a member declaration syntax, get the corresponding symbol. The syntax node that declares a member. The cancellation token. The symbol that was declared. NOTE: We have no GetDeclaredSymbol overloads for following subtypes of MemberDeclarationSyntax: NOTE: (1) GlobalStatementSyntax as they don't declare any symbols. NOTE: (2) IncompleteMemberSyntax as there are no symbols for incomplete members. NOTE: (3) BaseFieldDeclarationSyntax or its subtypes as these declarations can contain multiple variable declarators. NOTE: GetDeclaredSymbol should be called on the variable declarators directly. Given a local function declaration syntax, get the corresponding symbol. The syntax node that declares a member. The cancellation token. The symbol that was declared. Given a enum member declaration, get the corresponding field symbol. The syntax node that declares an enum member. The cancellation token. The symbol that was declared. Given a base method declaration syntax, get the corresponding method symbol. The syntax node that declares a method. The cancellation token. The symbol that was declared. NOTE: We have no GetDeclaredSymbol overloads for subtypes of BaseMethodDeclarationSyntax as all of them return a MethodSymbol. Given a syntax node that declares a property, indexer or an event, get the corresponding declared symbol. The syntax node that declares a property, indexer or an event. The cancellation token. The symbol that was declared. Given a syntax node that declares a property, get the corresponding declared symbol. The syntax node that declares a property, indexer or an event. The cancellation token. The symbol that was declared. Given a syntax node that declares an indexer, get the corresponding declared symbol. The syntax node that declares an indexer. The cancellation token. The symbol that was declared. Given a syntax node that declares a (custom) event, get the corresponding event symbol. The syntax node that declares a event. The cancellation token. The symbol that was declared. Given a syntax node that declares a property or member accessor, get the corresponding symbol. The syntax node that declares an accessor. The cancellation token. The symbol that was declared. Finds the member in the containing symbol which is inside the given declaration span. if the result is known to be a (e.g. when the caller is ; otherwise, if the symbol kind is either unknown or known to not be a . Given a variable declarator syntax, get the corresponding symbol. The syntax node that declares a variable. The cancellation token. The symbol that was declared. Given a labeled statement syntax, get the corresponding label symbol. The syntax node of the labeled statement. The cancellation token. The label symbol for that label. Given a switch label syntax, get the corresponding label symbol. The syntax node of the switch label. The cancellation token. The label symbol for that label. Given a using declaration get the corresponding symbol for the using alias that was introduced. The cancellation token. The alias symbol that was declared. If the using directive is an error because it attempts to introduce an alias for which an existing alias was previously declared in the same scope, the result is a newly-constructed AliasSymbol (i.e. not one from the symbol table). Given an extern alias declaration get the corresponding symbol for the alias that was introduced. The cancellation token. The alias symbol that was declared, or null if a duplicate alias symbol was declared. Given a base field declaration syntax, get the corresponding symbols. The syntax node that declares one or more fields or events. The cancellation token. The field symbols that were declared. Given a parameter declaration syntax node, get the corresponding symbol. The syntax node that declares a parameter. The cancellation token. The parameter that was declared. Given a type parameter declaration (on a type or method), get the corresponding symbol The type of the expression represented by the syntax node. For expressions that do not have a type, null is returned. If the type could not be determined due to an error, than an object derived from ErrorTypeSymbol is returned. The type of the expression after it has undergone an implicit conversion. If the type did not undergo an implicit conversion, returns the same as Type. If the expression underwent an implicit conversion, return information about that conversion. Otherwise, returns an identity conversion. Manages anonymous types created in owning compilation. All requests for anonymous type symbols go via the instance of this class. Manages anonymous types created on module level. All requests for anonymous type symbols go via the instance of this class, the symbol will be either created or returned from cache. Represents an anonymous type constructor. Represents a getter for anonymous type property. Represents an anonymous type 'Equals' method. Represents an anonymous type 'GetHashCode' method. Represents an anonymous type 'ToString' method. Current compilation Given anonymous type descriptor provided constructs an anonymous type symbol. Get a symbol of constructed anonymous type property by property index Retrieves anonymous type field types. Given an anonymous type and new field types construct a new anonymous type symbol; a new type symbol will reuse type descriptor from the constructed type with new type arguments. Reports all use site errors in special or well known symbols required for anonymous types true if there was at least one error Cache of created anonymous type templates used as an implementation of anonymous types in emit phase. Maps delegate signature shape (number of parameters and their ref-ness) to a synthesized generic delegate symbol. Currently used for dynamic call-sites and inferred delegate types whose signature doesn't match any of the well-known Func or Action types. Given anonymous type provided constructs an implementation type symbol to be used in emit phase; if the anonymous type has at least one field the implementation type symbol will be created based on a generic type template generated for each 'unique' anonymous type structure, otherwise the template type will be non-generic. Resets numbering in anonymous type names and compiles the anonymous type methods. Also seals the collection of templates. The set of anonymous type templates created by this AnonymousTypeManager, in fixed order. The set of synthesized delegates created by this AnonymousTypeManager. Returns all templates owned by this type manager Returns true if the named type is an implementation template for an anonymous type Retrieves methods of anonymous type template which are not placed to symbol table. In current implementation those are overridden 'ToString', 'Equals' and 'GetHashCode' Translates anonymous type public symbol into an implementation type symbol to be used in emit. Translates anonymous type method symbol into an implementation method symbol to be used in emit. Comparator being used for stable ordering in anonymous type or delegate indices. Anonymous type manager owning this template Anonymous type descriptor Represents an anonymous type 'public' symbol which is used in binding and lowering. In emit phase it is being substituted with implementation symbol. Properties defined in the type Maps member names to symbol(s) True if name of the delegate is indexed by source order (<>f__AnonymousDelegate0, 1, ...) instead of being fully determined by signature of the delegate (<>A, <>F). A delegate type where the parameter types and return type of the delegate signature are type parameters. A delegate type where the parameter types and return type of the delegate signature are type parameters but some information cannot be serialized into its name (like default parameter values). A delegate type where at least one of the parameter types or return type of the delegate signature is a fixed type not a type parameter. Represents a baking field for an anonymous type template property symbol. Represents an anonymous type template's property symbol. Represents a base implementation for anonymous type synthesized methods. Represents an anonymous type 'template' which is a generic type to be used for all anonymous types having the same structure, i.e. the same number of fields and field names. This list consists of synthesized method symbols for ToString, Equals and GetHashCode which are not part of symbol table Properties defined in the template Maps member names to symbol(s) Returns a synthesized debugger display attribute or null if one could not be synthesized. Name to be used as metadata name during emit Smallest location of the template, actually contains the smallest location of all the anonymous type instances created using this template during EMIT Anonymous type manager owning this template Smallest location of the template, actually contains the smallest location of all the anonymous type instances created using this template during EMIT; NOTE: if this property is queried, smallest location must not be null. In emit phase every time a created anonymous type is referenced we try to store the lowest location of the template. It will be used for ordering templates and assigning emitted type names. Represents an anonymous type template's type parameter. Represents a compiler generated synthesized method symbol representing string switch hash function Compute the hashcode of a sub string using FNV-1a See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function This method should be kept consistent with MethodBodySynthesizer.ConstructStringSwitchHashFunctionBody The control flow in this method mimics lowered "for" loop. It is exactly what we want to emit to ensure that JIT can do range check hoisting. This method should be kept consistent with The synthesized method for computing the hash from a ReadOnlySpan<char> or Span<char>. Matches the corresponding method for string . This method should be kept consistent with When C# interface implementation differs from CLR interface implementation, we insert a synthesized explicit interface implementation that delegates to the method that C# considers an implicit implementation. There are two key scenarios for this: 1) A single source method is implicitly implementing one or more interface methods from metadata and the interface methods have different custom modifiers. In this case, we explicitly implement the interface methods and have (all) implementations delegate to the source method. 2) A non-virtual, non-source method in a base type is implicitly implementing an interface method. Since we can't change the "virtualness" of the non-source method, we introduce an explicit implementation that delegates to it instead. Given a SynthesizedExplicitImplementationMethod (effectively a tuple (interface method, implementing method, implementing type)), construct a BoundBlock body. Consider the tuple (Interface.Goo, Base.Goo, Derived). The generated method will look like: R Interface.Goo<T1, T2, ...>(A1 a1, A2 a2, ...) { //don't return the output if the return type is void return this.Goo<T1, T2, ...>(a1, a2, ...); } If a sealed override property defines fewer accessors than the original virtual property, it is necessary to synthesize a sealed accessor so that the accessor will not be overridable from metadata. Given a SynthesizedSealedPropertyAccessor (an accessor with a reference to the accessor it overrides), construct a BoundBlock body. a bound node rewriter that rewrites types properly (which in some cases the automatically-generated base class does not). This is used in the lambda rewriter, the iterator rewriter, and the async rewriter. A wrapper method that is created for non-virtually calling a base-class virtual method from other classes (like those created for lambdas...). Given a SynthesizedSealedPropertyAccessor (an accessor with a reference to the accessor it overrides), construct a BoundBlock body. A not-null collection of synthesized methods generated for the current source type. Returns true if the specified local/parameter needs to be hoisted to a field. Variable may be hoisted even if it is not captured, to improve debugging experience. Contains methods related to synthesizing bound nodes in lowered form that does not need any processing before passing to codegen Given a set of fields, produce an expression that is true when all of the given fields on `this` are equal to the fields on according to the default EqualityComparer. Construct a body for a method containing a call to a single other method with the same signature (modulo name). Bound node factory. Method to invoke in constructed body. True for "base.", false for "this.". Body for implementedMethod. An ArrayTypeSymbol represents an array type, such as int[] or object[,]. Gets the number of dimensions of the array. A regular single-dimensional array has rank 1, a two-dimensional array has rank 2, etc. Is this a zero-based one-dimensional array, i.e. SZArray in CLR terms. Specified sizes for dimensions, by position. The length can be less than , meaning that some trailing dimensions don't have the size specified. The most common case is none of the dimensions have the size specified - an empty array is returned. Specified lower bounds for dimensions, by position. The length can be less than , meaning that some trailing dimensions don't have the lower bound specified. The most common case is all dimensions are zero bound - a default array is returned in this case. Note, equality should be checked separately!!! Normally C# arrays have default sizes and lower bounds - sizes are not specified and all dimensions are zero bound. This property should return false for any deviations. Gets the type of the elements stored in the array along with its annotations. Gets the type of the elements stored in the array. Represents SZARRAY - zero-based one-dimensional array SZArray is an array type encoded in metadata with ELEMENT_TYPE_SZARRAY (always single-dim array with 0 lower bound). Non-SZArray type is encoded in metadata with ELEMENT_TYPE_ARRAY and with optional sizes and lower bounds. Even though non-SZArray can also be a single-dim array with 0 lower bound, the encoding of these types in metadata is distinct. Represents MDARRAY - multi-dimensional array (possibly of rank 1) Represents an attribute applied to a Symbol. Gets the attribute class being applied. Gets the constructor used in this application of the attribute. Gets a reference to the source for this application of the attribute. Returns null for applications of attributes on metadata Symbols. Gets the list of constructor arguments specified by this application of the attribute. This list contains both positional arguments and named arguments that are formal parameters to the constructor. Gets the list of named field or property value arguments specified by this application of the attribute. Compares the namespace and type name with the attribute's namespace and type name. Returns true if they are the same. Checks if an applied attribute with the given attributeType matches the namespace name and type name of the given early attribute's description and the attribute description has a signature with parameter count equal to the given attribute syntax's argument list count. NOTE: We don't allow early decoded attributes to have optional parameters. Returns the that represents the current AttributeData. A that represents the current AttributeData. Gets the attribute class being applied as an Gets the constructor used in this application of the attribute as an . Gets a reference to the source for this application of the attribute. Returns null for applications of attributes on metadata Symbols. Decodes PermissionSetAttribute applied in source to determine if it needs any fixup during codegen. PermissionSetAttribute needs fixup when it contains an assignment to the 'File' property as a single named attribute argument. Fixup performed is ported from SecurityAttributes::FixUpPermissionSetAttribute. It involves following steps: 1) Verifying that the specified file name resolves to a valid path. 2) Reading the contents of the file into a byte array. 3) Convert each byte in the file content into two bytes containing hexadecimal characters. 4) Replacing the 'File = fileName' named argument with 'Hex = hexFileContent' argument, where hexFileContent is the converted output from step 3) above. Step 1) is performed in this method, i.e. during binding. Remaining steps are performed during serialization as we want to avoid retaining the entire file contents throughout the binding/codegen pass. See for remaining fixup steps. String containing the resolved file path if PermissionSetAttribute needs fixup during codegen, null otherwise. This method determines if an applied attribute must be emitted. Some attributes appear in symbol model to reflect the source code, but should not be emitted. Represents a custom modifier (modopt/modreq). A type used as a tag that indicates which type of modification applies. Represents an event. The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. The type of the event along with its annotations. The type of the event. The 'add' accessor of the event. Null only in error scenarios. The 'remove' accessor of the event. Null only in error scenarios. Returns true if this symbol requires an instance reference as the implicit receiver. This is false if the symbol is static. True if this is a Windows Runtime-style event. A normal C# event, "event D E", has accessors void add_E(D d) void remove_E(D d) A Windows Runtime event, "event D E", has accessors EventRegistrationToken add_E(D d) void remove_E(EventRegistrationToken t) True if the event itself is excluded from code coverage instrumentation. True for source events marked with . True if this symbol has a special name (metadata flag SpecialName is set). Gets the attributes on event's associated field, if any. Returns an empty if there are no attributes. This publicly exposes the attributes of the internal backing field. Returns the overridden event, or null. Source: Was the member name qualified with a type name? Metadata: Is the member an explicit implementation? Will not always agree with ExplicitInterfaceImplementations.Any() (e.g. if binding of the type part of the name fails). Returns interface events explicitly implemented by this event. Events imported from metadata can explicitly implement more than one event. Gets the kind of this symbol. Implements visitor pattern. Represents a field in a class, struct or enum The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. Gets the type of this field along with its annotations. Gets the type of this field. If this field serves as a backing variable for an automatically generated property or a field-like event, returns that property/event. Otherwise returns null. Note, the set of possible associated symbols might be expanded in the future to reflect changes in the languages. Returns true if this field was declared as "readonly". Returns true if this field was declared as "volatile". Returns true if this symbol requires an instance reference as the implicit receiver. This is false if the symbol is static. Returns true if this field was declared as "fixed". Note that for a fixed-size buffer declaration, this.Type will be a pointer type, of which the pointed-to type will be the declared element type of the fixed-size buffer. If IsFixedSizeBuffer is true, the value between brackets in the fixed-size-buffer declaration. If IsFixedSizeBuffer is false FixedSize is 0. Note that for fixed-a size buffer declaration, this.Type will be a pointer type, of which the pointed-to type will be the declared element type of the fixed-size buffer. If this.IsFixedSizeBuffer is true, returns the underlying implementation type for the fixed-size buffer when emitted. Otherwise returns null. Returns true when field is a backing field for a captured frame pointer (typically "this"). Returns true if this field was declared as "const" (i.e. is a constant declaration). Also returns true for an enum member. Returns false if the field wasn't declared as "const", or constant value was omitted or erroneous. True otherwise. If IsConst returns true, then returns the constant value of the field or enum member. If IsConst returns false, then returns null. Gets the kind of this symbol. Returns false because field can't be abstract. Returns false because field can't be defined externally. Returns false because field can't be overridden. Returns false because field can't be sealed. Returns false because field can't be virtual. True if this symbol has a special name (metadata flag SpecialName is set). True if this symbol has a runtime-special name (metadata flag RuntimeSpecialName is set). True if this field is not serialized (metadata flag NotSerialized is set). True if this field has a pointer type. By default we defer to this.Type.IsPointerOrFunctionPointer() However in some cases this may cause circular dependency via binding a pointer that points to the type that contains the current field. Fortunately in those cases we do not need to force binding of the field's type and can just check the declaration syntax if the field type is not yet known. Describes how the field is marshalled when passed to native code. Null if no specific marshalling information is available for the field. PE symbols don't provide this information and always return null. Returns the marshalling type of this field, or 0 if marshalling information isn't available. By default this information is extracted from if available. Since the compiler does only need to know the marshalling type of symbols that aren't emitted PE symbols just decode the type from metadata and don't provide full marshalling information. Offset assigned to the field when the containing type is laid out by the VM. Null if unspecified. Returns true if this field is required to be set in an object initializer on object creation. Returns true if the error code is highest priority while calculating use site error for this symbol. Returns True when field symbol is not mapped directly to a field in the underlying tuple struct. Returns true if this is a field representing a Default element like Item1, Item2... If this is a field of a tuple type, return corresponding underlying field from the tuple underlying type. Otherwise, null. In case of a malformed underlying type the corresponding underlying field might be missing, return null in this case too. If this field represents a tuple element, returns a corresponding default element field. Otherwise returns null. Returns true if a given field is a tuple element If this is a field representing a tuple element, returns the index of the element (zero-based). Otherwise returns -1 We need to be able to differentiate between a FunctionPointer used as a type and a function pointer used as a StandaloneMethodSig. To do this, we wrap the in a , to hide its implementation of . Creates a function pointer from individual parts. This method should only be used when diagnostics are not needed. This is intended for use in test code. Creates a function pointer from individual parts. This method should only be used when diagnostics are not needed. For scenarios such as overriding with differing ref kinds (such as out vs in or ref) we need to compare function pointer parameters assuming that Ref matches RefReadonly/In and Out. This is done because you cannot overload on ref vs out vs in in regular method signatures, and we are disallowing similar overloads in source with function pointers. For scenarios such as overriding with differing ref kinds (such as out vs in or ref) we need to compare function pointer parameters assuming that Ref matches RefReadonly/In and Out. For that reason, we must also ensure that GetHashCode returns equal hashcodes for types that only differ by the type of ref they have. Return true if the given type is valid as a calling convention modifier type. Represents a method or method-like symbol (including constructor, destructor, operator, or property/event accessor). This method indicates whether or not the runtime will regard the method as newslot (as indicated by the presence of the "newslot" modifier in the signature). WARN WARN WARN: We won't have a final value for this until declaration diagnostics have been computed for all s, so pass ignoringInterfaceImplementationChanges: true if you need a value sooner and aren't concerned about tweaks made to satisfy interface implementation requirements. NOTE: Not ignoring changes can only result in a value that is more true. This method indicates whether or not the runtime will regard the method as virtual (as indicated by the presence of the "virtual" modifier in the signature). WARN WARN WARN: We won't have a final value for this until declaration diagnostics have been computed for all s, so pass option: if you need a value sooner and aren't concerned about tweaks made to satisfy interface implementation requirements. NOTE: Not ignoring changes can only result in a value that is more true. Use IsMetadataVirtualOption.ForceCompleteIfNeeded in DEBUG/assertion code to get the final value. The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. Gets what kind of method this is. There are several different kinds of things in the C# language that are represented as methods. This property allow distinguishing those things without having to decode the name of the method. Returns the arity of this method, or the number of type parameters it takes. A non-generic method has zero arity. Returns whether this method is generic; i.e., does it have any type parameters? Returns true if this symbol requires an instance reference as the implicit receiver. This is false if the symbol is static, or a True if the method itself is excluded from code coverage instrumentation. True for source methods marked with . If a method is annotated with `[MemberNotNull(...)]` attributes, returns the list of members listed in those attributes. Otherwise, an empty array. Returns the data for this method, if there is any. If forceComplete is false and the data has not yet been loaded or only early attribute binding has occurred, then either or will be returned, respectively. If passing true for forceComplete, ensure that cycles will not occur by not calling in the process of binding an attribute argument. Returns true if this method is an extension method. True if this symbol has a special name (metadata flag SpecialName is set). Misc implementation metadata flags (ImplFlags in metadata). True if the type has declarative security information (HasSecurity flags). Platform invoke information, or null if the method isn't a P/Invoke. Declaration security information associated with this type, or null if there is none. Marshalling information for return value (FieldMarshal in metadata). True if the method calls another method containing security code (metadata flag RequiresSecurityObject is set). A method can me marked as RequiresSecurityObject by applying the DynamicSecurityMethodAttribute in source. DynamicSecurityMethodAttribute is a pseudo custom attribute defined as an internal class in System.Security namespace. This attribute is set on certain security methods defined within mscorlib. Returns true if this method hides base methods by name. This cannot be specified directly in the C# language, but can be true for methods defined in other languages imported from metadata. The equivalent of the "hidebyname" flag in metadata. Returns whether this method is using CLI VARARG calling convention. This is used for C-style variable argument lists. This is used extremely rarely in C# code and is represented using the undocumented "__arglist" keyword. Note that methods with "params" on the last parameter are indicated with the "IsParams" property on ParameterSymbol, and are not represented with this property. Returns whether this built-in operator checks for integer overflow. Returns true if this method has no return type; i.e., returns "void". Source: Returns whether this method is async; i.e., does it have the async modifier? Metadata: Returns false; methods from metadata cannot be async. Indicates whether or not the method returns by reference Indicates whether or not the method returns by ref readonly Gets the ref kind of the method's return value Gets the return type of the method along with its annotations Gets the return type of the method Flow analysis annotations on the method itself (ie. DoesNotReturn) Returns the type arguments that have been substituted for the type parameters. If nothing has been substituted for a given type parameter, then the type parameter itself is consider the type argument. Get the type parameters on this method. If the method has not generic, returns an empty list. Call and throw if it returns false. True if this type supports retrieving the this parameter and false otherwise. Note that a return value of true does not guarantee a non-null (e.g. fails for static methods). Optimization: in many cases, the parameter count (fast) is sufficient and we don't need the actual parameter symbols (slow). The default implementation is always correct, but may be unnecessarily slow. Gets the parameters of this method. If this method has no parameters, returns an empty list. Returns the method symbol that this method was constructed from. The resulting method symbol has the same containing type (if any), but has type arguments that are the same as the type parameters (although its containing type might not). Source: Was the member name qualified with a type name? Metadata: Is the member an explicit implementation? Will not always agree with ExplicitInterfaceImplementations.Any() (e.g. if binding of the type part of the name fails). Indicates whether the method is declared readonly, i.e. whether the 'this' receiver parameter is 'ref readonly'. See also Indicates whether the accessor is marked with the 'init' modifier. Indicates whether the method is effectively readonly, by either the method or the containing type being marked readonly. Returns interface methods explicitly implemented by this method. Methods imported from metadata can explicitly implement more than one method, that is why return type is ImmutableArray. Custom modifiers associated with the ref modifier, or an empty array if there are none. Gets the attributes on method's return type. Returns an empty array if there are no attributes. If this method has MethodKind of MethodKind.PropertyGet or MethodKind.PropertySet, returns the property that this method is the getter or setter for. If this method has MethodKind of MethodKind.EventAdd or MethodKind.EventRemove, returns the event that this method is the adder or remover for. Note, the set of possible associated symbols might be expanded in the future to reflect changes in the languages. Returns the original virtual or abstract method which a given method symbol overrides, ignoring any other overriding methods in base classes. The search must respect accessibility from this type. Returns the original virtual or abstract method which a given method symbol overrides, ignoring any other overriding methods in base classes. The search must respect accessibility from this type. The returned method must have the same return type. Returns the original virtual or abstract method which a given method symbol overrides, ignoring any other overriding methods in base classes. Also, if the given method symbol is generic then the resulting virtual or abstract method is constructed with the same type arguments as the given method. The returned method must have the same return type. If this method overrides another method (because it both had the override modifier and there correctly was a method to override), returns the overridden method. Note that if an overriding method D.M overrides C.M, which in turn overrides virtual method A.M, the "overridden method" of D.M is C.M, not the original virtual method A.M. Note also that constructed generic methods are not considered to override anything. Returns true if calls to this method are omitted in this syntax tree. Calls are omitted when the called method is a partial method with no implementation part, or when the called method is a conditional method whose condition is not true in the source file corresponding to the given syntax tree. Calls are conditionally omitted if both the following requirements are true: (a) IsConditional == true, i.e. it has at least one applied/inherited conditional attribute AND (b) None of conditional symbols corresponding to these conditional attributes are defined in the given syntaxTree. Forces binding and decoding of attributes. Returns a sequence of preprocessor symbols specified in applied on this symbol, or null if there are none. Returns a flag indicating whether this symbol has at least one applied/inherited conditional attribute. Forces binding and decoding of attributes. Returns true if this is a constructor attributed with HasSetsRequiredMembers Some method kinds do not participate in overriding/hiding (e.g. constructors). Returns value 'Method' of the Returns true if this symbol represents a constructor of a script class. Returns if the method is implicit constructor (normal and static) Returns if the method is implicit instance constructor Returns true if this symbol represents a constructor of an interactive submission class. Determines whether this method is a candidate for a default assembly entry point (i.e. it is a static method called "Main"). If this is an extension method that can be applied to a receiver of the given type, returns a reduced extension method symbol thus formed. Otherwise, returns null. The compilation in which constraints should be checked. Should not be null, but if it is null we treat constraints as we would in the latest language version. If this is an extension method, returns a reduced extension method symbol representing the method. Otherwise, returns null. If this method is a reduced extension method, returns the extension method that should be used at call site during ILGen. Otherwise, returns null. If this is a partial method declaration without a body, and the method also has a part that implements it with a body, returns that implementing definition. Otherwise null. If this is a partial method with a body, returns the corresponding definition part (without a body). Otherwise null. If this method is a reduced extension method, gets the extension method definition that this method was reduced from. Otherwise, returns null. If this method can be applied to an object, returns the type of object it is applied to. If this method is a reduced extension method, returns a type inferred during reduction process for the type parameter. Type parameter of the corresponding method. Inferred type or Nothing if nothing was inferred. If this is not a reduced extension method. If is null. If doesn't belong to the corresponding method. Apply type substitution to a generic method to create a method symbol with the given type parameters supplied. Apply type substitution to a generic method to create a method symbol with the given type parameters supplied. As a performance optimization, cache parameter types and refkinds - overload resolution uses them a lot. Null if no parameter is ref/out. Otherwise the RefKind for each parameter. Returns the map from type parameters to type arguments. If this is not a generic method instantiation, returns null. The map targets the original definition of the method. Determines if this method is a valid target for UnmanagedCallersOnly, reporting an error in the given diagnostic bag if it is not null. and should both be null, or neither should be null. If an error would be reported (whether or not diagnostics is null), true is returned. Returns true if the error code is highest priority while calculating use site error for this symbol. If the method was written as an iterator method (i.e. with yield statements in its body) returns the element type of the iterator. Otherwise returns default(TypeWithAnnotations). Generates bound block representing method's body for methods in lowered form and adds it to a collection of method bodies of the current module. This method is supposed to only be called for method symbols which return SynthesizesLoweredBoundBody == true. Returns true for synthesized symbols which generate synthesized body in lowered form Return true iff the method contains user code. Calculates a syntax offset for a local (user-defined or long-lived synthesized) declared at . Must be implemented by all methods that may contain user code. Syntax offset is a unique identifier for the local within the emitted method body. It's based on position of the local declarator. In single-part method bodies it's simply the distance from the start of the method body syntax span. If a method body has multiple parts (such as a constructor comprising of code for member initializers and constructor initializer calls) the offset is calculated as if all source these parts were concatenated together and prepended to the constructor body. The resulting syntax offset is then negative for locals defined outside of the constructor body. Build and add synthesized return type attributes for this method symbol. Returns true if locals are to be initialized Gets the resolution priority of this method, 0 if not set. Do not call this method from early attribute binding, cycles will occur. Gets the handle for the signature of this method as it appears in metadata. Nil handle for symbols not loaded from metadata, or if the metadata is invalid. Represents a type other than an array, a pointer, a type parameter, and dynamic. Gets the set of interfaces to emit on this type. This set can be different from the set returned by Interfaces property. Add the type to the builder and then recurse on its interfaces. Pre-order depth-first search. To represent a gap in interface's v-table null value should be returned in the appropriate position, unless the gap has a symbol (happens if it is declared in source, for example). if uninitialized. if there are errors. if there are no required members. Otherwise, the required members. Returns the arity of this type, or the number of type parameters it takes. A non-generic type has zero arity. Returns the type parameters that this type has. If this is a non-generic type, returns an empty ImmutableArray. Returns the type arguments that have been substituted for the type parameters. If nothing has been substituted for a given type parameter, then the type parameter itself is consider the type argument. Returns the type symbol that this type was constructed from. This type symbol has the same containing type (if any), but has type arguments that are the same as the type parameters (although its containing type might not). For enum types, gets the underlying type. Returns null on all other kinds of types. Returns true for a struct type containing a cycle. This property is intended for flow analysis only since it is only implemented for source types. Is this a NoPia local type explicitly declared in source, i.e. top level type with a TypeIdentifier attribute on it? Returns true and a string from the first GuidAttribute on the type, the string might be null or an invalid guid representation. False, if there is no GuidAttribute with string argument. For delegate types, gets the delegate's invoke method. Returns null on all other kinds of types. Note that it is possible to have an ill-formed delegate type imported from metadata which does not have an Invoke method. Such a type will be classified as a delegate but its DelegateInvokeMethod would be null. Get the operators for this type by their metadata name Get the instance constructors for this type. Get the static constructors for this type. Get the instance and static constructors for this type. Get the indexers for this type. Won't include indexers that are explicit interface implementations. Returns true if this type might contain extension methods. If this property returns false, there are no extension methods in this type. This property allows the search for extension methods to be narrowed quickly. Returns true if this type is known to be a reference type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false. Returns true if this type is known to be a value type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false. Gets the associated attribute usage info for an attribute type. Returns true if the type is a Script class. It might be an interactive submission class or a Script class in a csx file. Returns true if the type is the implicit class that holds onto invalid global members (like methods or statements in a non script file). Gets the name of this symbol. Symbols without a name return the empty string; null is never returned. Return the name including the metadata arity suffix. If this type is a file-local type, returns an identifier for the file this type was declared in. Otherwise, returns null. Should the name returned by Name property be mangled with [`arity] suffix in order to get metadata name. Must return False for a type with Arity == 0. Some types with Arity > 0 still have MangleName == false. For example, EENamedTypeSymbol. Note that other differences between source names and metadata names exist and are not controlled by this property, such as the 'AssociatedFileIdentifier' prefix for file types. Collection of names of members declared within this type. May return duplicates. True if this type declares any required members. It does not recursively check up the tree for _all_ required members. Whether the type encountered an error while trying to build its complete list of required members. Returns true if there are any required members. Prefer calling this over checking for empty, as this will avoid calculating base type requirements if not necessary. The full list of all required members for this type, including from base classes. If is true, this returns empty. Do not call this API if all you need are the required members declared on this type. Use instead, filtering for required members, instead of calling this API. If you only need to determine whether this type or any base types have required members, call , which will avoid calling this API if not required. Get all the members of this symbol. An ImmutableArray containing all the members of this symbol. If this symbol has no members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that have a particular name. An ImmutableArray containing all the members of this symbol with the given name. If there are no members with this name, returns an empty ImmutableArray. Never returns null. A lightweight check for whether this type has a possible clone method. This is less costly than GetMembers, particularly for PE symbols, and can be used as a cheap heuristic for whether to fully search through all members of this type for a valid clone method. Get all the members of this symbol that are types. An ImmutableArray containing all the types that are members of this symbol. If this symbol has no type members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types that have a particular name and arity An ImmutableArray containing all the types that are members of this symbol with the given name and arity. If this symbol has no type members with this name and arity, returns an empty ImmutableArray. Never returns null. Get all instance field and event members. For source symbols may be called while calculating . Get this accessibility that was declared on this symbol. For symbols that do not have accessibility declared on them, returns NotApplicable. Used to implement visitor pattern. During early attribute decoding, we consider a safe subset of all members that will not cause cyclic dependencies. Get all such members for this symbol. Never returns null (empty instead). Expected implementations: for source, return type and field members; for metadata, return all members. During early attribute decoding, we consider a safe subset of all members that will not cause cyclic dependencies. Get all such members for this symbol that have a particular name. Never returns null (empty instead). Expected implementations: for source, return type and field members; for metadata, return all members. Gets the kind of this symbol. Compares this type to another type. Helper for more complicated cases of Equals like when we have generic instantiations or types nested within them. Merges nullability of all type arguments from the `typeA` and `typeB`. The type parameters are added to `allTypeParameters`; the merged type arguments are added to `allTypeArguments`; and the method returns true if there were changes from the original `typeA`. Returns a constructed type given its type arguments. The immediate type arguments to be replaced for type parameters in the type. Returns a constructed type given its type arguments. The immediate type arguments to be replaced for type parameters in the type. Returns a constructed type given its type arguments. Returns an unbound generic type of this named type. Gets a value indicating whether this type has an EmbeddedAttribute or not. Gets a value indicating whether this type has System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute or not. True if this type or some containing type has type parameters. True if this is a reference to an unbound generic type. These occur only within a typeof expression. A generic type is considered unbound if all of the type argument lists in its fully qualified name are empty. Note that the type arguments of an unbound generic type will be returned as error types because they do not really have type arguments. An unbound generic type yields null for its BaseType and an empty result for its Interfaces. The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. Returns the map from type parameters to type arguments. If this is not a generic type instantiation, returns null. The map targets the original definition of the type. True if the type itself is excluded from code coverage instrumentation. True for source types marked with . True if this symbol has a special name (metadata flag SpecialName is set). Returns a flag indicating whether this symbol is ComImport. A type can me marked as a ComImport type in source by applying the True if the type is a Windows runtime type. A type can me marked as a Windows runtime type in source by applying the WindowsRuntimeImportAttribute. WindowsRuntimeImportAttribute is a pseudo custom attribute defined as an internal class in System.Runtime.InteropServices.WindowsRuntime namespace. This is needed to mark Windows runtime types which are redefined in mscorlib.dll and System.Runtime.WindowsRuntime.dll. These two assemblies are special as they implement the CLR's support for WinRT. True if the type should have its WinRT interfaces projected onto .NET types and have missing .NET interface members added to the type. Returns a flag indicating whether this symbol has at least one applied/inherited conditional attribute. Forces binding and decoding of attributes. True if the type is serializable (has Serializable metadata flag). Returns true if locals are to be initialized Type layout information (ClassLayout metadata and layout kind flags). The default charset used for type marshalling. Can be changed via applied on the containing module. Marshalling charset of string data fields within the type (string formatting flags in metadata). True if the type has declarative security information (HasSecurity flags). Declaration security information associated with this type, or null if there is none. Returns a sequence of preprocessor symbols specified in applied on this symbol, or null if there are none. If was applied to the type and the attribute argument is a valid named type argument, i.e. accessible class type, then it returns the type symbol for the argument. Otherwise, returns null. This property invokes force completion of attributes. If you are accessing this property from the binder, make sure that we are not binding within an Attribute context. This could lead to a possible cycle in attribute binding. We can avoid this cycle by first checking if we are within the context of an Attribute argument, i.e. if(!binder.InAttributeArgument) { ... namedType.ComImportCoClass ... } CONSIDER: We can remove the above restriction and possibility of cycle if we do an early binding of some well known attributes. If class represents fixed buffer, this property returns the FixedElementField Requires less computation than == . Metadata types need to compute their base types in order to know their TypeKinds, and that can lead to cycles if base types are already being computed. True if this is an interface type. Verify if the given type can be used to back a tuple type and return cardinality of that tuple type in . If method returns true, contains cardinality of the compatible tuple type. Returns an instance of a symbol that represents a native integer if this underlying symbol represents System.IntPtr or System.UIntPtr. For platforms that support numeric IntPtr/UIntPtr, those types are returned as-is. For other symbols, throws . If this is a native integer, returns the symbol for the underlying type, either or . Otherwise, returns null. Helps create a tuple type from source. Copy this tuple, but modify it to use the new element types. Copy this tuple, but modify it to use the new element names. Also applies new location of the whole tuple as well as each element. Drops the inferred positions. Decompose the underlying tuple type into its links and store them into the underlyingTupleTypeChain. For instance, ValueTuple<..., ValueTuple< int >> (the underlying type for an 8-tuple) will be decomposed into two links: the first one is the entire thing, and the second one is the ValueTuple< int > Returns the number of nestings required to represent numElements as nested ValueTuples. For example, for 8 elements, you need 2 ValueTuples and the remainder (ie the size of the last nested ValueTuple) is 1. For tuples with no natural type, we still need to verify that an underlying type of proper arity exists, and report if otherwise. Find the well-known ValueTuple type of a given arity. For example, for arity=2: returns WellKnownType.System_ValueTuple_T2 Find the constructor for a well-known ValueTuple type of a given arity. For example, for arity=2: returns WellKnownMember.System_ValueTuple_T2__ctor For arity=12: return System_ValueTuple_TRest__ctor Find the well-known members to the ValueTuple type of a given arity and position. For example, for arity=3 and position=1: returns WellKnownMember.System_ValueTuple_T3__Item1 Returns "Item1" for position=1 Returns "Item12" for position=12 Checks whether the field name is reserved and tells us which position it's reserved for. For example: Returns 3 for "Item3". Returns 0 for "Rest", "ToString" and other members of System.ValueTuple. Returns -1 for names that aren't reserved. Lookup well-known member declaration in provided type and reports diagnostics. The main purpose of this type is to store element names and also cache some information related to tuples. Element names, if provided. Declaration locations for individual elements, if provided. Declaration location for this tuple type symbol Which element names were inferred and therefore cannot be used. If none of the element names were inferred, or inferred names can be used (no tracking necessary), leave as default. This information is ignored in type equality and comparison. Element types. The same named type, but without element names. Represents a namespace. Get all the members of this symbol that are namespaces. An IEnumerable containing all the namespaces that are members of this symbol. If this symbol has no namespace members, returns an empty IEnumerable. Never returns null. Returns whether this namespace is the unnamed, global namespace that is at the root of all namespaces. The kind of namespace: Module, Assembly or Compilation. Module namespaces contain only members from the containing module that share the same namespace name. Assembly namespaces contain members for all modules in the containing assembly that share the same namespace name. Compilation namespaces contain all members, from source or referenced metadata (assemblies and modules) that share the same namespace name. The containing compilation for compilation namespaces. If a namespace has Assembly or Compilation extent, it may be composed of multiple namespaces that are merged together. If so, ConstituentNamespaces returns all the namespaces that were merged. If this namespace was not merged, returns an array containing only this namespace. Containing assembly. Gets the kind of this symbol. Implements visitor pattern. Get this accessibility that was declared on this symbol. For symbols that do not have accessibility declared on them, returns NotApplicable. Returns true if this symbol is "static"; i.e., declared with the "static" modifier or implicitly static. Returns true if this symbol was declared as requiring an override; i.e., declared with the "abstract" modifier. Also returns true on a type declared as "abstract", all interface types, and members of interface types. Returns true if this symbol was declared to override a base class member and was also sealed from further overriding; i.e., declared with the "sealed" modifier. Also set for types that do not allow a derived class (declared with "sealed" or "static" or "struct" or "enum" or "delegate"). Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Returns an implicit type symbol for this namespace or null if there is none. This type wraps misplaced global code. Lookup a nested namespace. Sequence of names for nested child namespaces. Symbol for the most nested namespace, if found. Nothing if namespace or any part of it can not be found. Add all extension methods in this namespace to the given list. If name or arity or both are provided, only those extension methods that match are included. Methods list Optional method name Method arity Lookup options Represents a parameter of a method or indexer. Gets constant value to be stored in metadata Constant table. The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. Gets the type of the parameter along with its annotations. Gets the type of the parameter. Determines if the parameter ref, out or neither. Returns true if the parameter is a discard parameter. Custom modifiers associated with the ref modifier, or an empty array if there are none. Describes how the parameter is marshalled when passed to native code. Null if no specific marshalling information is available for the parameter. PE symbols don't provide this information and always return null. Returns the marshalling type of this parameter, or 0 if marshalling information isn't available. By default this information is extracted from if available. Since the compiler does only need to know the marshalling type of symbols that aren't emitted PE symbols just decode the type from metadata and don't provide full marshalling information. Gets the ordinal position of the parameter. The first parameter has ordinal zero. The "'this' parameter has ordinal -1. Returns true if the parameter was declared as a parameter array. Note: it is possible for any parameter to have the [ParamArray] attribute (for instance, in IL), even if it is not the last parameter. So check for that. Returns true if the parameter was declared as a parameter collection. Note: it is possible for any parameter to have the [ParamCollection] attribute (for instance, in IL), even if it is not the last parameter. So check for that. Returns true if the parameter is semantically optional. True if and only if the parameter has a default argument syntax, or the parameter is not a params-array and Optional metadata flag is set. True if Optional flag is set in metadata. True if In flag is set in metadata. True if Out flag is set in metadata. Returns true if the parameter explicitly specifies a default value to be passed when no value is provided as an argument to a call. True if the parameter has a default argument syntax, or the parameter is from source and is applied, or the parameter is from metadata and HasDefault metadata flag is set. See to determine if the parameter will be considered optional by overload resolution. The default value can be obtained with property. Returns the default value of the parameter. If returns false then DefaultValue throws an InvalidOperationException. If the parameter type is a struct and the default value of the parameter is the default value of the struct type or of type parameter type which is not known to be a referenced type, then this property will return null. The parameter has no default value. Returns the default value constant of the parameter, or null if the parameter doesn't have a default value or the parameter type is a struct and the default value of the parameter is the default value of the struct type or of type parameter type which is not known to be a referenced type. This is used for emitting. It does not reflect the language semantics (i.e. even non-optional parameters can have default values). Gets the kind of this symbol. Implements visitor pattern. Get this accessibility that was declared on this symbol. For symbols that do not have accessibility declared on them, returns NotApplicable. Returns true if this symbol was declared as requiring an override; i.e., declared with the "abstract" modifier. Also returns true on a type declared as "abstract", all interface types, and members of interface types. Returns true if this symbol was declared to override a base class member and was also sealed from further overriding; i.e., declared with the "sealed" modifier. Also set for types that do not allow a derived class (declared with "sealed" or "static" or "struct" or "enum" or "delegate"). Returns true if this symbol is "virtual", has an implementation, and does not override a base class member; i.e., declared with the "virtual" modifier. Does not return true for members declared as abstract or override. Returns true if this symbol was declared to override a base class member; i.e., declared with the "override" modifier. Still returns true if member was declared to override something, but (erroneously) no member to override exists. Returns true if this symbol is "static"; i.e., declared with the "static" modifier or implicitly static. Returns true if this symbol has external implementation; i.e., declared with the "extern" modifier. Returns true if the parameter is the hidden 'this' parameter. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Indexes of the parameters that will be passed to the constructor of the interpolated string handler type when an interpolated string handler conversion occurs. These indexes are ordered in the order to be passed to the constructor. Indexes greater than or equal to 0 are references to parameters defined on the containing method or indexer. Indexes less than 0 are constants defined on . True if the parameter is attributed with InterpolatedStringHandlerArgumentAttribute and the attribute has some error (such as invalid names). The effective scope. This is from the declared scope, implicit scope and any UnscopedRefAttribute. Represents a pointer type such as "int *". Pointer types are used only in unsafe code. Create a new PointerTypeSymbol. The type being pointed at. Gets the type of the storage location that an instance of the pointer type points to, along with its annotations. Gets the type of the storage location that an instance of the pointer type points to. Represents a property or indexer. As a performance optimization, cache parameter types and refkinds - overload resolution uses them a lot. The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. If a property is annotated with `[MemberNotNull(...)]` attributes, returns the list of members listed in those attributes. Otherwise, an empty array. Indicates whether or not the property returns by reference Indicates whether or not the property returns a readonly reference Gets the ref kind of the property. The type of the property along with its annotations. The type of the property. Custom modifiers associated with the ref modifier, or an empty array if there are none. The parameters of this property. If this property has no parameters, returns an empty list. Parameters are only present on indexers, or on some properties imported from a COM interface. Optimization: in many cases, the parameter count (fast) is sufficient and we don't need the actual parameter symbols (slow). Returns true if this symbol requires an instance reference as the implicit receiver. This is false if the symbol is static. Returns whether the property is really an indexer. In source, we regard a property as an indexer if it is declared with an IndexerDeclarationSyntax. From metadata, we regard a property if it has parameters and is a default member of the containing type. CAVEAT: To ensure that this property (and indexer Names) roundtrip, source properties are not indexers if they are explicit interface implementations (since they will not be marked as default members in metadata). True if this an indexed property; that is, a property with parameters within a [ComImport] type. True if this is a read-only property; that is, a property with no set accessor. True if this is a write-only property; that is, a property with no get accessor. Returns true if this property is required to be set in an object initializer on object creation. True if the property itself is excluded from code coverage instrumentation. True for source properties marked with . True if this symbol has a special name (metadata flag SpecialName is set). The 'get' accessor of the property, or null if the property is write-only. The 'set' accessor of the property, or null if the property is read-only. Returns the overridden property, or null. Source: Was the member name qualified with a type name? Metadata: Is the member an explicit implementation? Will not always agree with ExplicitInterfaceImplementations.Any() (e.g. if binding of the type part of the name fails). Returns interface properties explicitly implemented by this property. Properties imported from metadata can explicitly implement more than one property. Gets the kind of this symbol. Implements visitor pattern. Returns true if the error code is highest priority while calculating use site error for this symbol. Represents an assembly built by compiler. A Compilation the assembly is created for. Assembly's identity. A list of modules the assembly consists of. The first (index=0) module is a SourceModuleSymbol, which is a primary module, the rest are net-modules. Bag of assembly's custom attributes and decoded well-known attribute data from source. Bag of assembly's custom attributes and decoded well-known attribute data from added netmodules. Indices of attributes that will not be emitted for one of two reasons: - They are duplicates of another attribute (i.e. attributes that bind to the same constructor and have identical arguments) - They are InternalsVisibleToAttributes with invalid assembly identities These indices correspond to the merged assembly attributes from source and added net modules, i.e. attributes returned by method. Map for storing effectively private or effectively internal fields declared in this assembly but never initialized nor assigned. Each {symbol, bool} key-value pair in this map indicates the following: (a) Key: Unassigned field symbol. (b) Value: True if the unassigned field is effectively internal, false otherwise. private fields declared in this assembly but never read We imitate the native compiler's policy of not warning about unused fields when the enclosing type is used by an extern method for a ref argument. Here we keep track of those types. The warnings for unused fields. This override is essential - it's a base case of the recursive definition. This represents what the user claimed in source through the AssemblyFlagsAttribute. It may be modified as emitted due to presence or absence of the public key. We're going to synthesize some well-known attributes for this assembly symbol. However, at synthesis time, it is too late to report diagnostics or cancel the emit. Instead, we check for use site errors on the types and members we know we'll need at synthesis time. As in Dev10, we won't report anything if the attribute TYPES are missing (note: missing, not erroneous) because we won't synthesize anything in that case. We'll only report diagnostics if the attribute TYPES are present and either they or the attribute CONSTRUCTORS have errors. If this compilation allows unsafe code (note: allows, not contains), then when we actually emit the assembly/module, we're going to synthesize SecurityPermissionAttribute/UnverifiableCodeAttribute. However, at synthesis time, it is too late to report diagnostics or cancel the emit. Instead, we check for use site errors on the types and members we know we'll need at synthesis time. As in Dev10, we won't report anything if the attribute TYPES are missing (note: missing, not erroneous) because we won't synthesize anything in that case. We'll only report diagnostics if the attribute TYPES are present and either they or the attribute CONSTRUCTORS have errors. True if internals are exposed at all. Forces binding and decoding of attributes. This property shouldn't be accessed during binding as it can lead to attribute binding cycle. Gets unique source assembly attributes that should be emitted, i.e. filters out attributes with errors and duplicate attributes. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. NOTE: This method should always be kept as a sealed override. If you want to override attribute binding logic for a sub-class, then override method. Returns true if the assembly attribute at the given index is a duplicate assembly attribute that must not be emitted. Duplicate assembly attributes are attributes that bind to the same constructor and have identical arguments. This method must be invoked only after all the assembly attributes have been bound. Returns data decoded from source assembly attributes or null if there are none. Forces binding and decoding of attributes. TODO: We should replace methods GetSourceDecodedWellKnownAttributeData and GetNetModuleDecodedWellKnownAttributeData with a single method GetDecodedWellKnownAttributeData, which merges DecodedWellKnownAttributeData from source and netmodule attributes. This implements the same logic as but loading a smaller set of attributes if possible, to reduce circularity. This only forces binding of attributes that look like they may be forwarded types attributes (syntactically). Returns true if and only if at least one type within the assembly contains extension methods. Note, this method is expensive since it potentially inspects all types within the assembly. The expectation is that this method is only called at emit time, when all types have been or will be traversed anyway. Get the warnings for unused fields. This should only be fetched when all method bodies have been compiled. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Represents a type parameter in a generic type or generic method. The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. If this is a type parameter of a reduced extension method, gets the type parameter definition that this type parameter was reduced from. Otherwise, returns Nothing. The ordinal position of the type parameter in the parameter list which declares it. The first type parameter has ordinal zero. The types that were directly specified as constraints on the type parameter. Duplicates and cycles are removed, although the collection may include redundant constraints where one constraint is a base type of another. True if the parameterless constructor constraint was specified for the type parameter. The type parameter kind of this type parameter. The method that declared this type parameter, or null. The type that declared this type parameter, or null. The effective base class of the type parameter (spec 10.1.5). If the deduced base type is a reference type, the effective base type will be the same as the deduced base type. Otherwise if the deduced base type is a value type, the effective base type will be the most derived reference type from which deduced base type is derived. The effective interface set (spec 10.1.5). The most encompassed type (spec 6.4.2) from the constraints. The effective interface set and any base interfaces of those interfaces. This is AllInterfaces excluding interfaces that are only implemented by the effective base type. Called by , , , and . to allow derived classes to ensure constraints within the containing type or method are resolved in a consistent order, regardless of the order the callers query individual type parameters. Helper method to force type parameter constraints to be resolved. - 'true' if constraints disallow nullable reference types - 'false' if constraints (or lack of constraints) permit nullable reference types - 'null' if constrained to oblivious type Returns whether the reference type constraint (the 'class' constraint) should also be treated as nullable ('class?') or non-nullable (class!). In some cases this aspect is unknown (null value is returned). For example, when 'class' constraint is specified in a NonNullTypes(false) context. This API returns false when is false. This type is synthesized to hold the cached delegates that target static method groups. Creates a type-scope concrete delegate cache container. Creates a method-scope generic delegate cache container. State machine interface property implementation. A base method symbol used as a base class for lambda method symbol and base method wrapper symbol. Indicates that this method inherits attributes from the base method, its parameters, return type, and type parameters. Abstract base class for mutable and immutable type maps. Substitute for a type declaration. May use alpha renaming if the container is substituted. SubstType, but for NamedTypeSymbols only. This is used for concrete types, so no alpha substitution appears in the result. Perform the substitution on the given type. Each occurrence of the type parameter is replaced with its corresponding type argument from the map. The type to be rewritten. The type with type parameters replaced with the type arguments. Substitute types, and return the results without duplicates, preserving the original order. Note, all occurrences of 'dynamic' in resulting types will be replaced with 'object'. Like SubstTypes, but for NamedTypeSymbols. Symbol representing a using alias appearing in a compilation unit or within a namespace declaration. Generally speaking, these symbols do not appear in the set of symbols reachable from the unnamed namespace declaration. In other words, when a using alias is used in a program, it acts as a transparent alias, and the symbol to which it is an alias is used in the symbol table. For example, in the source code
            namespace NS
            {
                using o = System.Object;
                partial class C : o {}
                partial class C : object {}
                partial class C : System.Object {}
            }
            
all three declarations for class C are equivalent and result in the same symbol table object for C. However, these using alias symbols do appear in the results of certain SemanticModel APIs. Specifically, for the base clause of the first of C's class declarations, the following APIs may produce a result that contains an AliasSymbol:
                SemanticInfo SemanticModel.GetSemanticInfo(ExpressionSyntax expression);
                SemanticInfo SemanticModel.BindExpression(CSharpSyntaxNode location, ExpressionSyntax expression);
                SemanticInfo SemanticModel.BindType(CSharpSyntaxNode location, ExpressionSyntax type);
                SemanticInfo SemanticModel.BindNamespaceOrType(CSharpSyntaxNode location, ExpressionSyntax type);
            
Also, the following are affected if container==null (and, for the latter, when arity==null or arity==0):
                IList<string> SemanticModel.LookupNames(CSharpSyntaxNode location, NamespaceOrTypeSymbol container = null, LookupOptions options = LookupOptions.Default, List<string> result = null);
                IList<Symbol> SemanticModel.LookupSymbols(CSharpSyntaxNode location, NamespaceOrTypeSymbol container = null, string name = null, int? arity = null, LookupOptions options = LookupOptions.Default, List<Symbol> results = null);
            
Gets the for the namespace or type referenced by the alias. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Using aliases in C# are always contained within a namespace declaration, or at the top level within a compilation unit, within the implicit unnamed namespace declaration. We return that as the "containing" symbol, even though the alias isn't a member of the namespace as such. Gets the for the namespace or type referenced by the alias. Gets the for the namespace or type referenced by the alias. Describes anonymous type in terms of fields Anonymous type location Anonymous type fields Anonymous type descriptor Key The key is to be used to separate anonymous type templates in an anonymous type symbol cache. The type descriptors with the same keys are supposed to map to 'the same' anonymous type template in terms of the same generic type being used for their implementation. Compares two anonymous type descriptors, takes into account fields and types, not locations. Compares two anonymous type descriptors, takes into account fields and types, not locations. Creates a new anonymous type descriptor based on 'this' one, but having field types passed as an argument. Describes anonymous type field in terms of its name, type and other attributes Anonymous type field name, not nothing and not empty Anonymous type field location Anonymous type field type with annotations Anonymous type field type Represents a .NET assembly, consisting of one or more modules. The system assembly, which provides primitive types like Object, String, etc., e.g. mscorlib.dll. The value is provided by ReferenceManager and must not be modified. For SourceAssemblySymbol, non-missing coreLibrary must match one of the referenced assemblies returned by GetReferencedAssemblySymbols() method of the main module. If there is no existing assembly that can be used as a source for the primitive types, the value is a Compilation.MissingCorLibrary. The system assembly, which provides primitive types like Object, String, etc., e.g. mscorlib.dll. The value is MissingAssemblySymbol if none of the referenced assemblies can be used as a source for the primitive types and the owning assembly cannot be used as the source too. Otherwise, it is one of the referenced assemblies returned by GetReferencedAssemblySymbols() method or the owning assembly. A helper method for ReferenceManager to set the system assembly, which provides primitive types like Object, String, etc., e.g. mscorlib.dll. Simple name the assembly. This is equivalent to ., but may be much faster to retrieve for source code assemblies, since it does not require binding the assembly-level attributes that contain the version number and other assembly information. Gets the identity of this assembly. Assembly version pattern with wildcards represented by , or null if the version string specified in the doesn't contain a wildcard. For example, AssemblyVersion("1.2.*") is represented as 1.2.65535.65535, AssemblyVersion("1.2.3.*") is represented as 1.2.3.65535. Target architecture of the machine. Indicates that this PE file makes Win32 calls. See CorPEKind.pe32BitRequired for more information (http://msdn.microsoft.com/en-us/library/ms230275.aspx). Gets the merged root namespace that contains all namespaces and types defined in the modules of this assembly. If there is just one module in this assembly, this property just returns the GlobalNamespace of that module. Given a namespace symbol, returns the corresponding assembly specific namespace symbol Gets a read-only list of all the modules in this assembly. (There must be at least one.) The first one is the main module that holds the assembly manifest. Does this symbol represent a missing assembly. True if the assembly contains interactive code. Lookup a top level type referenced from metadata, names should be compared case-sensitively. Full type name with generic name mangling. The symbol for the type declared in this assembly, or null. Lookup a top level type referenced from metadata, names should be compared case-sensitively. Detect cycles during lookup. Full type name, possibly with generic name mangling. List of assemblies lookup has already visited (since type forwarding can introduce cycles). Returns the type symbol for a forwarded type based on its canonical CLR metadata name. The name should refer to a non-nested type. If type with this name is not forwarded, null is returned. Look up the given metadata type, if it is forwarded. Lookup declaration for predefined CorLib type in this Assembly. The symbol for the pre-defined type or an error type if the type is not defined in the core library. Register declaration of predefined CorLib type in this Assembly. Continue looking for declaration of predefined CorLib type in this Assembly while symbols for new type declarations are constructed. Return the native integer type corresponding to the underlying type. Figure out if the target runtime supports default interface implementation. Figure out if the target runtime supports static abstract members in interfaces. Whether the target runtime supports numeric IntPtr types. Figure out if the target runtime supports inline array types. Figure out if the target runtime supports inline array types. True if the target runtime support covariant returns of methods declared in classes. Return an array of assemblies involved in canonical type resolution of NoPia local types defined within this assembly. In other words, all references used by previous compilation referencing this assembly. Return an array of assemblies referenced by this assembly, which are linked (/l-ed) by each compilation that is using this AssemblySymbol as a reference. If this AssemblySymbol is linked too, it will be in this array too. Assembly is /l-ed by compilation that is using it as a reference. Returns true and a string from the first GuidAttribute on the assembly, the string might be null or an invalid guid representation. False, if there is no GuidAttribute with string argument. Gets the set of type identifiers from this assembly. These names are the simple identifiers for the type, and do not include namespaces, outer type names, or type parameters. This functionality can be used for features that want to quickly know if a name could be a type for performance reasons. For example, classification does not want to incur an expensive binding call cost if it knows that there is no type with the name that they are looking at. Gets the set of namespace names from this assembly. Returns true if this assembly might contain extension methods. If this property returns false, there are no extension methods in this assembly. This property allows the search for extension methods to be narrowed quickly. Gets the symbol for the pre-defined type from core library associated with this assembly. The symbol for the pre-defined type or an error type if the type is not defined in the core library. The NamedTypeSymbol for the .NET System.Object type, which could have a TypeKind of Error if there was no COR Library in a compilation using the assembly. Get symbol for predefined type from Cor Library used by this assembly. Lookup a type within the assembly using the canonical CLR metadata name of the type. Type name. Symbol for the type or null if type cannot be found or is ambiguous. Lookup a type within the assembly using its canonical CLR metadata name. If search within assembly fails, lookup in assemblies referenced by the primary module. For source assembly, this is equivalent to all assembly references given to compilation. Extra restrictions apply when searching for a well-known type. In particular, the type must be public. While resolving the name, consider only types following CLS-compliant generic type names and arity encoding (ECMA-335, section 10.7.2). I.e. arity is inferred from the name and matching type must have the same emitted name and arity. A diagnostic bag to receive warnings if we should allow multiple definitions and pick one. In case duplicate types are found, ignore the one from corlib. This is useful for any kind of compilation at runtime (EE/scripting/Powershell) using a type that is being migrated to corlib. In cases a type could not be found because of ambiguity, we return two of the candidates that caused the ambiguity. Null if the type can't be found. Resolves to a available in this assembly its referenced assemblies. The type to resolve. The resolved symbol if successful or null on failure. Lookup member declaration in predefined CorLib type in this Assembly. Only valid if this assembly is the Cor Library Lookup member declaration in predefined CorLib type used by this Assembly. If this symbol represents a metadata assembly returns the underlying . Otherwise, this returns . Represents a PE custom attribute Matches an attribute by metadata namespace, metadata type name. Does not load the type symbol for the attribute. True if the attribute data matches. Matches an attribute by metadata namespace, metadata type name and metadata signature. Does not load the type symbol for the attribute. Attribute to match. An index of the target constructor signature in signatures array, -1 if this is not the target attribute. Decodes System.Runtime.CompilerServices.DynamicAttribute applied to a specified metadata symbol and transforms the specified metadata type, using the decoded dynamic transforms attribute argument, by replacing each occurrence of type with dynamic type. This is a port of TypeManager::ImportDynamicTransformType from the native compiler. Comments from the C# design document for Dynamic: SPEC: To represent the dynamic type in metadata, any indexer, field or return value typed as dynamic or known to be a constructed type SPEC: containing dynamic will have each occurrence of dynamic erased to object and will be annotated with a [DynamicAttribute]. SPEC: If the relevant type is a constructed type, the attribute's constructor is passed a bool array. SPEC: This array represents a preorder traversal of each "node" in the constructed type's "tree of types", SPEC: with true set for each "node" that is dynamic, and false set for all other types. SPEC: When dynamic occurs as part of the base type of a type, the applicable [DynamicAttribute] is applied to the type itself. Should be accessed through , , and . Decodes the attributes applied to the given from metadata and checks if System.Runtime.CompilerServices.DynamicAttribute is applied. If so, it transforms the given , using the decoded dynamic transforms attribute argument, by replacing each occurrence of type with dynamic type. If no System.Runtime.CompilerServices.DynamicAttribute is applied or the decoded dynamic transforms attribute argument is erroneous, returns the unchanged . This method is a port of TypeManager::ImportDynamicTransformType from the native compiler. This subclass of MetadataDecoder is specifically for finding method symbols corresponding to method MemberRefs. The parent implementation is unsuitable because it requires a PEMethodSymbol for context when decoding method type parameters and no such context is available because it is precisely what we are trying to find. Since we know in advance that there will be no context and that signatures decoded with this class will only be used for comparison (when searching through the methods of a known TypeSymbol), we can return indexed type parameters instead. Type context for resolving generic type parameters. We know that we'll never have a method context because that's what we're trying to find. Instead, just return an indexed type parameter that will make comparison easier. This override can handle non-PE types. Search through the members of the type symbol to find the method that matches a particular signature. A MemberRef or a MethodDef handle that can be used to obtain the name and signature of the method True to only return a method. The matching method symbol, or null if the inputs do not correspond to a valid method. Helper class to resolve metadata tokens and signatures. Type context for resolving generic type arguments. Method context for resolving generic method type arguments. Lookup a type defined in referenced assembly. Lookup a type defined in a module of a multi-module assembly. Lookup a type defined in this module. This method will be called only if the type we are looking for hasn't been loaded yet. Otherwise, MetadataDecoder would have found the type in TypeDefRowIdToTypeMap based on its TypeDef row id. Perform a check whether the type or at least one of its generic arguments is defined in the specified assemblies. The check is performed recursively. Find canonical type for NoPia embedded type. Symbol for the canonical type or an ErrorTypeSymbol. Never returns null. If the type reference has an associated NullableAttribute, this method returns the type transformed to have IsNullable set to true or false (but not null) for each reference type in the type. Represents an assembly imported from a PE. An Assembly object providing metadata for the assembly. A DocumentationProvider that provides XML documentation comments for this assembly. The list of contained PEModuleSymbol objects. The list doesn't use type ReadOnlyCollection(Of PEModuleSymbol) so that we can return it from Modules property as is. An array of assemblies involved in canonical type resolution of NoPia local types defined within this assembly. In other words, all references used by a compilation referencing this assembly. The array and its content is provided by ReferenceManager and must not be modified. An array of assemblies referenced by this assembly, which are linked (/l-ed) by each compilation that is using this AssemblySymbol as a reference. If this AssemblySymbol is linked too, it will be in this array too. The array and its content is provided by ReferenceManager and must not be modified. Assembly is /l-ed by compilation that is using it as a reference. Assembly's custom attributes Look up the assemblies to which the given metadata type is forwarded. The assemblies to which the given type is forwarded. The returned assemblies may also forward the type. The class to represent all events imported from a PE/module. Look for a field with the same name and an appropriate type (i.e. the same type, except in WinRT). If one is found, the caller will assume that this event was originally field-like and associate the two symbols. Perf impact: If we find a field with the same name, we will eagerly evaluate its type. Intended behavior: this event, E, explicitly implements an interface event, IE, if E.add explicitly implements IE.add and E.remove explicitly implements IE.remove. The class to represent all fields imported from a PE/module. Mark this field as the backing field of a field-like event. The caller will also ensure that it is excluded from the member list of the containing type (as it would be in source). The module containing the namespace. The class to represent all methods imported from a PE/module. internal for testing purpose This type is used to hold lazily-initialized fields that many methods will not need. We avoid creating it unless one of the fields is needed; unfortunately, this means that we need to be careful of data races. The general pattern that we use is to check for a flag in . If the flag for that field is set, and there was a positive result (ie, there are indeed custom attributes, or there is obsolete data), then it is safe to rely on the data in the field. If the flag for a field is set but the result is empty (ie, there is no obsolete data), then we can be in one of 3 scenarios: is itself null. In this case, no race has occurred, and the consuming code can safely handle the lack of however it chooses. is not null, and the backing field has been initialized to some empty value, such as . In this case, again, no race has occurred, and the consuming code can simply trust the empty value. is not null, and the backing field is uninitialized, either being , or is some kind of sentinel value. In this case, a data race has occurred, and the consuming code must initialize the field to empty to bring it back into scenario 2. The initialization pattern for this type must follow the following pattern to make the safety guarantees above: If the field initialization code determines that the backing field needs to be set to some non-empty value, it must first call , set the backing field using an atomic operation, and then set the flag in . This ensures that the field is always set before the flag is set. If this order is reversed, the consuming code may see the flag set, but the field not initialized, and incorrectly assume that there is no data. A single field to hold optional auxiliary data. In many scenarios it is possible to avoid allocating this, thus saving total space in . Even for lazily-computed values, it may be possible to avoid allocating if the computed value is a well-known "empty" value. In this case, bits in are used to indicate that the lazy values have been computed and, if is null, then the "empty" value should be inferred. Associate the method with a particular property. Returns false if the method is already associated with a property or event. Associate the method with a particular event. Returns false if the method is already associated with a property or event. internal for testing purpose If a methodimpl record indicates a unique overridden method, that method. Otherwise null. Represents a net-module imported from a PE. Can be a primary module of an assembly. Owning AssemblySymbol. This can be a PEAssemblySymbol or a SourceAssemblySymbol. A Module object providing metadata. Global namespace. Cache the symbol for well-known type System.Type because we use it frequently (for attributes). The same value as ConcurrentDictionary.DEFAULT_CAPACITY This is a map from TypeDef handle to the target . It is used by to speed up type reference resolution for metadata coming from this module. The map is lazily populated as we load types from the module. This is a map from TypeRef row id to the target . It is used by to speed up type reference resolution for metadata coming from this module. The map is lazily populated by as we resolve TypeRefs from the module. Module's custom attributes Module's assembly attributes Returns attributes with up-to 6 filters applied. For each filter, the last application of the attribute will be tracked and returned. Get the custom attributes, but filter out any ParamArrayAttributes. The parameter token handle. Set to a ParamArrayAttribute CustomAttributeHandle if any are found. Nil token otherwise. Filters extension attributes from the attribute results. True if we found an extension method, false otherwise. The attributes on the token, minus any ExtensionAttributes. Returns a tuple of the assemblies this module forwards the given type to. Type to look up. A tuple of the forwarded to assemblies. The returned assemblies may also forward the type. The class to represent all types imported from a PE/module. A set of all the names of the members in this type. We can get names without getting members (which is a more expensive operation) We used to sort symbols on demand and relied on row ids to figure out the order between symbols of the same kind. However, that was fragile because, when map tables are used in metadata, row ids in the map table define the order and we don't have them. Members are grouped by kind. First we store fields, then methods, then properties, then events and finally nested types. Within groups, members are sorted based on declaration order. A map of members immediately contained within this type grouped by their name (case-sensitively). A map of types immediately contained within this type grouped by their name (case-sensitively). Lazily initialized by TypeKind property. Need to import them for an enum from a linked assembly, when we are embedding it. These symbols are not included into lazyMembersInDeclarationOrder. Returns the index of the first member of the specific kind. Returns the number of members if not found. Returns all members of the specific kind, starting at the optional offset. Members of the same kind are assumed to be contiguous. Specialized PENamedTypeSymbol for types with no type parameters in metadata (no type parameters on this type and all containing types). Specialized PENamedTypeSymbol for types with type parameters in metadata. NOTE: the type may have Arity == 0 if it has same metadata arity as the metadata arity of the containing type. Return true if the type parameters specified on the nested type (this), that represent the corresponding type parameters on the containing types, in fact match the actual type parameters on the containing types. The base class to represent a namespace imported from a PE/module. Namespaces that differ only by casing in name are not merged. A map of namespaces immediately contained within this namespace mapped by their name (case-sensitively). A map of types immediately contained within this namespace grouped by their name (case-sensitively). A map of NoPia local types immediately contained in this assembly. Maps type name (non-qualified) to the row id. Note, for VB we should use full name. All type members in a flat array All namespace and type members in a flat array Returns PEModuleSymbol containing the namespace. PEModuleSymbol containing the namespace. Initializes namespaces and types maps with information about namespaces and types immediately contained within this namespace. The sequence of groups of TypeDef row ids for types contained within the namespace, recursively including those from nested namespaces. The row ids must be grouped by the fully-qualified namespace name case-sensitively. There could be multiple groups for each fully-qualified namespace name. The groups must be sorted by their key in case-sensitive manner. Empty string must be used as namespace name for types immediately contained within Global namespace. Therefore, all types in this namespace, if any, must be in several first IGroupings. Create symbols for nested namespaces and initialize namespaces map. Create symbols for nested types and initialize types map. The class to represent all, but Global, namespaces imported from a PE/module. Namespaces that differ only by casing in name are not merged. The parent namespace. There is always one, Global namespace contains all top level namespaces. The name of the namespace. The sequence of groups of TypeDef row ids for types contained within the namespace, recursively including those from nested namespaces. The row ids are grouped by the fully-qualified namespace name case-sensitively. There could be multiple groups for each fully-qualified namespace name. The groups are sorted by their key in case-sensitive manner. Empty string is used as namespace name for types immediately contained within Global namespace. Therefore, all types in this namespace, if any, will be in several first IGroupings. This member is initialized by constructor and is cleared in EnsureAllMembersLoaded as soon as symbols for children are created. Constructor. Name of the namespace, must be not empty. Containing namespace. The sequence of groups of TypeDef row ids for types contained within the namespace, recursively including those from nested namespaces. The row ids are grouped by the fully-qualified namespace name case-sensitively. There could be multiple groups for each fully-qualified namespace name. The groups are sorted by their key in case-sensitive manner. Empty string is used as namespace name for types immediately contained within Global namespace. Therefore, all types in this namespace, if any, will be in several first IGroupings. The class to represent all method parameters imported from a PE/module. The index of a CallerArgumentExpression. The value -2 means uninitialized, -1 means not found. Otherwise, the index of the CallerArgumentExpression. Attributes filtered out from m_lazyCustomAttributes, ParamArray, etc. Construct a parameter symbol for a property loaded from metadata. The property parameter doesn't have a name in metadata, so this is the handle of a corresponding accessor parameter, if there is one, or of the ParamInfo passed in, otherwise. Internal for testing. Non-test code should use . The class to represent all properties imported from a PE/module. This type is used to hold lazily-initialized fields that many properties will not need. We avoid creating it unless one of the fields is needed; unfortunately, this means that we need to be careful of data races. The general pattern that we use is to check for a flag in . If the flag for that field is set, and there was a positive result (ie, there are indeed custom attributes, or there is obsolete data), then it is safe to rely on the data in the field. If the flag for a field is set but the result is empty (ie, there is no obsolete data), then we can be in one of 3 scenarios: is itself null. In this case, no race has occurred, and the consuming code can safely handle the lack of however it chooses. is not null, and the backing field has been initialized to some empty value, such as . In this case, again, no race has occurred, and the consuming code can simply trust the empty value. is not null, and the backing field is uninitialized, either being , or is some kind of sentinel value. In this case, a data race has occurred, and the consuming code must initialize the field to empty to bring it back into scenario 2. The initialization pattern for this type must follow the following pattern to make the safety guarantees above: If the field initialization code determines that the backing field needs to be set to some non-empty value, it must first call , set the backing field using an atomic operation, and then set the flag in . This ensures that the field is always set before the flag is set. If this order is reversed, the consuming code may see the flag set, but the field not initialized, and incorrectly assume that there is no data. To facilitate lookup, all indexer symbols have the same name. Check the MetadataName property to find the name we imported. This property can return true for bogus indexers. Rationale: If a type in metadata has a single, bogus indexer and a source method tries to invoke it, then Dev10 reports a bogus indexer rather than lack of an indexer. Intended behavior: this property, P, explicitly implements an interface property, IP, if any of the following is true: 1) P.get explicitly implements IP.get and P.set explicitly implements IP.set 2) P.get explicitly implements IP.get and there is no IP.set 3) P.set explicitly implements IP.set and there is no IP.get Extra or missing accessors will not result in errors, P will simply not report that it explicitly implements IP. The class to represent all generic type parameters imported from a PE/module. First error calculating bounds. Returns the byte value from the (single byte) NullableAttribute or nearest NullableContextAttribute. Returns 0 if neither attribute is specified. In C#, tuples can be represented using tuple syntax and be given names. However, the underlying representation for tuples unifies to a single underlying tuple type, System.ValueTuple. Since the names aren't part of the underlying tuple type they have to be recorded somewhere else. Roslyn records tuple names in an attribute: the TupleElementNamesAttribute. The attribute contains a single string array which records the names of the tuple elements in a pre-order depth-first traversal. If the type contains nested parameters, they are also recorded in a pre-order depth-first traversal. can be used to extract tuple names and types from metadata and create a with attached names. For instance, a method returning a tuple (int x, int y) M() { ... } will be encoded using an attribute on the return type as follows [return: TupleElementNamesAttribute(new[] { "x", "y" })] System.ValueTuple<int, int> M() { ... } For nested type parameters, we expand the tuple names in a pre-order traversal: class C : BaseType<((int e1, int e2) e3, int e4)< { ... } becomes [TupleElementNamesAttribute(new[] { "e3", "e4", "e1", "e2" }); class C : BaseType<System.ValueTuple< System.ValueTuple<int,int>, int> { ... } Represents a retargeting custom attribute Essentially this is a wrapper around another AssemblySymbol that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. For example, compilation C1 references v1 of Lib.dll and compilation C2 references C1 and v2 of Lib.dll. In this case, in context of C2, all types from v1 of Lib.dll leaking through C1 (through method signatures, etc.) must be retargeted to the types from v2 of Lib.dll. This is what RetargetingAssemblySymbol is responsible for. In the example above, modules in C2 do not reference C1.m_AssemblySymbol, but reference a special RetargetingAssemblySymbol created for C1 by ReferenceManager. Here is how retargeting is implemented in general: - Symbols from underlying assembly are substituted with retargeting symbols. - Symbols from referenced assemblies that can be reused as is (i.e. doesn't have to be retargeted) are used as is. - Symbols from referenced assemblies that must be retargeted are substituted with result of retargeting. The underlying AssemblySymbol, it leaks symbols that should be retargeted. This cannot be an instance of RetargetingAssemblySymbol. The list of contained ModuleSymbol objects. First item in the list is RetargetingModuleSymbol that wraps corresponding SourceModuleSymbol from underlyingAssembly.Modules list, the rest are PEModuleSymbols for added modules. An array of assemblies involved in canonical type resolution of NoPia local types defined within this assembly. In other words, all references used by a compilation referencing this assembly. The array and its content is provided by ReferenceManager and must not be modified. An array of assemblies referenced by this assembly, which are linked (/l-ed) by each compilation that is using this AssemblySymbol as a reference. If this AssemblySymbol is linked too, it will be in this array too. The array and its content is provided by ReferenceManager and must not be modified. Backing field for the map from a local NoPia type to corresponding canonical type. A map from a local NoPia type to corresponding canonical type. Assembly is /l-ed by compilation that is using it as a reference. Retargeted custom attributes Constructor. The underlying AssemblySymbol, cannot be an instance of RetargetingAssemblySymbol. Assembly is /l-ed by compilation that is using it as a reference. The underlying . Lookup declaration for FX type in this Assembly. Owning RetargetingModuleSymbol. Represents a field in a RetargetingModuleSymbol. Essentially this is a wrapper around another FieldSymbol that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Owning RetargetingModuleSymbol. Retargeted custom attributes Represents a method in a RetargetingModuleSymbol. Essentially this is a wrapper around another MethodSymbol that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Owning RetargetingModuleSymbol. The underlying MethodSymbol. Retargeted custom attributes Retargeted return type custom attributes The explicitly overridden method (e.g. as would be declared in the PE method in covariant return scenarios). Represents a primary module of a . Essentially this is a wrapper around another that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Here is how retargeting is implemented in general: - Symbols from underlying module are substituted with retargeting symbols. - Symbols from referenced assemblies that can be reused as is (i.e. don't have to be retargeted) are used as is. - Symbols from referenced assemblies that must be retargeted are substituted with result of retargeting. Owning . The underlying , cannot be another . The map that captures information about what assembly should be retargeted to what assembly. Key is the referenced by the underlying module, value is the corresponding referenced by this module, and corresponding retargeting map for symbols. Retargeted custom attributes Constructor. Owning assembly. The underlying ModuleSymbol, cannot be another RetargetingModuleSymbol. The underlying ModuleSymbol, cannot be another RetargetingModuleSymbol. A helper method for ReferenceManager to set AssemblySymbols for assemblies referenced by this module. Retargeting map from underlying module to this one. Retargeting map from underlying module to the retargeting module. RetargetingAssemblySymbol owning retargetingModule. The underlying ModuleSymbol for retargetingModule. The map that captures information about what assembly should be retargeted to what assembly. Key is the AssemblySymbol referenced by the underlying module, value is the corresponding AssemblySymbol referenced by the retargeting module, and corresponding retargeting map for symbols. Perform a check whether the type or at least one of its generic arguments is an explicitly defined local type. The check is performed recursively. Represents a type of a RetargetingModuleSymbol. Essentially this is a wrapper around another NamedTypeSymbol that is responsible for retargeting referenced symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Owning RetargetingModuleSymbol. Represents a namespace of a RetargetingModuleSymbol. Essentially this is a wrapper around another NamespaceSymbol that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Owning RetargetingModuleSymbol. The underlying NamespaceSymbol, cannot be another RetargetingNamespaceSymbol. Represents a parameter of a RetargetingMethodSymbol. Essentially this is a wrapper around another ParameterSymbol that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Retargeted custom attributes This override is done for performance reasons. Lacking the override this would redirect to which returns null. The override short circuits the overhead in and the extra virtual dispatch and just returns null. Owning RetargetingMethodSymbol. Owning RetargetingPropertySymbol. Owning RetargetingModuleSymbol. Retargeted custom attributes Represents a type parameter in a RetargetingModuleSymbol. Essentially this is a wrapper around another TypeParameterSymbol that is responsible for retargeting symbols from one assembly to another. It can retarget symbols for multiple assemblies at the same time. Owning RetargetingModuleSymbol. Retargeted custom attributes Represents a Source custom attribute specification If the contains any named constructor arguments or default value arguments, it returns an array representing each argument's source argument index. A value of -1 indicates default value argument. Otherwise, returns null. This method finds an attribute by metadata name and signature. The algorithm for signature matching is similar to the one in Module.GetTargetAttributeSignatureIndex. Note, the signature matching is limited to primitive types and System.Type. It will not match an arbitrary signature but it is sufficient to match the signatures of the current set of well known attributes. The attribute to match. Compares the namespace and type name with the attribute's namespace and type name. Returns true if they are the same. Information decoded from well-known custom attributes applied on a field. Information decoded from well-known custom attributes applied on a method. Information decoded from well-known custom attributes applied on a method. Information decoded from well-known custom attributes applied on a module. Information early-decoded from well-known custom attributes applied on a parameter. Information decoded from well-known custom attributes applied on a parameter. Information decoded from early well-known custom attributes applied on a property. Information decoded from well-known custom attributes applied on a property. Information decoded from well-known custom attributes applied on a type. Information decoded early from well-known custom attributes applied on a type. IsManagedType is simple for most named types: enums are not managed; non-enum, non-struct named types are managed; type parameters are managed unless an 'unmanaged' constraint is present; all special types have spec'd values (basically, (non-string) primitives) are not managed; Only structs are complicated, because the definition is recursive. A struct type is managed if one of its instance fields is managed or a ref field. Unfortunately, this can result in infinite recursion. If the closure is finite, and we don't find anything definitely managed, then we return true. If the closure is infinite, we disregard all but a representative of any expanding cycle. Intuitively, this will only return true if there's a specific type we can point to that is would be managed even if it had no fields. e.g. struct S { S s; } is not managed, but struct S { S s; object o; } is because we can point to object. Returns True or False if we can determine whether the type is managed without looking at its fields and Unknown otherwise. Also returns whether or not the given type is generic. This enum describes the types of components that could give us diagnostics. We shouldn't read the list of diagnostics until all of these types are accounted for. PEParameterSymbol reserves all completion part bits and uses them to track the completion state and presence of well known attributes. A tuple of TypeParameterSymbol and DiagnosticInfo, created for errors reported from ConstraintsHelper rather than creating Diagnostics directly. This decouples constraints checking from syntax and Locations, and supports callers that may want to create Location instances lazily or not at all. Helper methods for generic type parameter constraints. There are two sets of methods: one set for resolving constraint "bounds" (that is, determining the effective base type, interface set, etc.), and another set for checking for constraint violations in type and method references. Bounds are resolved by calling one of the ResolveBounds overloads. Typically bounds are resolved by each TypeParameterSymbol at, or before, one of the corresponding properties (BaseType, Interfaces, etc.) is accessed. Resolving bounds may result in errors (cycles, inconsistent constraints, etc.) and it is the responsibility of the caller to report any such errors as declaration errors or use-site errors (depending on whether the type parameter was from source or metadata) and to ensure bounds are resolved for source type parameters even if the corresponding properties are never accessed directly. Constraints are checked by calling one of the CheckConstraints or CheckAllConstraints overloads for any generic type or method reference from source. In some circumstances, references are checked at the time the generic type or generic method is bound and constructed by the Binder. In those case, it is sufficient to call one of the CheckConstraints overloads since compound types (such as A<T>.B<U> or A<B<T>>) are checked incrementally as each part is bound. In other cases however, constraint checking needs to be delayed to prevent cycles where checking constraints requires binding the syntax that is currently being bound (such as the constraint in class C<T> where T : C<T>). In those cases, the caller must lazily check constraints, and since the types may be compound types, it is necessary to call CheckAllConstraints. Determine the effective base type, effective interface set, and set of type parameters (excluding cycles) from the type parameter constraints. Conflicts within the constraints and constraint types are returned as diagnostics. 'inherited' should be true if the type parameters are from an overridden generic method. In those cases, additional constraint checks are applied. Check all generic constraints on the given type and any containing types (such as A<T> in A<T>.B<U>). This includes checking constraints on generic types within the type (such as B<T> in A<B<T>[]>). Check type parameter constraints for the containing type or method symbol. The generic type or method. Arguments for constraints checking. The map from type parameters to type arguments. Containing symbol type parameters. Containing symbol type arguments. Diagnostics. Nullability warnings. Parameters to skip. If an original form of a type constraint depends on a type parameter from this set, do not verify this type constraint. True if the constraints were satisfied, false otherwise. Returns true if type a is encompassed by type b (spec 6.4.3), and returns false otherwise. A named type symbol that results from substituting a new owner for a type declaration. A generic named type symbol that has been constructed with type arguments distinct from its own type parameters. Substitutes all occurrences of dynamic type with Object type. When indexer overload resolution fails, we have two options: 1) Create a BoundBadExpression with the candidates as child nodes; 2) Create a BoundIndexerAccess with the error flag set. Option 2 is preferable, because it retains information about the arguments (names, ref kind, etc), and results in better output from flow analysis. However, we can't create a BoundIndexerAccess with a null indexer symbol, so we create an ErrorPropertySymbol to fill the gap. An ErrorSymbol is used when the compiler cannot determine a symbol object to return because of an error. For example, if a field is declared "Goo x;", and the type "Goo" cannot be found, an ErrorSymbol is returned when asking the field "x" what it's type is. The underlying error. Summary of the reason why the type is bad. Called by to perform substitution on types with TypeKind ErrorType. The general pattern is to use the type map to perform substitution on the wrapped type, if any, and then construct a new error type symbol from the result (if there was a change). When constructing this ErrorTypeSymbol, there may have been symbols that seemed to be what the user intended, but were unsuitable. For example, a type might have been inaccessible, or ambiguous. This property returns the possible symbols that the user might have intended. It will return no symbols if no possible symbols were found. See the CandidateReason property to understand why the symbols were unsuitable. If CandidateSymbols returns one or more symbols, returns the reason that those symbols were not chosen. Otherwise, returns None. Returns true if this type is known to be a reference type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false. Returns true if this type is known to be a value type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false. Collection of names of members declared within this type. Get all the members of this symbol. An ImmutableArray containing all the members of this symbol. If this symbol has no members, returns an empty ImmutableArray. Never returns Null. Get all the members of this symbol that have a particular name. An ImmutableArray containing all the members of this symbol with the given name. If there are no members with this name, returns an empty ImmutableArray. Never returns Null. Get all the members of this symbol that are types. An ImmutableArray containing all the types that are members of this symbol. If this symbol has no type members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types that have a particular name, of any arity. An ImmutableArray containing all the types that are members of this symbol with the given name. If this symbol has no type members with this name, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types that have a particular name and arity An ImmutableArray containing all the types that are members of this symbol with the given name and arity. If this symbol has no type members with this name and arity, returns an empty ImmutableArray. Never returns null. Gets the kind of this symbol. Gets the kind of this type. Get the symbol that logically contains this symbol. Gets the locations where this symbol was originally defined, either in source or metadata. Some symbols (for example, partial classes) may be defined in more than one location. Returns the arity of this type, or the number of type parameters it takes. A non-generic type has zero arity. Gets the name of this symbol. Symbols without a name return the empty string; null is never returned. Returns the type arguments that have been substituted for the type parameters. If nothing has been substituted for a given type parameter, then the type parameter itself is consider the type argument. Returns the type parameters that this type has. If this is a non-generic type, returns an empty ImmutableArray. Returns the type symbol that this type was constructed from. This type symbol has the same containing type (if any), but has type arguments that are the same as the type parameters (although its containing type might not). Implements visitor pattern. Get this accessibility that was declared on this symbol. For symbols that do not have accessibility declared on them, returns NotApplicable. Returns true if this symbol is "static"; i.e., declared with the "static" modifier or implicitly static. Returns true if this symbol was declared as requiring an override; i.e., declared with the "abstract" modifier. Also returns true on a type declared as "abstract", all interface types, and members of interface types. Returns true if this symbol was declared to override a base class member and was also sealed from further overriding; i.e., declared with the "sealed" modifier. Also set for types that do not allow a derived class (declared with "sealed" or "static" or "struct" or "enum" or "delegate"). An error type, used to represent the type of a type binding operation when binding fails. If (we believe) we know which symbol the user intended, then we should retain that information in the corresponding error symbol - it can be useful for deciding how to handle the error. For example, we might want to know whether (we believe) the error type was supposed to be an interface, so that we can put it in a derived type's interface list, rather than in the base type slot. Sometimes we will return the original definition of the intended symbol. For example, if we see ]]> and we have an IGoo with a different arity or accessibility (e.g. ]]> was constructed from an error symbol based on ]]>), then we'll return ]]>, rather than trying to construct a corresponding closed type (which may not be difficult/possible in the case of nested types or mismatched arities). NOTE: Any non-null type symbol returned is guaranteed not to be an error type. TypeSymbolExtensions.GetNonErrorGuess is a more discoverable version of this functionality. However, the real definition is in this class so that it can access the private field nonErrorGuessType. Represents a field initializer, a property initializer, or a global statement in script code. The field being initialized (possibly a backing field of a property), or null if this is a top-level statement in script code. A reference to , or top-level in script code, or for an initialization of a generated property based on record parameter. Creates a function pointer method symbol from individual parts. This method should only be used when diagnostics are not needed. This should only be used from testing code. Creates a function pointer method symbol from individual parts. This method should only be used when diagnostics are not needed. Creates a function pointer method symbol from individual parts. This method should only be used when diagnostics are not needed. Inferred delegate type state, recorded during testing only. Number of delegate types calculated in the compilation. A implementation that represents the lazily-inferred signature of a lambda expression or method group. This is implemented as a to allow types and function signatures to be treated similarly in , , and . Instances of this type should only be used in those code paths and should not be exposed from the symbol model. The actual delegate signature is calculated on demand in . Returns the inferred signature as a delegate type or null if the signature could not be inferred. Represents a label in method body Returns false because label can't be defined externally. Returns false because label can't be sealed. Returns false because label can't be abstract. Returns false because label can't be overridden. Returns false because label can't be virtual. Returns false because label can't be static. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Returns 'NotApplicable' because label can't be used outside the member body. Gets the locations where the symbol was originally defined, either in source or metadata. Some symbols (for example, partial classes) may be defined in more than one location. Gets the immediately containing symbol of the . It should be the containing the label in its body. Gets the immediately containing symbol of the . It should be the containing the label in its body. Returns value 'Label' of the A structure used to lexically order symbols. For performance, it's important that this be a STRUCTURE, and be able to be returned from a symbol without doing any additional allocations (even if nothing is cached yet). Compare two lexical sort keys in a compilation. Specifies the syntactic construct that a user defined variable comes from. The local is not user defined nor it is a copy of a user defined local (e.g. with a substituted type). Check the value of for the kind of synthesized variable. User defined local variable declared by . User defined local constant declared by . User defined local variable declared by in . User defined local variable declared by in . User defined local variable declared by . User defined local variable declared by or . The variable that captures the result of a pattern matching operation like "i" in "expr is int i" User variable declared by a declaration expression in the left-hand-side of a deconstruction assignment. User variable declared as an out argument. User variable declared by a declaration expression in some unsupported context. This occurs as a result of error recovery in incorrect code. Represents a local variable in a method body. Syntax node that is used as the scope designator. Otherwise, null. Gets the type of this local along with its annotations. Gets the type of this local. WARN WARN WARN: If you access this via the semantic model, things will break (since the initializer may not have been bound). Whether or not this local is pinned (i.e. the type will be emitted with the "pinned" modifier). Superficially, it seems as though this should always be the same as DeclarationKind == LocalDeclarationKind.Fixed. Unfortunately, when we fix a string expression, it is not the declared local (e.g. char*) but a synthesized temp (string) that is pinned. This property is used to avoid creating unnecessary copies of reference type receivers for constrained calls. Returns false because local variable can't be defined externally. Returns false because local variable can't be sealed. Returns false because local variable can't be abstract. Returns false because local variable can't be overridden. Returns false because local variable can't be virtual. Returns false because local variable can't be declared as static in C#. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Returns 'NotApplicable' because local variable can't be used outside the member body.. Returns value 'Local' of the Returns true if this local variable was declared in a catch clause. Returns true if this local variable was declared as "const" (i.e. is a constant declaration). Returns true if the local variable is declared in resource-acquisition of a 'using statement'; otherwise false using (var localVariable = new StreamReader("C:\\Temp\\MyFile.txt")) { ... } Returns true if the local variable is declared in fixed-pointer-initializer (in unsafe context) Returns true if this local variable is declared as iteration variable Returns the syntax node that declares the variable. Should always return a value if returns . May throw if it returns . All user-defined and long-lived synthesized variables must return a reference to a node that is tracked by the EnC diffing algorithm. For example, for variable the declarator is the node. The location of the declarator is used to calculate during emit. if this has a real syntax location in source code, otherwise. A common example of a local without a source location is an EE local symbol. Describes whether this represents a modifiable variable. Note that this refers to the variable, not the underlying value, so if this variable is a ref-local, the writability refers to ref-assignment, not assignment to the underlying storage. Returns false if the field wasn't declared as "const", or constant value was omitted or erroneous. True otherwise. If IsConst returns true, then returns the constant value of the field or enum member. If IsConst returns false, then returns null. Returns true if the local symbol was compiler generated. When a local variable's type is inferred, it may not be used in the expression that computes its value (and type). This property returns the expression where a reference to an inferred variable is forbidden. The diagnostic code to be reported when an inferred variable is used in its forbidden zone. C# 4.0 §10.6: The name, the type parameter list and the formal parameter list of a method define the signature (§3.6) of the method. Specifically, the signature of a method consists of its name, the number of type parameters and the number, modifiers, and types of its formal parameters. For these purposes, any type parameter of the method that occurs in the type of a formal parameter is identified not by its name, but by its ordinal position in the type argument list of the method. The return type is not part of a method's signature, nor are the names of the type parameters or the formal parameters. C# 4.0 §3.6: For the purposes of signatures, the types object and dynamic are considered the same. C# 4.0 §3.6: We implement the rules for ref/out by mapping both to ref. The caller (i.e. checking for proper overrides or partial methods, etc) should check that ref/out are consistent. This instance is used when trying to determine if one member explicitly implements another, according the C# definition. The member signatures are compared without regard to name (including the interface part, if any) and the return types must match. This instance is used when trying to determine if one member implicitly implements another, according to the C# definition. The member names, parameters, and (return) types must match. Custom modifiers are ignored. One would expect this comparer to have requireSourceMethod = true, but it doesn't because (for source types) we allow inexact matching of custom modifiers when computing implicit member implementations. Consider the following scenario: interface I has a method M with custom modifiers C1, source type ST includes I in its interface list but has no method M, and metadata type MT has a method M with custom modifiers C2. In this scenario, we want to compare I.M to MT.M without regard to custom modifiers, because if C1 != C2, we can just synthesize an explicit implementation of I.M in ST that calls MT.M. This instance is used as a fallback when it is determined that one member does not implicitly implement another. It applies a looser check to determine whether the proposed implementation should be reported as "close". This instance is used to determine if two C# member declarations in source conflict with each other. Names, arities, and parameter types are considered. Return types, type parameter constraints, custom modifiers, and parameter ref kinds, etc are ignored. This does the same comparison that MethodSignature used to do. This instance is used to determine if some API specific to records is explicitly declared. It is the same as except it considers ref kinds as well. This instance is used to determine if a partial method implementation matches the definition. It is the same as except it considers ref kinds as well. This instance is used to determine if a partial method implementation matches the definition, including differences ignored by the runtime. Determines if an interceptor has a compatible signature with an interceptable method. NB: when a classic extension method is intercepting an instance method call, a normalization to 'ReducedExtensionMethodSymbol' must be performed first. Determines if an interceptor has a compatible signature with an interceptable method. If methods are considered equal by , but not equal by this comparer, a warning is reported. NB: when a classic extension method is intercepting an instance method call, a normalization to 'ReducedExtensionMethodSymbol' must be performed first. This instance is used to check whether one member overrides another, according to the C# definition. This instance checks whether two signatures match including tuples names, in both return type and parameters. It is used to detect tuple-name-only differences. This instance checks whether two signatures match excluding tuples names, in both return type and parameters. It is used to detect tuple-name-only differences. This instance is used to check whether one property or event overrides another, according to the C# definition. NOTE: C# ignores accessor member names. Same as except that it pays attention to custom modifiers and return type. Normally, the return type isn't considered during overriding, but this comparer is actually used to find exact matches (i.e. before tie-breaking takes place amongst close matches). If this returns false, then the real override comparer (whichever one is appropriate for the scenario) will also return false. This instance is intended to reflect the definition of signature equality used by the runtime (ECMA-335, Partition I, §8.6.1.6 Signature Matching). It considers return type, name, parameters, calling convention, and custom modifiers, but ignores the difference between and . Same as , but in addition ignores name. Same as , but distinguishes between ref and out. During override resolution, if we find two methods that match except for ref/out, we want to prefer the one that matches, even if the runtime doesn't. This instance is the same as RuntimeSignatureComparer. CONSIDER: just use RuntimeSignatureComparer? This instance is used to search for members that have identical signatures in every regard. This instance is used for performing approximate overload resolution of documentation comment cref attributes. It ignores the name, because the candidates were all found by lookup. Compare signatures of methods from a method group (only used in logic for older language version). Compare signatures of methods from a method group. Returns true if the first set of constraint types is a subset of the second set. Do the members differ in terms of tuple names (both in their return type and parameters), but would match ignoring names? We'll look at the result of equality without tuple names (1) and with tuple names (2). The question is whether there is a change in tuple element names only (3). member1 vs. member2 | (1) | (2) | (3) | (int a, int b) M() vs. (int a, int b) M() | yes | yes | match | (int a, int b) M() vs. (int x, int y) M() | yes | no | different | void M((int a, int b)) vs. void M((int x, int y)) | yes | no | different | int M() vs. string M() | no | no | match | Ref parameter modifiers are ignored. Parameters with different ref modifiers are considered different. 'in'/'ref readonly' modifiers are considered equivalent. SymbolExtensions for member symbols. Get the parameters of a member symbol. Should be a method, property, or event. Get the types of the parameters of a member symbol. Should be a method, property, or event. Get the ref kinds of the parameters of a member symbol. Should be a method, property, or event. Count the number of custom modifiers in/on the return type and parameters of the specified method. Count the number of custom modifiers in/on the type and parameters (for indexers) of the specified property. Return the arity of a member. Returns true if the method is a constructor and has a this() constructor initializer. NOTE: every struct has a public parameterless constructor either user-defined or default one Returns true if the method is the default constructor synthesized for struct types. If the containing struct type is from metadata, the default constructor is synthesized when there is no accessible parameterless constructor. (That synthesized constructor from metadata zero-inits the instance.) If the containing struct type is from source, the parameterless constructor is synthesized if there is no explicit parameterless constructor, and the synthesized parameterless constructor simply zero-inits the instance (and is not emitted). Indicates whether the method should be emitted. If the event has a AddMethod, return that. Otherwise check the overridden event, if any. Repeat for each overridden event. This method exists to mimic the behavior of GetOwnOrInheritedGetMethod, but it should only ever look at the overridden event in error scenarios. If the event has a RemoveMethod, return that. Otherwise check the overridden event, if any. Repeat for each overridden event. This method exists to mimic the behavior of GetOwnOrInheritedSetMethod, but it should only ever look at the overridden event in error scenarios. Does the compilation this symbol belongs to output to a winmdobj? Returns a constructed named type symbol if 'type' is generic, otherwise just returns 'type' Returns true if the members of superType are accessible from subType due to inheritance. The immediately containing namespace or named type, or null if the containing symbol is neither a namespace or named type. Returns true if all type parameter references within the given type belong to containingSymbol or its containing types. Returns true if all type parameter references within the given types belong to containingSymbol or its containing types. Does the top level type containing this symbol have 'Microsoft.CodeAnalysis.Embedded' attribute? A MergedNamespaceSymbol represents a namespace that merges the contents of two or more other namespaces. Any sub-namespaces with the same names are also merged if they have two or more instances. Merged namespaces are used to merge the symbols from multiple metadata modules and the source "module" into a single symbol tree that represents all the available symbols. The compiler resolves names against this merged set of symbols. Typically there will not be very many merged namespaces in a Compilation: only the root namespaces and namespaces that are used in multiple referenced modules. (Microsoft, System, System.Xml, System.Diagnostics, System.Threading, ...) Create a possibly merged namespace symbol. If only a single namespace is passed it, it is just returned directly. If two or more namespaces are passed in, then a new merged namespace is created with the given extent and container. The namespace extent to use, IF a merged namespace is created. The containing namespace to used, IF a merged namespace is created. One or more namespaces to merged. If just one, then it is returned. The merged namespace symbol may hold onto the array. An optional name to give the resulting namespace. A namespace symbol representing the merged namespace. Method that is called from the CachingLookup to lookup the children of a given name. Looks in all the constituent namespaces. Method that is called from the CachingLookup to get all child names. Looks in all constituent namespaces. Represents source or metadata assembly. An array of cached Cor types defined in this assembly. Lazily filled by GetDeclaredSpecialType method. How many Cor types have we cached so far. Lookup declaration for predefined CorLib type in this Assembly. Register declaration of predefined CorLib type in this Assembly. Continue looking for declaration of predefined CorLib type in this Assembly while symbols for new type declarations are constructed. Not yet known value is represented by ErrorTypeSymbol.UnknownResultType Lookup member declaration in predefined CorLib type in this Assembly. Only valid if this assembly is the Cor Library Determine whether this assembly has been granted access to . Assumes that the public key has been determined. The result will be cached. The runtime considers a method to be a finalizer (i.e. a method that should be invoked by the garbage collector) if it (directly or indirectly) overrides System.Object.Finalize. As an optimization, return true immediately for metadata methods with MethodKind Destructor - they are guaranteed to be finalizers. Method to inspect. This method is used to determine the method kind of a PEMethodSymbol, so we may need to avoid using MethodKind until we move on to a different MethodSymbol. Returns a constructed method symbol if 'method' is generic, otherwise just returns 'method' Some kinds of methods are not considered to be hideable by certain kinds of members. Specifically, methods, properties, and types cannot hide constructors, destructors, operators, conversions, or accessors. Some kinds of methods are never considered hidden by methods, properties, or types (constructors, destructors, operators, conversions, and accessors). Returns whether this method is async and returns void. Returns whether this method is async and returns a task, task-like, or other type with a method-level builder. Returns whether this method is async and returns a generic task, task-like, or other type with a method-level builder. Returns whether this method is async and returns an IAsyncEnumerable`1. Returns whether this method is async and returns an IAsyncEnumerator`1. A is a special kind of that represents an assembly that couldn't be found. AssemblySymbol to represent missing, for whatever reason, CorLibrary. The symbol is created by ReferenceManager on as needed basis and is shared by all compilations with missing CorLibraries. An array of cached Cor types defined in this assembly. Lazily filled by GetDeclaredSpecialType method. Lookup declaration for predefined CorLib type in this Assembly. Only should be called if it is know that this is the Cor Library (mscorlib). A is a special kind of that represents a type symbol that was attempted to be read from metadata, but couldn't be found, because: a) The metadata file it lives in wasn't referenced b) The metadata file was referenced, but didn't contain the type c) The metadata file was referenced, contained the correct outer type, but didn't contains a nested type in that outer type. Get the arity of the missing type. Represents not nested missing type. Either , , , or -1 if not initialized. This is the FULL namespace name (e.g., "System.Collections.Generic") of the type that couldn't be found. Represents nested missing type. A is a special kind of that represents a module that couldn't be found. A is a special kind of that represents a namespace that couldn't be found. Represents a module within an assembly. Every assembly contains one or more modules. Returns a NamespaceSymbol representing the global (root) namespace, with module extent, that can be used to browse all of the symbols defined in this module. Returns the containing assembly. Modules are always directly contained by an assembly, so this property always returns the same as ContainingSymbol. Returns value 'NetModule' of the Module's ordinal within containing assembly's Modules array. 0 - for a source module, etc. -1 - for a module that doesn't have containing assembly, or has it, but is not part of Modules array. Target architecture of the machine. Indicates that this PE file makes Win32 calls. See CorPEKind.pe32BitRequired for more information (http://msdn.microsoft.com/en-us/library/ms230275.aspx). Does this symbol represent a missing module. Returns 'NotApplicable' Returns false because module can't be declared as 'static'. Returns false because module can't be virtual. Returns false because module can't be overridden. Returns false because module can't be abstract. Returns false because module can't be sealed. Returns false because module can't be defined externally. Returns an array of assembly identities for assemblies referenced by this module. Items at the same position from ReferencedAssemblies and from ReferencedAssemblySymbols correspond to each other. Returns an array of assembly identities for assemblies referenced by this module. Items at the same position from GetReferencedAssemblies and from GetReferencedAssemblySymbols should correspond to each other. The array and its content is provided by ReferenceManager and must not be modified. Returns an array of AssemblySymbol objects corresponding to assemblies referenced by this module. Items at the same position from ReferencedAssemblies and from ReferencedAssemblySymbols correspond to each other. Returns an array of AssemblySymbol objects corresponding to assemblies referenced by this module. Items at the same position from GetReferencedAssemblies and from GetReferencedAssemblySymbols should correspond to each other. If reference is not resolved by compiler, GetReferencedAssemblySymbols returns MissingAssemblySymbol in the corresponding item. The array and its content is provided by ReferenceManager and must not be modified. A helper method for ReferenceManager to set assembly identities for assemblies referenced by this module and corresponding AssemblySymbols. A description of the assemblies referenced by this module. Source assembly that triggered creation of this module symbol. For debug purposes only, this assembly symbol should not be persisted within this module symbol because the module can be shared across multiple source assemblies. This method will only be called for the first one. True if this module has any unified references. Returns a unification use-site error (if any) for a symbol contained in this module that is referring to a specified . If an assembly referenced by this module isn't exactly matching any reference given to compilation the Assembly Manager might decide to use another reference if it matches except for version (it unifies the version with the existing reference). Lookup a top level type referenced from metadata, names should be compared case-sensitively. Full type name, possibly with generic name mangling. Symbol for the type, or null if the type isn't found. Returns true if there is any applied CompilationRelaxationsAttribute assembly attribute for this module. Returns true if there is any applied RuntimeCompatibilityAttribute assembly attribute for this module. Default char set for contained types, or null if not specified. Given a namespace symbol, returns the corresponding module specific namespace symbol Given a namespace symbol, returns the corresponding module specific namespace symbol If this symbol represents a metadata module returns the underlying . Otherwise, this returns . Utility class for substituting actual type arguments for formal generic type parameters. A NamespaceExtent represents whether a namespace contains types and sub-namespaces from a particular module, assembly, or merged across all modules (source and metadata) in a particular compilation. Returns what kind of extent: Module, Assembly, or Compilation. If the Kind is ExtendKind.Module, returns the module symbol that this namespace encompasses. Otherwise throws InvalidOperationException. If the Kind is ExtendKind.Assembly, returns the assembly symbol that this namespace encompasses. Otherwise throws InvalidOperationException. If the Kind is ExtendKind.Compilation, returns the compilation symbol that this namespace encompasses. Otherwise throws InvalidOperationException. Create a NamespaceExtent that represents a given ModuleSymbol. Create a NamespaceExtent that represents a given AssemblySymbol. Create a NamespaceExtent that represents a given Compilation. Represents either a namespace or a type. Returns true if this symbol is a namespace. If it is not a namespace, it must be a type. Returns true if this symbols is a type. Equivalent to !IsNamespace. Returns true if this symbol is "virtual", has an implementation, and does not override a base class member; i.e., declared with the "virtual" modifier. Does not return true for members declared as abstract or override. Always returns false. Returns true if this symbol was declared to override a base class member; i.e., declared with the "override" modifier. Still returns true if member was declared to override something, but (erroneously) no member to override exists. Always returns false. Returns true if this symbol has external implementation; i.e., declared with the "extern" modifier. Always returns false. Get all the members of this symbol. An ImmutableArray containing all the members of this symbol. If this symbol has no members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol. The members may not be in a particular order, and the order may not be stable from call-to-call. An ImmutableArray containing all the members of this symbol. If this symbol has no members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that have a particular name. An ImmutableArray containing all the members of this symbol with the given name. If there are no members with this name, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types. The members may not be in a particular order, and the order may not be stable from call-to-call. An ImmutableArray containing all the types that are members of this symbol. If this symbol has no type members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types. An ImmutableArray containing all the types that are members of this symbol. If this symbol has no type members, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types that have a particular name, of any arity. An ImmutableArray containing all the types that are members of this symbol with the given name. If this symbol has no type members with this name, returns an empty ImmutableArray. Never returns null. Get all the members of this symbol that are types that have a particular name and arity An IEnumerable containing all the types that are members of this symbol with the given name and arity. If this symbol has no type members with this name and arity, returns an empty IEnumerable. Never returns null. Get a source type symbol for the given declaration syntax. Null if there is no matching declaration. Get a source type symbol for the given declaration syntax. Null if there is no matching declaration. Get a source type symbol of given name, arity and kind. If a tree and syntax are provided, restrict the results to those that are declared within the given syntax. Null if there is no matching declaration. Lookup an immediately nested type referenced from metadata, names should be compared case-sensitively. Simple type name, possibly with generic name mangling. Symbol for the type, or null if the type isn't found. Finds types or namespaces described by a qualified name. Sequence of simple plain names. A set of namespace or type symbols with given qualified name (might comprise of types with multiple generic arities), or an empty set if the member can't be found (the qualified name is ambiguous or the symbol doesn't exist). "C.D" matches C.D, C{T}.D, C{S,T}.D{U}, etc. This wrapper is only used on platforms where System.IntPtr isn't considered a numeric type (as indicated by a RuntimeFeature flag). Certain members from the underlying types are not exposed from the native integer types: constructors other than the default parameterless constructor are not supported; operators are handled explicitly as built-in operators and conversions; 0 should be used instead of Zero; sizeof() should be used instead of Size; + and - should be used instead of Add() and Subtract(); ToInt32(), ToInt64(), ToPointer() should be used from underlying types only. The remaining members are exposed on the native integer types with appropriate substitution of underlying types in the signatures. Specifically, we expose public, non-generic instance and static methods and properties other than those named above. Replaces references to underlying type with references to native integer type. Replaces references to underlying type with references to native integer type. A is a special kind of that represents an assembly that is not missing, i.e. the "real" thing. This is a cache similar to the one used by MetaImport::GetTypeByName in native compiler. The difference is that native compiler pre-populates the cache when it loads types. Here we are populating the cache only with things we looked for, so that next time we are looking for the same thing, the lookup is fast. This cache also takes care of TypeForwarders. Gives about 8% win on subsequent lookups in some scenarios. Does this symbol represent a missing assembly. Gets the merged root namespace that contains all namespaces and types defined in the modules of this assembly. If there is just one module in this assembly, this property just returns the GlobalNamespace of that module. Lookup a top level type referenced from metadata, names should be compared case-sensitively. Detect cycles during lookup. Full type name, possibly with generic name mangling. Lookup a top level type referenced from metadata, names should be compared case-sensitively. Detect cycles during lookup. Full type name, possibly with generic name mangling. List of assemblies lookup has already visited (since type forwarding can introduce cycles). For test purposes only. For test purposes only. A is a special kind of that represents a module that is not missing, i.e. the "real" thing. An array of objects corresponding to assemblies directly referenced by this module. The contents are provided by ReferenceManager and may not be modified. Does this symbol represent a missing module. Returns an array of assembly identities for assemblies referenced by this module. Items at the same position from GetReferencedAssemblies and from GetReferencedAssemblySymbols should correspond to each other. Returns an array of AssemblySymbol objects corresponding to assemblies referenced by this module. Items at the same position from GetReferencedAssemblies and from GetReferencedAssemblySymbols should correspond to each other. If reference is not resolved by compiler, GetReferencedAssemblySymbols returns MissingAssemblySymbol in the corresponding item. A helper method for ReferenceManager to set assembly identities for assemblies referenced by this module and corresponding AssemblySymbols. Lookup a top level type referenced from metadata, names should be compared case-sensitively. Full type name, possibly with generic name mangling. Symbol for the type, or null if the type isn't found. A NoPiaAmbiguousCanonicalTypeSymbol is a special kind of ErrorSymbol that represents a NoPia embedded type symbol that was attempted to be substituted with canonical type, but the canonical type was ambiguous. A NoPiaIllegalGenericInstantiationSymbol is a special kind of ErrorSymbol that represents a generic type instantiation that cannot cross assembly boundaries according to NoPia rules. A NoPiaMissingCanonicalTypeSymbol is a special kind of ErrorSymbol that represents a NoPia embedded type symbol that was attempted to be substituted with canonical type, but the canonical type couldn't be found. Used by symbol implementations (source and metadata) to represent the value that was mapped from, or will be mapped to a [NullableContext] attribute. Uninitialized state No [NullableContext] attribute [NullableContext(0)] [NullableContext(1)] [NullableContext(2)] Initialize the ObsoleteAttributeData by fetching attributes and decoding ObsoleteAttributeData. This can be done for Metadata symbol easily whereas trying to do this for source symbols could result in cycles. Get the ObsoleteAttributeData by fetching attributes and decoding ObsoleteAttributeData. This can be done for Metadata symbol easily whereas trying to do this for source symbols could result in cycles. This method checks to see if the given symbol is Obsolete or if any symbol in the parent hierarchy is Obsolete. True if some symbol in the parent hierarchy is known to be Obsolete. Unknown if any symbol's Obsoleteness is Unknown. False, if we are certain that no symbol in the parent hierarchy is Obsolete. Create a diagnostic for the given symbol. This could be an error or a warning based on the ObsoleteAttribute's arguments. Encapsulates the MakeOverriddenOrHiddenMembers functionality for methods, properties (including indexers), and events. Walk up the type hierarchy from ContainingType and list members that this member either overrides (accessible members with the same signature, if this member is declared "override") or hides (accessible members with the same name but different kinds, plus members that would be in the overrides list if this member were not declared "override"). Members in the overridden list may be non-virtual or may have different accessibilities, types, accessors, etc. They are really candidates to be overridden. Members in the hidden list are definitely hidden. Members in the runtime overridden list are indistinguishable from the members in the overridden list from the point of view of the runtime (see FindOtherOverriddenMethodsInContainingType for details). In the presence of non-C# types, the meaning of "same signature" is rather complicated. If this member isn't from source, then it refers to the runtime's notion of signature (i.e. including return type, custom modifiers, etc). If this member is from source, then the process is (conceptually) as follows. 1) Walk up the type hierarchy, recording all matching members with the same signature, ignoring custom modifiers and return type. Stop if a hidden member is encountered. 2) Apply the following "tie-breaker" rules until you have at most one member, a) Prefer members in more derived types. b) Prefer an exact custom modifier match (i.e. none, for a source member). c) Prefer fewer custom modifiers (values/positions don't matter, just count). d) Prefer earlier in GetMembers order (within the same type). 3) If a member remains, search its containing type for other members that have the same C# signature (overridden members) or runtime signature (runtime overridden members). In metadata, properties participate in overriding only through their accessors. That is, property/event accessors may implicitly or explicitly override other methods and a property/event can be considered to override another property/event if its accessors override those of the other property/event. This implementation (like Dev10) will not follow that approach. Instead, it is based on spec section 10.7.5, which treats properties as entities in their own right. If all property/event accessors have conventional names in metadata and nothing "unusual" is done with explicit overriding, this approach should produce the same results as an implementation based on accessor overriding. Compute a candidate overridden method when a method knows what method it is intended to override. This makes a particular difference when covariant returns are used, in which case the signature matching rules would not compute the correct overridden method. In the CLI, accessors are just regular methods and their overriding/hiding rules are the same as for regular methods. In C#, however, accessors are intimately connected with their corresponding properties. Rather than walking up the type hierarchy from the containing type of this accessor, looking for members with the same name, MakePropertyAccessorOverriddenOrHiddenMembers delegates to the associated property. For an accessor to hide a member, the hidden member must be a corresponding accessor on a property hidden by the associated property. For an accessor to override a member, the overridden member must be a corresponding accessor on a property (directly or indirectly) overridden by the associated property. Example 1: public class A { public virtual int P { get; set; } } public class B : A { public override int P { get { return 1; } } } //get only public class C : B { public override int P { set { } } } // set only C.P.set overrides A.P.set because C.P.set is the setter of C.P, which overrides B.P, which overrides A.P, which has A.P.set as a setter. Example 2: public class A { public virtual int P { get; set; } } public class B : A { public new virtual int P { get { return 1; } } } //get only public class C : B { public override int P { set { } } } // set only C.P.set does not override any method because C.P overrides B.P, which has no setter and does not override a property. This accessor. The property associated with this accessor. Members overridden or hidden by this accessor. This method is intended to return values consistent with the definition of C#, which may differ from the actual meaning at runtime. Note: we don't need a different path for interfaces - Property.OverriddenOrHiddenMembers handles that. In the CLI, accessors are just regular methods and their overriding/hiding rules are the same as for regular methods. In C#, however, accessors are intimately connected with their corresponding events. Rather than walking up the type hierarchy from the containing type of this accessor, looking for members with the same name, MakeEventAccessorOverriddenOrHiddenMembers delegates to the associated event. For an accessor to hide a member, the hidden member must be a corresponding accessor on a event hidden by the associated event. For an accessor to override a member, the overridden member must be a corresponding accessor on a event (directly or indirectly) overridden by the associated event. This accessor. The event associated with this accessor. Members overridden or hidden by this accessor. This method is intended to return values consistent with the definition of C#, which may differ from the actual meaning at runtime. Note: we don't need a different path for interfaces - Event.OverriddenOrHiddenMembers handles that. CONSIDER: It is an error for an event to have only one accessor. Currently, we mimic the behavior for properties, for consistency, but an alternative approach would be to say that nothing is overridden. CONSIDER: is there a way to share code with MakePropertyAccessorOverriddenOrHiddenMembers? There are two key reasons why interface overriding/hiding is different from class overriding/hiding: 1) interface members never override other members; and 2) interfaces can extend multiple interfaces. The first difference doesn't require any special handling - as long as the members have IsOverride=false, the code for class overriding/hiding does the right thing. The second difference is more problematic. For one thing, an interface member can hide a different member in each base interface. We only report the first one, but we need to expose all of them in the API. More importantly, multiple inheritance raises the possibility of diamond inheritance. Spec section 13.2.5, Interface member access, says: "The intuitive rule for hiding in multiple-inheritance interfaces is simply this: If a member is hidden in any access path, it is hidden in all access paths." For example, consider the following interfaces: interface I0 { void M(); } interface I1 : I0 { void M(); } interface I2 : I0, I1 { void M(); } I2.M does not hide I0.M, because it is already hidden by I1.M. To make this work, we need to traverse the graph of ancestor interfaces in topological order and flag ones later in the enumeration that are hidden along some path. See SymbolPreparer::checkIfaceHiding. Look for overridden or hidden members in a specific type. Member that is hiding or overriding. True if member is from the current compilation. The type that contains member (member.ContainingType). The known overridden member (e.g. in the presence of a metadata methodimpl). The type to search. A member with the same signature if currTypeHasExactMatch is true, a member with (a minimal number of) different custom modifiers if there is one, and null otherwise. True if there's a member with the same name and kind that is not a match. Hidden members (same name, different kind) will be added to this builder. There is some similarity between this member and TypeSymbol.FindPotentialImplicitImplementationMemberDeclaredInType. When making changes to this member, think about whether or not they should also be applied in TypeSymbol. In incorrect or imported code, it is possible that both currTypeBestMatch and hiddenBuilder will be populated. If representative member is non-null and is contained in a constructed type, then find other members in the same type with the same signature. If this is an override member, add them to the overridden and runtime overridden lists. Otherwise, add them to the hidden list. Some kinds of methods are not considered to be hideable by certain kinds of members. Specifically, methods, properties, and types cannot hide constructors, destructors, operators, conversions, or accessors. Having found the best member to override, we want to find members with the same signature on the best member's containing type. The member that we consider to be overridden (may have different custom modifiers from the overriding member). Assumed to already be in the overridden and runtime overridden lists. If the best match was based on the custom modifier count, rather than the custom modifiers themselves (because the overriding member is in the current compilation), then we should use the count when determining whether the override is ambiguous. If the declaring type is constructed, it's possible that two (or more) members have the same signature (including custom modifiers). Return a list of such members so that we can report the ambiguity. Having found that we are hiding a method with exactly the same signature (including custom modifiers), we want to find methods with the same signature on the declaring type because they will also be hidden. (If the declaring type is constructed, it's possible that two or more methods have the same signature (including custom modifiers).) (If the representative member is an indexer, it's possible that two or more properties have the same signature (including custom modifiers, even in a non-generic type). This kind of the hiding member. The member that we consider to be hidden (must have exactly the same custom modifiers as the hiding member). Assumed to already be in hiddenBuilder. Will have all other members with the same signature (including custom modifiers) as representativeMember added. Determine if this method requires a methodimpl table entry to inform the runtime of the override relationship. True if we should produce an ambiguity warning per https://github.com/dotnet/roslyn/issues/45453 . Given a method, find the first method that it overrides from the perspective of the CLI. Key differences from C#: non-virtual methods are ignored, the RuntimeSignatureComparer is used (i.e. consider return types, ignore ref/out distinction). Sets to true if more than one method is overridden by CLI rules. WARN: Must not check method.MethodKind - PEMethodSymbol.ComputeMethodKind uses this method. NOTE: Does not check whether the given method will be marked "newslot" in metadata (as "newslot" is used for covariant method overrides). Note that the access check is done using the original definitions. This is because we want to avoid reductions in accessibility that result from type argument substitution (e.g. if an inaccessible type has been passed as a type argument). See DevDiv #11967 for an example. Groups the information computed by MakeOverriddenOrHiddenMembers. It is not suitable to call this method on a object associated with a member within substituted type, should be used instead. Used for lightweight binding of type constraints. Instead of binding type arguments, we'll just use these placeholders instead. That's good enough binding to compute with minimal binding. Helper methods that exist to share code between properties and events. If the property has a GetMethod, return that. Otherwise check the overridden property, if any. Repeat for each overridden property. If the property has a SetMethod, return that. Otherwise check the overridden property, if any. Repeat for each overridden property. Returns fields that represent tuple elements for types that are tuples. If this type is not a tuple, then returns default. If this is a tuple type with element names, returns the symbol for the tuple type without names. Otherwise, returns null. A RangeVariableSymbol represents an identifier introduced in a query expression as the identifier of a "from" clause, an "into" query continuation, a "let" clause, or a "join" clause. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. An extension method with the "this" parameter removed. Used for the public binding API only, not for compilation. Return the extension method in reduced form if the extension method is applicable, and satisfies type parameter constraints, based on the "this" argument type. Otherwise, returns null. Compilation used to check constraints. The latest language version is assumed if this is null. If the extension method is applicable based on the "this" argument type, return the method constructed with the inferred type arguments. If the method is not an unconstructed generic method, type inference is skipped. If the method is not applicable, or if constraints when inferring type parameters from the "this" type are not satisfied, the return value is null. Compilation used to check constraints. The latest language version is assumed if this is null. A representation of a method symbol that is intended only to be used for comparison purposes (esp in MethodSignatureComparer). Intended to be used to create ParameterSymbols for a SignatureOnlyMethodSymbol. A representation of a property symbol that is intended only to be used for comparison purposes (esp in PropertySignatureComparer). Generate a list containing the given field and all dependencies of that field that require evaluation. The list is ordered by dependencies, with fields with no dependencies first. Cycles are broken at the first field lexically in the cycle. If multiple threads call this method with the same field, the order of the fields returned should be the same, although some fields may be missing from the lists in some threads as other threads evaluate fields. The set of fields on which the field depends. The set of fields that depend on the field. Build a dependency graph (a map from field to dependencies). Type parameters in documentation comments are complicated since they sort of act as declarations, rather than references. Consider the following example: See . class B { void M(T t) { } } ]]> We make some key observations: 1) The type parameter name in the cref is not tied to the type parameter name in the type declaration. 2) A relationship exists between the two occurrences of "U" in the cref: they both refer to (or define) the same symbol. In Roslyn, we've decided on the following representation: within the (entire) scope of a cref, the names of all type parameters "declared" in the cref are in scope and bind to the corresponding type parameters. This representation has one major advantage: as long as the appropriate binder (i.e. the one that knows about the implicitly-declared type parameters) is used, TypeSyntaxes within the cref can be bound by calling BindType. In addition to eliminating the necessity for custom binding code in the batch case, this reduces the problem of exposing such nodes in the SemanticModel to one of ensuring that the right enclosing binder is chosen. That is, new code will have to be written to handle CrefSyntaxes, but the existing code for TypeSyntaxes should just work! In the example above, this means that, between the cref quotation marks, the name "U" binds to an implicitly declared type parameter, whether it is in "B{U}", "M{U}", or "M{List{U[]}}". Of course, it's not all gravy. One thing we're giving up by using this representation is the ability to distinguish between "declared" type parameters with the same name. Consider the following example: See . class A { void M(T t) { } void M(U u) { } } ]]> The native compiler interprets this in the same way as it would interpret A{T1, T2}.M(T2) and unambiguously (i.e. without a warning) binds to A{T, U}.M(U). Since Roslyn does not distinguish between the T's, Roslyn reports an ambiguity warning and picks the first method. Furthermore, renaming one 'T' will rename all of them. This class represents such an implicitly declared type parameter. The declaring syntax is expected to be an IdentifierNameSyntax in the type argument list of a QualifiedNameSyntax. Out params are updated by assignment. If you require thread-safety, pass temps and then CompareExchange them back into shared memory. Type that already has custom modifiers. Same as , but without custom modifiers. May differ in object/dynamic, tuple element names, or other differences ignored by the runtime. The assembly containing the signature referring to the destination type. with custom modifiers copied from . Given a member, look for other members contained in the same type with signatures that will not be distinguishable by the runtime. Gets the syntax list of custom attributes applied on the symbol. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. NOTE: This method should always be kept as a sealed override. If you want to override attribute binding logic for a sub-class, then override method. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns an empty bag if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Verify the constant value matches the default value from any earlier attribute (DateTimeConstantAttribute or DecimalConstantAttribute). If not, report ERR_FieldHasMultipleDistinctConstantValues. Represents expression and deconstruction variables declared in a global statement. The type syntax, if any, from source. Optional for patterns that can omit an explicit type. Can add some diagnostics into . Returns the type that it actually locks onto (it's possible that it had already locked onto ErrorType). Can add some diagnostics into . Returns the type that it actually locks onto (it's possible that it had already locked onto ErrorType). Implemented by symbols that can be targeted by an attribute declaration (i.e. source symbols). Returns the owner of attributes that apply to this symbol. Attributes for this symbol might be retrieved from attribute list of another (owning) symbol. In that case this property returns that owning symbol, otherwise it returns "this". Returns a bit set of attribute locations applicable to this symbol. Attribute location corresponding to this symbol. Location of an attribute if an explicit location is not specified via attribute target specification syntax. Represents implicit, script and submission classes. Returns null for a submission class. This ensures that a submission class does not inherit methods such as ToString or GetHashCode. Indexed type parameters are used in place of type parameters for method signatures. There is a unique mapping from index to a single IndexedTypeParameterSymbol. They don't have a containing symbol or locations. They do not have constraints, variance, or attributes. Create a vector of n dummy type parameters. Always reuses the same type parameter symbol for the same position. This symbol is used as the return type of a LambdaSymbol when we are interpreting lambda's body in order to infer its return type. This symbol is used as the return type of a LambdaSymbol when we failed to infer its return type. GetFirstLocation() on lambda symbols covers the entire syntax, which is inconvenient but remains for compatibility. For better diagnostics quality, use the DiagnosticLocation instead, which points to the "delegate" or the "=>". Binder that owns the scope for the local function symbol, namely the scope where the local function is declared. The QuickAttributeChecker applies a simple fast heuristic for determining probable attributes of certain kinds without binding attribute types, just by looking at the final syntax of an attribute usage. It works by maintaining a dictionary of all possible simple names that might map to the given attribute. Returns the that corresponds to the particular type passed in. If is then the name will be checked both as-is as well as with the 'Attribute' suffix. Represents a source parameter cloned from another , when they must share attribute data and default constant value. For example, parameters on a property symbol are cloned to generate parameters on accessors. Similarly parameters on delegate invoke method are cloned to delegate begin/end invoke methods. A source parameter, potentially with a default value, attributes, etc. Returns the bound default value syntax from the parameter, if it exists. Note that this method will only return a non-null value if the default value was supplied in syntax. If the value is supplied through the DefaultParameterValue attribute, then ExplicitDefaultValue will be non-null but this method will return null. However, if ExplicitDefaultValue is null, this method should always return null. Symbol to copy bound attributes from, or null if the attributes are not shared among multiple source parameter symbols. This is inconsistent with analogous 'BoundAttributesSource' on other symbols. Usually the definition part is the source, but for parameters the implementation part is the source. This affects the location of diagnostics among other things. Gets the syntax list of custom attributes that declares attributes for this parameter symbol. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from special early bound well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Binds attributes applied to this parameter. Verify the default value matches the default value from any earlier attribute (DefaultParameterValueAttribute, DateTimeConstantAttribute or DecimalConstantAttribute). If not, report ERR_ParamDefaultValueDiffersFromAttribute. Is the attribute syntax appearing on a parameter of a partial method implementation part? Since attributes are merged between the parts of a partial, we need to look at the syntax where the attribute appeared in the source to see if it corresponds to a partial method implementation part. True if the parameter has default argument syntax. True if the parameter is marked by . This class represents an event accessor declared in source (i.e. not one synthesized for a field-like event). The accessors are associated with . This class represents an event declared in source with explicit accessors (i.e. not a field-like event). Represents a constant field of an enum. Base class for event accessors - synthesized and user defined. A delegate field associated with a . SourceFieldSymbol takes care of the initializer (plus "var" in the interactive case). This class represents an event declared in source. It may be either field-like (see ) or property-like (see ). Gets the syntax list of custom attributes applied on the event symbol. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. NOTE: This method should always be kept as a sealed override. If you want to override attribute binding logic for a sub-class, then override method. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from special early bound well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. This class represents an event declared in source without explicit accessors. It implicitly has thread safe accessors and an associated field (of the same name), unless it does not have an initializer and is either extern or inside an interface, in which case it only has accessors. Backing field for field-like event. Will be null if the event has no initializer and is either extern or inside an interface. Return the constant value dependencies. Compute the dependencies if necessary by evaluating the constant value but only persist the constant value if there were no dependencies. (If there are dependencies, the constant value will be re-evaluated after evaluating dependencies.) Switch case labels have a constant expression associated with them. If the label is a switch case label, returns the associated constant value with case expression, otherwise returns null. Represents a local variable in a method body. Might not be a method symbol. Binder that owns the scope for the local, the one that returns it in its array. Binder that should be used to bind type syntax for the local. Make a local variable symbol for an element of a deconstruction, which can be inferred (if necessary) by binding the enclosing statement. Binder that owns the scope for the local, the one that returns it in its array. Enclosing binder for the location where the local is declared. It should be used to bind something at that location. Make a local variable symbol whose type can be inferred (if necessary) by binding and enclosing construct. Make a local variable symbol which can be inferred (if necessary) by binding its initializing expression. Binder that owns the scope for the local, the one that returns it in its array. Binder that should be used to bind initializer, if different from the . Gets the name of the local variable. Gets the locations where the local symbol was originally defined in source. There should not be local symbols from metadata, and there should be only one local variable declared. TODO: check if there are multiple same name local variables - error symbol or local symbol? Symbol for a local whose type can be inferred by binding its initializer. Store the constant value and the corresponding diagnostics together to avoid having the former set by one thread and the latter set by another. Determine the constant value of this local and the corresponding diagnostics. Set both to constantTuple in a single operation for thread safety. Null for the initial call, non-null if we are in the process of evaluating a constant. If we already have the bound node for the initial value, pass it in to avoid recomputing it. Symbol for a foreach iteration variable that can be inferred by binding the collection element type of the foreach. We initialize the base's ScopeBinder with a ForEachLoopBinder, so it is safe to cast it to that type here. There is no forbidden zone for a foreach loop, because the iteration variable is not in scope in the collection expression. Symbol for a deconstruction local that might require type inference. For instance, local x in var (x, y) = ... or (var x, int y) = .... Represents a named type symbol whose members are declared in source. If this type is file-local, the syntax tree in which the type is declared. Otherwise, null. Compute the "effective accessibility" of the current class for the purpose of warnings about unused fields. Encapsulates information about the non-type members of a (i.e. this) type. 1) For non-initializers, symbols are created and stored in a list. 2) For fields and properties/indexers, the symbols are stored in (1) and their initializers are stored with other initialized fields and properties from the same syntax tree with the same static-ness. Calculates a syntax offset of a syntax position that is contained in a property or field initializer (if it is in fact contained in one). Returns true if the method has a [AsyncMethodBuilder(typeof(B))] attribute. If so it returns type B. Validation of builder type B is left for elsewhere. This method returns B without validation of any kind. For source symbols, there can only be a valid clone method if this is a record, which is a simple syntax check. This will need to change when we generalize cloning, but it's a good heuristic for now. During early attribute decoding, we consider a safe subset of all members that will not cause cyclic dependencies. Get all such members for this symbol. In particular, this method will return nested types and fields (other than auto-property backing fields). During early attribute decoding, we consider a safe subset of all members that will not cause cyclic dependencies. Get all such members for this symbol that have a particular name. In particular, this method will return nested types and fields (other than auto-property backing fields). The purpose of this function is to assert that the symbol is actually among the symbols cached by this type symbol in a way that ensures that any consumer of standard APIs to get to type's members is going to get the same symbol (same instance) for the member rather than an equivalent, but different instance. Links together the definition and implementation parts of a partial method. Returns a member list which has the implementation part removed. Links together the definition and implementation parts of a partial property. Returns a member list which has the implementation part removed. Report an error if a member (other than a method) exists with the same name as the property accessor, or if a method exists with the same name and signature. Report an error if a member (other than a method) exists with the same name as the event accessor, or if a method exists with the same name and signature. Return the location of the accessor, or if no accessor, the location of the property. Return the location of the accessor, or if no accessor, the location of the event. Return true if the method parameters match the parameters of the property accessor, including the value parameter for the setter. Return true if the method parameters match the parameters of the event accessor, including the value parameter. Returns true if the overall nullable context is enabled for constructors and initializers. Consider static constructor and fields rather than instance constructors and fields. In some circumstances (e.g. implicit implementation of an interface method by a non-virtual method in a base type from another assembly) it is necessary for the compiler to generate explicit implementations for some interface methods. They don't go in the symbol table, but if we are emitting, then we should generate code for them. It's not interesting to report diagnostics on implementation of interface accessors if the corresponding events or properties are not implemented (i.e. we want to suppress cascading diagnostics). Caveat: Indexed property accessors are always interesting. Caveat: It's also uninteresting if a WinRT event is implemented by a non-WinRT event, or vice versa. Return true if is valid for the return type of an override method when the overridden method's return type is . if a diagnostic was added. Otherwise, . Returns true if the method signature must match, with respect to scoped for ref safety, in overrides, interface implementations, or delegate conversions. Returns true if a scoped mismatch should be reported as an error rather than a warning. Returns true if a diagnostic was added. If necessary, report a diagnostic for a hidden abstract member. True if a diagnostic was reported. It is invalid for a type to directly (vs through a base class) implement two interfaces that unify (i.e. are the same for some substitution of type parameters). CONSIDER: check this while building up InterfacesAndTheirBaseInterfaces (only in the SourceNamedTypeSymbol case). Though there is a method that C# considers to be an implementation of the interface method, that method may not be considered an implementation by the CLR. In particular, implicit implementation methods that are non-virtual or that have different (usually fewer) custom modifiers than the interface method, will not be considered CLR overrides. To address this problem, we either make them virtual (in metadata, not in C#), or we introduce an explicit interface implementation that delegates to the implicit implementation. Returned from FindImplementationForInterfaceMemberWithDiagnostics. The interface method or property that is being implemented. A synthesized forwarding method for the implementation, or information about MethodImpl entry that should be emitted, or default if neither needed. The CLR will only look for an implementation of an interface method in a type that 1) declares that it implements that interface; or 2) is a base class of a type that declares that it implements the interface but not a subtype of a class that declares that it implements the interface. For example, interface I class A class B : A, I class C : B class D : C, I Suppose the runtime is looking for D's implementation of a member of I. It will look in D because of (1), will not look in C, will look in B because of (1), and will look in A because of (2). The key point is that it does not look in C, which C# *does*. If C# picks a different implementation than the CLR (see IsPossibleImplementationUnderClrRules), then we might still be okay, but dynamic dispatch might result in C#'s choice getting called anyway. This is based on SymbolPreparer::IsCLRMethodImplSame in the native compiler. ACASEY: What the native compiler actually does is compute the C# answer, compute the CLR answer, and then confirm that they override the same method. What I've done here is check for the situations where the answers could disagree. I believe the results will be equivalent. If in doubt, a more conservative check would be implementingMethod.ContainingType.InterfacesAndTheirBaseInterfaces.Contains(@interface). Implementers should assume that a lock has been taken on MethodChecksLockObject. In particular, it should not (generally) be necessary to use CompareExchange to protect assignments to fields. We can usually lock on the syntax reference of this method, but it turns out that some synthesized methods (e.g. field-like event accessors) also need to do method checks. This property allows such methods to supply their own lock objects, so that we don't have to add a new field to every SourceMethodSymbol. Overridden by , which might return locations of partial methods. Checks to see if a body is legal given the current modifiers. If it is not, a diagnostic is added with the current type. Returns true if the method body is an expression, as expressed by the syntax. False otherwise. If the method has both block body and an expression body present, this is not treated as expression-bodied. Base class to represent all source method-like symbols. This includes things like ordinary methods and constructors, and functions like lambdas and local functions. If there are no constraints, returns an empty immutable array. Otherwise, returns an immutable array of types, indexed by the constrained type parameter in . If there are no constraints, returns an empty immutable array. Otherwise, returns an immutable array of kinds, indexed by the constrained type parameter in . A source method that can have attributes, including a member method, accessor, or local function. Gets the syntax node used for the in-method binder. Symbol to copy bound attributes from, or null if the attributes are not shared among multiple source method symbols. Used for example for event accessors. The "remove" method delegates attribute binding to the "add" method. The bound attribute data are then applied to both accessors. Gets the syntax list of custom attributes that declares attributes for this method symbol. Gets the syntax list of custom attributes that declares attributes for return type of this method. Returns data decoded from special early bound well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns information retrieved from custom attributes on return type in source, or null if the symbol is not source symbol or there are none. Forces binding and decoding of attributes. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Returns a bag of custom attributes applied on the method return value and data decoded from well-known attributes. Returns null if there are no attributes. Forces binding and decoding of attributes. Called when this thread loaded the method's attributes. For method symbols with completion state. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. Gets the attributes applied on the return value of this method symbol. Returns an empty array if there are no attributes. Binds attributes applied to this method. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. Represents the primary module of an assembly being built by compiler. Owning assembly. The declarations corresponding to the source files of this module. The name (contains extension) This override is essential - it's a base case of the recursive definition. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. NOTE: This method should always be kept as a sealed override. If you want to override attribute binding logic for a sub-class, then override method. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from attribute or null if there is no attribute. This property returns if attribute arguments haven't been decoded yet. Returns the constraint types for the given type parameter. Returns the constraint kind for the given type parameter. Note, only nullability aspects are merged if possible, other mismatches are treated as failures. Note, only nullability aspects are merged if possible, other mismatches are treated as failures. Gets all the attribute lists for this named type. If is provided the attribute lists will only be returned if there is reasonable belief that the type has one of the attributes specified by on it. This can avoid going back to syntax if we know the type definitely doesn't have an attribute on it that could be the one specified by . Pass to get all attribute declarations. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from special early bound well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. These won't be returned by GetAttributes on source methods, but they will be returned by GetAttributes on metadata symbols. Gets the BaseType of this type. If the base type could not be determined, then an instance of ErrorType is returned. If this kind of type does not have a base type (for example, interfaces), null is returned. Also the special class System.Object always has a BaseType of null. Gets the set of interfaces that this type directly implements. This set does not include interfaces that are base interfaces of directly implemented interfaces. Returns true if the type cannot be used as an explicit base class. For enum types, gets the underlying type. Returns null on all other kinds of types. For enum types, returns the synthesized instance field used for generating metadata. Returns null for non-enum types. Completion state that tracks whether validation was done/not done/currently in process. Completion state that tracks whether validation was done/not done/currently in process. Should only be read using . Register COR types declared in this namespace, if any, in the COR types cache. If this is a partial implementation part returns the definition part and vice versa. Returns true if this symbol represents a partial method definition (the part that specifies a signature but no body). Returns true if this symbol represents a partial method implementation (the part that specifies both signature and body). True if this is a partial method that doesn't have an implementation part. Report differences between the defining and implementing parts of a partial method. Diagnostics are reported on the implementing part, matching Dev10 behavior. This method is analogous to . Whenever new checks are added to this method, the other method should also have those checks added, if applicable. Specialized subclass of SourceOrdinaryMethodSymbol for less common cases. Specifically, we only use this for methods that are: Generic. An explicit interface implementation. Partial. If this symbol represents a partial method definition or implementation part, its other part (if any). This should be set, if at all, before this symbol appears among the members of its owner. The implementation part is not listed among the "members" of the enclosing type. Unlike , this type doesn't depend on any specific kind of syntax node associated with it. Any syntax node is good enough for it. Base class for parameters can be referred to from source code. These parameters can potentially be targeted by an attribute specified in source code. As an optimization we distinguish simple parameters (no attributes, no modifiers, etc.) and complex parameters. True if the parameter is marked by . True if the parameter has default argument syntax. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. The declaration diagnostics for a parameter depend on the containing symbol. For instance, if the containing symbol is a method the declaration diagnostics go on the compilation, but if it is a local function it is part of the local function's declaration diagnostics. The declared scope. From source, this is from the scope keyword only. Reflects presence of `params` modifier in source Base class for all parameters that are emitted. Return Accessibility declared locally on the accessor, or NotApplicable if no accessibility was declared explicitly. Indicates whether this accessor itself has a 'readonly' modifier. Indicates whether this accessor is readonly due to reasons scoped to itself and its containing property. If we are outputting a .winmdobj then the setter name is put_, not set_. The declaring syntax for the accessor, or property if there is no accessor-specific syntax. This method is analogous to . Whenever new checks are added to this method, the other method should also have those checks added, if applicable. Condensed flags storing useful information about the so that we do not have to go back to source to compute this data. To facilitate lookup, all indexer symbols have the same name. Check the MetadataName property to find the name that will be emitted (based on IndexerNameAttribute, or the default "Item"). Even though it is declared with an IndexerDeclarationSyntax, an explicit interface implementation is not an indexer because it will not cause the containing type to be emitted with a DefaultMemberAttribute (and even if there is another indexer, the name of the explicit implementation won't match). This is important for round-tripping. The method is called at the end of constructor. The implementation may depend only on information available from the type. The method is called at the end of constructor. The implementation may depend only on information available from the type. True if the property has a synthesized backing field, and either no accessor or the accessor is auto-implemented. Backing field for an automatically implemented property, or a property with an accessor using the 'field' keyword, or a property with an initializer. Return true if the accessor accessibility is more restrictive than the property accessibility, otherwise false. If this property is sealed, then we have to emit both accessors - regardless of whether they are present in the source - so that they can be marked final. (i.e. sealed). Only non-null for sealed properties without both accessors. Symbol to copy bound attributes from, or null if the attributes are not shared among multiple source property symbols. Analogous to . Returns a bag of custom attributes applied on the property and data decoded from well-known attributes. Returns null if there are no attributes. Forces binding and decoding of attributes. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. NOTE: This method should always be kept as a sealed override. If you want to override attribute binding logic for a sub-class, then override method. Returns data decoded from well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from special early bound well-known attributes applied to the symbol or null if there are no applied attributes. Forces binding and decoding of attributes. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. A source parameter that has no default value, no attributes, and is not params. Base class for type and method type parameters. Gets the attributes applied on this symbol. Returns an empty array if there are no attributes. NOTE: This method should always be kept as a sealed override. If you want to override attribute binding logic for a sub-class, then override method. Returns a bag of applied custom attributes and data decoded from well-known attributes. Returns null if there are no attributes applied on the symbol. Forces binding and decoding of attributes. Check constraints of generic types referenced in constraint types. For instance, with "interface I<T> where T : I<T> {}", check T satisfies constraints on I<T>. Those constraints are not checked when binding ConstraintTypes since ConstraintTypes has not been set on I<T> at that point. A map shared by all type parameters for an overriding method or a method that explicitly implements an interface. The map caches the overridden method and a type map from overridden type parameters to overriding type parameters. A type parameter for a method that either overrides a base type method or explicitly implements an interface method. Exists to copy constraints from the corresponding type parameter of an overridden method. The type parameter to use for determining constraints. If there is a base method that the owner method is overriding, the corresponding type parameter on that method is used. Otherwise, the result is null. Class to represent a synthesized attribute A context for binding type parameter symbols of named types. Type parameter has no type constraints, including `struct`, `class`, `unmanaged` and is declared in a context where nullable annotations are disabled. Cannot be combined with , or . Note, presence of this flag suppresses generation of Nullable attribute on the corresponding type parameter. This imitates the shape of metadata produced by pre-nullable compilers. Metadata import is adjusted accordingly to distinguish between the two situations. mismatch is detected during merging process for partial type declarations. All bits involved into describing various aspects of 'class' constraint. Any of these bits is equivalent to presence of 'struct' constraint. All bits except those that are involved into describing various nullability aspects. A simple representation of a type parameter constraint clause as a set of constraint bits and a set of constraint types. Wrapper around type-parameter/constraints/constraint-kind info. We wrap this information (instead of inlining directly within type/method symbols) as most types/methods are not generic. As such, all those non-generic types can point at the singleton sentinel value, and avoid two pointers of overhead. A collection of type parameter constraint types, populated when constraint types for the first type parameter are requested. A collection of type parameter constraint kinds, populated when constraint kinds for the first type parameter are requested. Either a SubstitutedNestedTypeSymbol or a ConstructedNamedTypeSymbol, which share in common that they have type parameters substituted. This field keeps track of the s for which we already retrieved diagnostics. We shouldn't return from ForceComplete (i.e. indicate that diagnostics are available) until this is equal to , except that when completing with a given position, we might not complete .Member*. Since completeParts is used as a flag indicating completion of other assignments it must be volatile to ensure the read is not reordered/optimized to happen before the writes. Used to force (source) symbols to a given state of completion when the only potential remaining part is attributes. This does force the invariant on the caller that the implementation of of will set the part on the thread that actually completes the loading of attributes. Failure to do so will potentially result in a deadlock. The owning source symbol. Produce the next (i.e. lowest) CompletionPart (bit) that is not set. Since this formula is rather opaque, a demonstration of its correctness is provided in Roslyn.Compilers.CSharp.UnitTests.CompletionTests.TestHasAtMostOneBitSet. A comparer that treats dynamic and object as "the same" types, and also ignores tuple element names differences. Synthesized namespace that contains synthesized types or subnamespaces. All its members are stored in a table on . A simple method type parameter with no constraints. Parses generated local function name out of a generated method name. This method will work with either unmangled or mangled type names as input, but it does not remove any arity suffix if present. Produces name of the synthesized delegate symbol that encodes the parameter byref-ness and return type of the delegate. The arity is appended via `N suffix in MetadataName calculation since the delegate is generic. Logic here should match . Parses the name of a synthesized delegate out into the things it represents. Logic here should match . The type is generated with a `T` field; used when collection expression has a single element. sealed class <>z__ReadOnlySingleElementList<T> { private readonly T _item; } The type is generated with an array field; used when collection expression has a known length. sealed class <>z__ReadOnlyArray<T> { private readonly T[] _items; } The type is generated with a List<T> field; used when collection expression has an unknown length. sealed class <>z__ReadOnlyList<T> { private readonly List<T> _items; } A synthesized type used for collection expressions where the target type is IEnumerable<T>, IReadOnlyCollection<T>, or IReadOnlyList<T>. If the collection expression has a known length, the type is generated with either an array field or a T field when the collection contains only one element: [e0]; otherwise the type is generated with a List<T> field. sealed class <>z__ReadOnlySingleElementList<T> { private readonly T _item; } sealed class <>z__ReadOnlyArray<T> { private readonly T[] _items; } sealed class <>z__ReadOnlyList<T> { private readonly List<T> _items; } Represents a compiler generated backing field for a primary constructor parameter. If the record type is derived from a base record type Base, the record type includes a synthesized override of the strongly-typed Equals(Base other). The synthesized override is sealed. It is an error if the override is declared explicitly. The synthesized override returns Equals((object?)other). If a virtual "clone" method is present in the base record, the synthesized "clone" method overrides it and the return type of the method is the current containing type if the "covariant returns" feature is supported and the override return type otherwise. An error is produced if the base record clone method is sealed. If a virtual "clone" method is not present in the base record, the return type of the clone method is the containing type and the method is virtual, unless the record is sealed or abstract. If the containing record is abstract, the synthesized clone method is also abstract. If the "clone" method is not abstract, it returns the result of a call to a copy constructor. The record type includes synthesized '==' and '!=' operators equivalent to operators declared as follows: For record class: public static bool operator==(R? left, R? right) => (object) left == right || ((object)left != null && left.Equals(right)); public static bool operator !=(R? left, R? right) => !(left == right); For record struct: public static bool operator==(R left, R right) => left.Equals(right); public static bool operator !=(R left, R right) => !(left == right); The 'Equals' method called by the '==' operator is the 'Equals(R? other)' (). The '!=' operator delegates to the '==' operator. It is an error if the operators are declared explicitly. The record type includes synthesized '==' and '!=' operators equivalent to operators declared as follows: For record class: public static bool operator==(R? left, R? right) => (object) left == right || ((object)left != null && left.Equals(right)); public static bool operator !=(R? left, R? right) => !(left == right); For record struct: public static bool operator==(R left, R right) => left.Equals(right); public static bool operator !=(R left, R right) => !(left == right); The 'Equals' method called by the '==' operator is the 'Equals(R? other)' (). The '!=' operator delegates to the '==' operator. It is an error if the operators are declared explicitly. Unless explicitly declared, a record includes a synthesized strongly-typed overload of `Equals(R? other)` where `R` is the record type. The method is `public`, and the method is `virtual` unless the record type is `sealed`. The record type includes a synthesized override of object.GetHashCode(). The method can be declared explicitly. It is an error if the explicit declaration is sealed unless the record type is sealed. The record type includes synthesized '==' and '!=' operators equivalent to operators declared as follows: For record class: public static bool operator==(R? left, R? right) => (object) left == right || ((object)left != null && left.Equals(right)); public static bool operator !=(R? left, R? right) => !(left == right); For record struct: public static bool operator==(R left, R right) => left.Equals(right); public static bool operator !=(R left, R right) => !(left == right); The 'Equals' method called by the '==' operator is the 'Equals(R? other)' (). The '!=' operator delegates to the '==' operator. It is an error if the operators are declared explicitly. Common base for ordinary methods overriding methods from object synthesized by compiler for records. Returns true if reported an error The record type includes a synthesized override of object.Equals(object? obj). It is an error if the override is declared explicitly. The synthesized override returns Equals(other as R) where R is the record type. Common base for ordinary methods synthesized by compiler for records. The `bool PrintMembers(StringBuilder)` method is responsible for printing members declared in the containing type that are "printable" (public fields and properties), and delegating to the base to print inherited printable members. Base members get printed first. It returns true if the record contains some printable members. The method is used to implement `ToString()`. The record includes a synthesized override of object.ToString(). For `record R(int I) { public int J; }` it prints `R { I = ..., J = ... }`. The method can be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or if the explicit declaration doesn't allow overriding it in a derived type and the record type is not sealed. It is an error if either synthesized or explicitly declared method doesn't override `object.ToString()` (for example, due to shadowing in intermediate base types, etc.). Represents the compiler generated value parameter for property/event accessor. This parameter has no source location/syntax, but may have attributes. Attributes with 'param' target specifier on the accessor must be applied to the this parameter. Represents a compiler generated backing field for an automatically implemented property or a Primary Constructor parameter. Represents a compiler generated backing field for an automatically implemented property. A container synthesized for a lambda, iterator method, or async method. Represents a compiler generated and embedded attribute type. This type has the following properties: 1) It is non-generic, sealed, internal, non-static class. 2) It derives from System.Attribute 3) It has Microsoft.CodeAnalysis.EmbeddedAttribute 4) It has System.Runtime.CompilerServices.CompilerGeneratedAttribute Represents a compiler generated and embedded attribute type with a single default constructor Represents an interactive code entry point that is inserted into the compilation if there is not an existing one. A synthesized entrypoint that forwards all calls to an async Main Method The syntax for the user-defined asynchronous main method. The user-defined asynchronous main method. Represents __value field of an enum. Event accessor that has been synthesized for a field-like event declared in source, or for an event re-abstraction in an interface. Associated with and . Represents a compiler generated field. Represents a compiler generated field of given type and name. Represents a compiler generated field or captured variable. Represents a compiler generated synthesized method symbol that must be emitted in the compiler generated PrivateImplementationDetails class A synthesized type used during emit to allow temp locals of Span<T> of a specific length where the span storage is on the stack. [InlineArray(N)] struct <>y__InlineArrayN<T> { private T _element0; } A base class for synthesized methods that want a this parameter. Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute. This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet. A synthesized local variable. Throws an exception of a given type using a parameterless constructor. Represents a simple compiler generated parameter of a given type. For each parameter of a source method, construct a corresponding synthesized parameter for a destination method. Has parameters. Needs parameters. Synthesized parameters to add to destination method. The corresponding . A type parameter for a synthesized class or method. Throws a 'System.Runtime.CompilerServices.SwitchExpressionException' with the given 'unmatchedValue'. Compiler should always be synthesizing locals with correct escape semantics. Checking escape scopes is not valid here. Represents a field of a tuple type (such as (int, byte).Item1) that doesn't have a corresponding backing field within the tuple underlying type. Created in response to an error condition. If this field represents a tuple element with index X 2X if this field represents Default-named element 2X + 1 if this field represents Friendly-named element Otherwise, (-1 - [index in members array]); If this is a field representing a tuple element, returns the index of the element (zero-based). Otherwise returns -1 A plain TupleElementFieldSymbol (as opposed to a TupleVirtualElementFieldSymbol) represents an element field of a tuple type (such as (int, byte).Item1) that is backed by a real field with the same name within the tuple underlying type. Note that original tuple fields (like 'System.ValueTuple`2.Item1') do not get wrapped. If this field represents a tuple element with index X 2X if this field represents Default-named element 2X + 1 if this field represents Friendly-named element If this is a field representing a tuple element, returns the index of the element (zero-based). Otherwise returns -1 Represents an element field of a tuple type that is not backed by a real field with the same name within the tuple type. Examples // alias to Item1 with a different name (int a, byte b).a // not backed directly by the type (int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8).i8 // Item8, which is also not backed directly by the type (int, int, int, int, int, int, int, int).Item8 NOTE: For any virtual element, there is a nonvirtual way to access the same underlying field. In scenarios where we need to enumerate actual fields of a struct, virtual fields should be ignored. Utility class for substituting actual type arguments for formal generic type parameters. The effective "bounds" of a type parameter: the constraint types, effective interface set, and effective base type, determined from the declared constraints, with any cycles removed. The fields are exposed by the TypeParameterSymbol as ConstraintTypes, Interfaces, and BaseType. Creates a "late" bound instance with all fields set. The type parameters, classes, and interfaces explicitly declared as constraint types on the containing type parameter, with cycles removed. The set of interfaces explicitly declared on the containing type parameter and any type parameters on which the containing type parameter depends, with duplicates removed. As defined in 10.1.5 of the specification. The "exact" effective base type. In the definition of effective base type we abstract some concrete types to their base classes: * For each constraint of T that is a struct-type, R contains System.ValueType. * For each constraint of T that is an enumeration type, R contains System.Enum. * For each constraint of T that is a delegate type, R contains System.Delegate. * For each constraint of T that is an array type, R contains System.Array. * For each constraint of T that is a class-type C, R contains type C' which is constructed from C by replacing all occurrences of dynamic with object. The reason is that the CLR doesn't support operations on generic parameters that would be needed to work with these types. For example, ldelem instruction requires the receiver to be a specific array, not a type parameter constrained to be an array. When computing the deduced type we don't perform this abstraction. We keep the original constraint T. Deduced base type is used to check that consistency rules are satisfied. A TypeSymbol is a base class for all the symbols that represent a type in C#. key = interface method/property/event compared using , value = explicitly implementing methods/properties/events declared on this type (normally a single value, multiple in case of an error). The original definition of this symbol. If this symbol is constructed from another symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in source or metadata. Gets the BaseType of this type. If the base type could not be determined, then an instance of ErrorType is returned. If this kind of type does not have a base type (for example, interfaces), null is returned. Also the special class System.Object always has a BaseType of null. Gets the set of interfaces that this type directly implements. This set does not include interfaces that are base interfaces of directly implemented interfaces. The list of all interfaces of which this type is a declared subtype, excluding this type itself. This includes all declared base interfaces, all declared base interfaces of base types, and all declared base interfaces of those results (recursively). Each result appears exactly once in the list. This list is topologically sorted by the inheritance relationship: if interface type A extends interface type B, then A precedes B in the list. This is not quite the same as "all interfaces of which this type is a proper subtype" because it does not take into account variance: AllInterfaces for IEnumerable<string> will not include IEnumerable<object> If this is a type parameter returns its effective base class, otherwise returns this type. Returns true if this type derives from a given type. Returns true if this type is equal or derives from a given type. Determines if this type symbol represent the same type as another, according to the language semantics. The other type. What kind of comparison to use? You can ignore custom modifiers, ignore the distinction between object and dynamic, or ignore tuple element names differences. True if the types are equivalent. We ignore custom modifiers, and the distinction between dynamic and object, when computing a type's hash code. Produce all implemented interfaces in topologically sorted order. We use TypeSymbol.Interfaces as the source of edge data, which has had cycles and infinitely long dependency cycles removed. Consequently, it is possible (and we do) use the simplest version of Tarjan's topological sorting algorithm. Gets the set of interfaces that this type directly implements, plus the base interfaces of all such types. Keys are compared using , values are distinct interfaces corresponding to the key, according to rules. CONSIDER: it probably isn't truly necessary to cache this. If space gets tight, consider alternative approaches (recompute every time, cache on the side, only store on some types, etc). Returns the corresponding symbol in this type or a base type that implements interfaceMember (either implicitly or explicitly), or null if no such symbol exists (which might be either because this type doesn't implement the container of interfaceMember, or this type doesn't supply a member that successfully implements interfaceMember). Must be a non-null interface property, method, or event. Returns true if this type is known to be a reference type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false. Returns true if this type is known to be a value type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false. Gets the kind of this type. Gets corresponding special TypeId of this type. Not preserved in types constructed from this one. Gets corresponding primitive type code for this type declaration. Returns true if the error code is highest priority while calculating use site error for this symbol. Is this a symbol for an anonymous type (including delegate). Is this a symbol for a Tuple. True if the type represents a native integer. In C#, the types represented by language keywords 'nint' and 'nuint' on platforms where they are not unified with 'System.IntPtr' and 'System.UIntPtr'. Verify if the given type is a tuple of a given cardinality, or can be used to back a tuple type with the given cardinality. If this symbol represents a tuple type, get the types of the tuple's elements. If this symbol represents a tuple type, get the names of the tuple's elements. If this symbol represents a tuple type, get the fields for the tuple's elements. Otherwise, returns default. Is this type a managed type (false for everything but enum, pointer, and some struct types). See Type::computeManagedType. Indicates whether a type is managed or not (i.e. you can take a pointer to it). Contains additional cases to help implement FeatureNotAvailable diagnostics. Merges features of the type with another type where there is an identity conversion between them. The features to be merged are object vs dynamic (dynamic wins), tuple names (dropped in case of conflict), and nullable annotations (e.g. in type arguments). Returns true if the type may contain embedded references Returns true if the type is a readonly struct Locate implementation of the in context of the current type. The method is using cache to optimize subsequent calls for the same . Member for which an implementation should be found. The process of looking up an implementation for an accessor can involve figuring out how corresponding event/property is implemented, . And the process of looking up an implementation for a property can involve figuring out how corresponding accessors are implemented, . This can lead to cycles, which could be avoided if we ignore the presence of implementations in interfaces for the purpose of . Fortunately, logic in it allows us to ignore the presence of implementations in interfaces and we use that. When the value of this parameter is true and the result that takes presence of implementations in interfaces into account is not available from the cache, the lookup will be performed ignoring the presence of implementations in interfaces. Otherwise, result from the cache is returned. When the value of the parameter is false, the result from the cache is returned, or calculated, taking presence of implementations in interfaces into account and then cached. This means that: - A symbol from an interface can still be returned even when is true. A subsequent call with false will return the same value. - If symbol from a non-interface is returned when is true. A subsequent call with false will return the same value. - If no symbol is returned for true. A subsequent call with might return a symbol, but that symbol guaranteed to be from an interface. - If the first request is done with false. A subsequent call is guaranteed to return the same result regardless of value. Performs interface mapping (spec 13.4.4). CONSIDER: we could probably do less work in the metadata and retargeting cases - we won't use the diagnostics. A non-null implementable member on an interface type. The type implementing the interface property (usually "this"). Bag to which to add diagnostics. Do not consider implementation in an interface as a valid candidate for the purpose of this computation. Returns true when is true, the method fails to locate an implementation and an implementation in an interface, if any (its presence is not checked), could potentially be a candidate. Returns false otherwise. When true is returned, a different call with false might return a symbol. That symbol, if any, is guaranteed to be from an interface. This parameter is used to optimize caching in . The implementing property or null, if there isn't one. One implementation M1 is considered more specific than another implementation M2 if M1 is declared on interface T1, M2 is declared on interface T2, and T1 contains T2 among its direct or indirect interfaces. Since dev11 didn't expose a symbol API, it had the luxury of being able to accept a base class's claim that it implements an interface. Roslyn, on the other hand, needs to be able to point to an implementing symbol for each interface member. DevDiv #718115 was triggered by some unusual metadata in a Microsoft reference assembly (Silverlight System.Windows.dll). The issue was that a type explicitly implemented the accessors of an interface event, but did not tie them together with an event declaration. To make matters worse, it declared its own protected event with the same name as the interface event (presumably to back the explicit implementation). As a result, when Roslyn was asked to find the implementing member for the interface event, it found the protected event and reported an appropriate diagnostic. What it should have done (and does do now) is recognize that no event associated with the accessors explicitly implementing the interface accessors and returned null. We resolved this issue by introducing a new step into the interface mapping algorithm: after failing to find an explicit implementation in a type, but before searching for an implicit implementation in that type, check for an explicit implementation of an associated accessor. If there is such an implementation, then immediately return the associated property or event, even if it is null. That is, never attempt to find an implicit implementation for an interface property or event with an explicitly implemented accessor. If we were looking for an accessor, then look for an accessor on the implementation of the corresponding interface property/event. If it is valid as an implementation (ignoring the name), then prefer it to our current result if: 1) our current result is null; or 2) our current result is on the same type. If there is no corresponding accessor on the implementation of the corresponding interface property/event and we found an accessor, then the accessor we found is invalid, so clear it. These diagnostics are for members that do implicitly implement an interface member, but do so in an undesirable way. Reports warnings for some mismatches in parameter or return type modifiers (nullability, scoped, refness) between implementing and implemented member. These diagnostics are for members that almost, but not actually, implicitly implement an interface member. Determine a better location for diagnostic squiggles. Squiggle the interface rather than the class. Search the declared members of a type for one that could be an implementation of a given interface member (depending on interface declarations). The interface member being implemented. True if the implementing type is from some compilation (i.e. not from metadata). The type on which we are looking for a declared implementation of the interface member. A member on currType that could implement the interface, or null. A member on currType that could have been an attempt to implement the interface, or null. There is some similarity between this member and OverriddenOrHiddenMembersHelpers.FindOverriddenOrHiddenMembersInType. When making changes to this member, think about whether or not they should also be applied in MemberSymbol. One key difference is that custom modifiers are considered when looking up overridden members, but not when looking up implicit implementations. We're preserving this behavior from Dev10. To implement an interface member, a candidate member must be public, non-static, and have the same signature. "Have the same signature" has a looser definition if the type implementing the interface is from source. PROPERTIES: NOTE: we're not checking whether this property has at least the accessors declared in the interface. Dev10 considers it a match either way and, reports failure to implement accessors separately. If the implementing type (i.e. the type with the interface in its interface list) is in source, then we can ignore custom modifiers in/on the property type because they will be copied into the bridge property that explicitly implements the interface property (or they would be, if we created such a bridge property). Bridge *methods* (not properties) are inserted in SourceMemberContainerTypeSymbol.SynthesizeInterfaceMemberImplementation. CONSIDER: The spec for interface mapping (13.4.4) could be interpreted to mean that this property is not an implementation unless it has an accessor for each accessor of the interface property. For now, we prefer to represent that case as having an implemented property and an unimplemented accessor because it makes finding accessor implementations much easier. If we decide that we want the API to report the property as unimplemented, then it might be appropriate to keep current result internally and just check the accessors before returning the value from the public API (similar to the way MethodSymbol.OverriddenMethod filters MethodSymbol.OverriddenOrHiddenMembers. If implementation of an interface method will be accompanied with a MethodImpl entry in metadata, information about which isn't already exposed through API, this method returns the "Body" part of the MethodImpl entry, i.e. the method that implements the . Some of the MethodImpl entries could require synthetic forwarding methods. In such cases, the result is the method that the language considers to implement the , rather than the forwarding method. In other words, it is the method that the forwarding method forwards to. The interface method that is going to be implemented by using synthesized MethodImpl entry. Returns information about interface method implementations that will be accompanied with MethodImpl entries in metadata, information about which isn't already exposed through API. The "Body" is the method that implements the interface method "Implemented". Some of the MethodImpl entries could require synthetic forwarding methods. In such cases, the "Body" is the method that the language considers to implement the interface method, the "Implemented", rather than the forwarding method. In other words, it is the method that the forwarding method forwards to. The set of abstract members in declared in this type or declared in a base type and not overridden. Represents the method by which this type implements a given interface type and/or the corresponding diagnostics. Assuming that nullable annotations are enabled: T => true T where T : struct => false T where T : class => false T where T : class? => true T where T : IComparable => true T where T : IComparable? => true T where T : notnull => true In C#9, annotations are allowed regardless of constraints. Assuming that nullable annotations are enabled: T => true T where T : struct => false T where T : class => false T where T : class? => true T where T : IComparable => false T where T : IComparable? => true Is this System.Nullable`1 type, or its substitution. To check whether a type is System.Nullable`1 or is a type parameter constrained to System.Nullable`1 use instead. Determines if the given type is a valid attribute parameter type. Type to validated compilation Gets the typed constant kind for the given attribute parameter type. Type to validated compilation TypedConstantKind for the attribute parameter type. Returns true if the type is constructed from a generic type named "System.Linq.Expressions.Expression" with one type parameter. Returns true if the type is a non-generic type named "System.Linq.Expressions.Expression" or "System.Linq.Expressions.LambdaExpression". Returns true if the type is constructed from a generic type named "System.Linq.Expressions.Expression" with one type parameter, or if the type is a non-generic type named "System.Linq.Expressions.Expression" or "System.Linq.Expressions.LambdaExpression". return true if the type is constructed from a generic interface that might be implemented by an array. Return the default value constant for the given type, or null if the default value is not a constant. Visit the given type and, in the case of compound types, visit all "sub type" (such as A in A[], or { A<T>, T, U } in A<T>.B<U>) invoking 'predicate' with the type and 'arg' at each sub type. If the predicate returns true for any type, traversal stops and that type is returned from this method. Otherwise if traversal completes without the predicate returning true for any type, this method returns null. Visit the given type and, in the case of compound types, visit all "sub type". One of the predicates will be invoked at each type. If the type is a TypeWithAnnotations, will be invoked; otherwise will be invoked. If the corresponding predicate returns true for any type, traversal stops and that type is returned from this method. Otherwise if traversal completes without the predicate returning true for any type, this method returns null. If true, use instead of to avoid early resolution of nullable types (null TypeParameterSymbol "parameter"): Checks if the given type is a type parameter or its referent type is a type parameter (array/pointer) or contains a type parameter (aggregate type) (non-null TypeParameterSymbol "parameter"): above + also checks if the type parameter is the same as "parameter" Return true if the type contains any dynamic type reference. Return true if the type contains any tuples. Return true if the type contains any tuples with element names. Return true if the type contains any function pointer types. Guess the non-error type that the given type was intended to represent. If the type itself is not an error type, then it will be returned. Otherwise, the underlying type (if any) of the error type will be returned. Any non-null type symbol returned is guaranteed not to be an error type. It is possible to pass in a constructed type and received back an unconstructed type. This can occur when the type passed in was constructed from an error type - the underlying definition will be available, but there won't be a good way to "re-substitute" back up to the level of the specified type. Guess the non-error type kind that the given type was intended to represent, if possible. If not, return TypeKind.Error. Returns true if the type was a valid switch expression type in C# 6. We use this test to determine whether or not we should attempt a user-defined conversion from the type to a C# 6 switch governing type, which we support for compatibility with C# 6 and earlier. Returns true if the type is one of the restricted types, namely: , , or . or a ref-like type. Add this instance to the set of checked types. Returns true if this was added, false if the type was already in the set. These special types are structs that contain fields of the same type (e.g. contains an instance field of type ). Compute a hash code for the constructed type. The return value will be non-zero so callers can used zero to represent an uninitialized value. If we are in a COM PIA with embedInteropTypes enabled we should turn properties and methods that have the type and return type of object, respectively, into type dynamic. If the requisite conditions are fulfilled, this method returns a dynamic type. If not, it returns the original type. A property type or method return type to be checked for dynamification. Containing type. Type variables are never considered reference types by the verifier. Type variables are never considered value types by the verifier. Return all of the type parameters in this type and enclosing types, from outer-most to inner-most type. Return all of the type parameters in this type and enclosing types, from outer-most to inner-most type. Return the nearest type parameter with the given name in this type or any enclosing type. Return the nearest type parameter with the given name in this symbol or any enclosing symbol. Return true if the fully qualified name of the type's containing symbol matches the given name. This method avoids string concatenations in the common case where the type is a top-level type. Returns true if the type is generic or non-generic custom task-like type due to the [AsyncMethodBuilder(typeof(B))] attribute. It returns the "B". For the Task types themselves, this method might return true or false depending on mscorlib. The definition of "custom task-like type" is one that has an [AsyncMethodBuilder(typeof(B))] attribute, no more, no less. Validation of builder type B is left for elsewhere. This method returns B without validation of any kind. Replace Task-like types with Task types. Replace Task-like types with Task types. Returns true if there were changes. Count the custom modifiers within the specified TypeSymbol. Potentially non-zero for arrays, pointers, and generic instantiations. Check for custom modifiers within the specified TypeSymbol. Potentially true for arrays, pointers, and generic instantiations. A much less efficient implementation would be CustomModifierCount() == 0. CONSIDER: Could share a backing method with CustomModifierCount. Return true if this type can unify with the specified type (i.e. is the same for some substitution of type parameters). Used when iterating through base types in contexts in which the caller needs to avoid cycles and can't use BaseType (perhaps because BaseType is in the process of being computed) A struct that combines a single type with annotations The underlying type, unless overridden by _extensions. Additional data or behavior. Such cases should be uncommon to minimize allocations. The nullable annotation, unless overridden by _extensions. True if the fields are unset. Appropriate when detecting if a lazily-initialized variable has been initialized. True if the type is not null. If this is a lazy nullable type pending resolution, forces this to be resolved. Merges top-level and nested nullability, dynamic/object, and tuple names from an otherwise equivalent type. Is this System.Nullable`1 type, or its substitution. To check whether a type is System.Nullable`1 or is a type parameter constrained to System.Nullable`1 use instead. The list of custom modifiers, if any, associated with the . Extract type under assumption that there should be no custom modifiers or annotations. The method asserts otherwise. Is this the given type parameter? Used by callers before calling CSharpCompilation.EnsureNullableAttributeExists(). This method ignores any [NullableContext]. For example, if there is a [NullableContext(1)] at the containing type, and this type reference is oblivious, NeedsNullableAttribute() will return false even though a [Nullable(0)] will be emitted for this type reference. In practice, this shouldn't be an issue though since EnsuresNullableAttributeExists() will have returned true for at least some of other type references that required [Nullable(1)] and were subsequently aggregated to the [NullableContext(1)]. If the type is a non-generic value type or Nullable<>, and is not a type parameter, the nullability is not included in the byte[]. Used by the generated . Used by the generated . Compute the flow state resulting from reading from an lvalue. Additional data or behavior beyond the core TypeWithAnnotations. Extension for a type argument whose nullable annotation after substitution depends on the type constraints on the type parameter. To avoid a cycle, we delay determining the nullable annotation until after the type parameter's type constraints are bound. Nullable type parameter. The underlying TypeSymbol is resolved lazily to avoid cycles when binding declarations. A type and its corresponding flow state resulting from evaluating an rvalue expression. Creates a new for testing purposes, which does not verify that the containing symbol matches the original containing symbol. This class groups together all of the functionality needed to check for error CS1961, ERR_UnexpectedVariance. Its functionality is accessible through the NamedTypeSymbol extension method CheckInterfaceVarianceSafety and the MethodSymbol extension method CheckMethodVarianceSafety (for checking delegate Invoke). Accumulate diagnostics related to the variance safety of an interface. Check for illegal nesting into a variant interface. Accumulate diagnostics related to the variance safety of a delegate. Accumulate diagnostics related to the variance safety of an interface method. Accumulate diagnostics related to the variance safety of an interface property. Accumulate diagnostics related to the variance safety of an interface event. Accumulate diagnostics related to the variance safety of an interface method/property parameter. Accumulate diagnostics related to the variance safety of an interface method type parameters. Returns true if the type is output-unsafe or input-unsafe, as defined in the C# spec. Roughly, a type is output-unsafe if it could not be the return type of a method and input-unsafe if it could not be a parameter type of a method. This method is intended to match spec section 13.1.3.1 as closely as possible (except that the output-unsafe and input-unsafe checks are merged). 3) T is an interface, class, struct, enum, or delegate type ]]> constructed from a generic type ]]> where for at least one A_i one of the following holds: a) X_i is covariant or invariant and A_i is output-unsafe [input-unsafe] b) X_i is contravariant or invariant and A_i is input-unsafe [output-unsafe] (note: spec has "input-safe", but it's a typo) Slight rewrite to make it more idiomatic for C#: a) X_i is covariant and A_i is input-unsafe b) X_i is contravariant and A_i is output-unsafe c) X_i is invariant and A_i is input-unsafe or output-unsafe Add an ERR_UnexpectedVariance diagnostic to the diagnostic bag. Diagnostic bag. Type parameter that is not variance safe. Context in which type is not variance safe (e.g. method). Callback to provide location. Callback argument. Desired variance of type. Represents an event that is based on another event. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. The underlying EventSymbol. Represents a field that is based on another field. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. The underlying FieldSymbol. Represents a method that is based on another method. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. Represents a named type that is based on another named type. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. The underlying NamedTypeSymbol. Represents a parameter that is based on another parameter. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. Represents a property that is based on another property. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. The underlying PropertySymbol. Represents a type parameter that is based on another type parameter. When inheriting from this class, one shouldn't assume that the default behavior it has is appropriate for every case. That behavior should be carefully reviewed and derived type should override behavior as appropriate. The underlying TypeParameterSymbol, cannot be another RetargetingTypeParameterSymbol. Traverses the symbol table checking for CLS compliance. Gets a value indicating whether is allowed to analyze in parallel. Traverses the symbol table checking for CLS compliance. Compilation that owns the symbol table. Will be supplemented with documentation comment diagnostics. To stop traversing the symbol table early. Only report diagnostics from this syntax tree, if non-null. If and is non-null, report diagnostics within this span in the . False if no further checks are required (because they would be cascading). BREAK: Dev11 reports WRN_CLS_ArrayArgumentToAttribute on all symbols, whereas roslyn reports it only on accessible symbols. True if the symbol is okay (i.e. no warnings). NOTE: Dev11 behavior - First, it ignores arity, which seems like a good way to disambiguate symbols (in particular, CLS Rule 43 says that the name includes backtick-arity). Second, it does not consider two members with identical names (i.e. not differing in case) to collide. This check (the only one that uses the "context" parameter is based on CLS Rule 46, as implemented by LangCompiler::IsCLSAccessible. The idea is that C<int> and C<char> are separate types in CLS, so they can't touch each other's protected members. TODO: This should really have a separate error code - it's logically separate and requires explanation. Check the accessibility of this type (probably a parameter or return type). Context for the accessibility check (e.g. containing type of method with as a parameter type. As in dev11, we ignore the fact that CLSCompliantAttribute is inherited (i.e. from the base type) (see CSemanticChecker::CheckSymForCLS). This should only affect types where the syntactic parent and the inheritance parent disagree. Based on CompilationPass::CLSReduceSignature. Traverses the symbol table processing XML documentation comments and optionally writing them to a provided stream. Traverses the symbol table processing XML documentation comments and optionally writing them to a provided stream. Compilation that owns the symbol table. Assembly name override, if specified. Otherwise the of the source assembly is used. Stream to which XML will be written, if specified. Will be supplemented with documentation comment diagnostics. To stop traversing the symbol table early. Only report diagnostics from this syntax tree, if non-null. If and filterSpanWithinTree is non-null, report diagnostics within this span in the . Gets the XML that would be written to the documentation comment file for this assembly. The symbol for which to retrieve documentation comments. True to treat includes as semantically meaningful (pull in contents from other files and bind crefs, etc). To stop traversing the symbol table early. Write header, descend into members, and write footer. Write own documentation comments and then descend into members. Compile documentation comments on the symbol and write them to the stream if one is provided. Loop over the DocumentationCommentTriviaSyntaxes. Gather 1) concatenated XML, as a string; 2) whether or not the XML is valid; 3) set of type parameters covered by <typeparam> elements; 4) set of parameters covered by <param> elements; 5) list of <include> elements, as SyntaxNodes. True, if at least one documentation comment was processed; false, otherwise. This was factored out for clarity, not because it's reusable. Similar to SymbolExtensions.GetParameters, but returns empty for unsupported symbols and handles delegates. Similar to SymbolExtensions.GetMemberTypeParameters, but returns empty for unsupported symbols. A symbol requires a documentation comment if it was explicitly declared and will be visible outside the current assembly (ignoring InternalsVisibleTo). Exception: accessors do not require doc comments. Get all of the DocumentationCommentTriviaSyntax associated with any declaring syntax of the given symbol (except for partial methods, which only consider the part with the body). True if the nodes are all valid XML. Given the full text of a documentation comment, strip off the comment punctuation (///, /**, etc) and add appropriate indentations. Given a string, find the index of the first non-whitespace char. The string to search The index of the first non-whitespace char in the string Find the first non-whitespace character in a given substring. The string to search The start index The last index (non-inclusive) The index of the first non-whitespace char after index start in the string up to, but not including the end index Determine if the given string starts with the given prefix if whitespace is first trimmed from the beginning. The string to search The prefix true if str.TrimStart().StartsWith(prefix) Given a string which may contain newline sequences, get the index of the first newline sequence beginning at the given starting index. The string to split. The starting index within the string. The length of the newline sequence discovered. 0 if the end of the string was reached, otherwise either 1 or 2 chars The index of the start of the first newline sequence following the start index Given the full text of a single-line style documentation comment, for each line, strip off the comment punctuation (///) and add appropriate indentations. Given the full text of a multi-line style documentation comment, broken into lines, strip off the comment punctuation (/**, */, etc) and add appropriate indentations. Remove "*/" and any following text, if it is present. Return the longest prefix matching [whitespace]*[*][whitespace]*. Return the longest common prefix of two strings Bind a CrefSyntax and unwrap the result if it's an alias. Does not respect DocumentationMode, so use a temporary bag if diagnostics are not desired. Given a cref syntax that cannot be resolved, get the string that will be written to the documentation file in place of a documentation comment ID. Bind an XmlNameAttributeSyntax and update the sets of documented parameters and type parameters. Does not respect DocumentationMode, so do not call unless diagnostics are desired. WORKAROUND: We're taking a dependency on the location and structure of a framework assembly resource. This is not a robust solution. Possible alternatives: 1) Polish our XML parser until it matches MSXML. We don't want to reinvent the wheel. 2) Build a map that lets us go from XML string positions back to source positions. This is what the native compiler did, and it was a lot of work. We'd also still need to modify the message. 3) Do not report a diagnostic. This is very unhelpful. 4) Report a vague diagnostic (i.e. there's a problem somewhere in this doc comment). This is relatively unhelpful. 5) Always report the message in English, so that we can pull it apart without needing to consume resource files. This engenders a lot of ill will. 6) Report the exception message without modification and (optionally) include the text with respect to which the position is specified. This would not look sufficiently polished. Walks a DocumentationCommentTriviaSyntax, binding the semantically meaningful parts to produce diagnostics and to replace source crefs with documentation comment IDs. Writes the matching 'param' tags on a primary constructor as 'summary' tags for a synthesized record property. Still has all of the comment punctuation (///, /**, etc). associated with the 'param' tag. Given a DocumentationCommentTriviaSyntax, return the full text, but with documentation comment IDs substituted into crefs. Still has all of the comment punctuation (///, /**, etc). Rewrites nodes in , which is a snapshot of nodes from the original document. We're mutating the tree as we rewrite, so it's important to grab a snapshot of the nodes that we're going to reparent before we enumerate them. This method boils down to Rewrite(XDocument.Load(fileAttrValue).XPathSelectElements(pathAttrValue)). Everything else is error handling. Respects the DocumentationMode at the source location. Respects the DocumentationMode at the source location. Contains methods related to synthesizing bound nodes in initial binding form that needs lowering, primarily method bodies for compiler-generated methods. Generates a submission initialization part of a Script type constructor that represents an interactive submission. The constructor takes a parameter of type Microsoft.CodeAnalysis.Scripting.Session - the session reference. It adds the object being constructed into the session by calling Microsoft.CSharp.RuntimeHelpers.SessionHelpers.SetSubmission, and retrieves strongly typed references on all previous submission script classes whose members are referenced by this submission. The references are stored to fields of the submission (). Construct a body for an auto-property accessor (updating or returning the backing field). Generate an accessor for a field-like event. Generate a thread-safe accessor for a WinRT field-like event. Add: return EventRegistrationTokenTable<Event>.GetOrCreateEventRegistrationTokenTable(ref _tokenTable).AddEventHandler(value); Remove: EventRegistrationTokenTable<Event>.GetOrCreateEventRegistrationTokenTable(ref _tokenTable).RemoveEventHandler(value); Generate a thread-safe accessor for a regular field-like event. DelegateType tmp0 = _event; //backing field DelegateType tmp1; DelegateType tmp2; do { tmp1 = tmp0; tmp2 = (DelegateType)Delegate.Combine(tmp1, value); //Remove for -= tmp0 = Interlocked.CompareExchange<DelegateType>(ref _event, tmp2, tmp1); } while ((object)tmp0 != (object)tmp1); Note, if System.Threading.Interlocked.CompareExchange<T> is not available, we emit the following code and mark the method Synchronized (unless it is a struct). _event = (DelegateType)Delegate.Combine(_event, value); //Remove for -= Look for a base type method named "Finalize" that is protected (or protected internal), has no parameters, and returns void. It doesn't need to be virtual or a destructor. You may assume that this would share code and logic with PEMethodSymbol.OverridesRuntimeFinalizer, but FUNCBRECCS::bindDestructor has its own loop that performs these checks (differently). In some circumstances (e.g. implicit implementation of an interface method by a non-virtual method in a base type from another assembly) it is necessary for the compiler to generate explicit implementations for some interface methods. They don't go in the symbol table, but if we are emitting, then we should generate code for them. entryPointOpt is only considered for synthesized methods (to recognize the synthesized MoveNext method for async Main) When compiling in metadata-only mode, is not run. This is problematic because adds synthesized explicit implementations to the list of synthesized definitions. In lieu of running , this class performs a quick traversal of the symbol table and performs processing of synthesized symbols if necessary Traverse the symbol table and call Module.AddSynthesizedDefinition for each synthesized explicit implementation stub that has been generated (e.g. when the real implementation doesn't have the appropriate custom modifiers). Represents the state of compilation of one particular type. This includes, for example, a collection of synthesized methods created during lowering. WARNING: Note that the collection class is not thread-safe and will need to be revised if emit phase is changed to support multithreading when translating a particular type. Synthesized method info Flat array of created methods, non-empty if not-null Map of wrapper methods created for base access of base type virtual methods from other classes (like those created for lambdas...); actually each method symbol will only need one wrapper to call it non-virtually. Type symbol being compiled, or null if we compile a synthesized type that doesn't have a symbol (e.g. PrivateImplementationDetails). The builder for generating code, or null if not in emit phase. Any generated methods that don't suppress debug info will use this list of debug imports. A graph of method->method references for this(...) constructor initializers. Used to detect and report initializer cycles. The type for which this compilation state is being used. The type passed to the runtime binder as context. Add a 'regular' synthesized method. Add a 'wrapper' synthesized method and map it to the original one so it can be reused. Wrapper methods are created for base access of base type virtual methods from other classes (like those created for lambdas...). The index of the next wrapped method to be used Get a 'wrapper' method for the original one. Wrapper methods are created for base access of base type virtual methods from other classes (like those created for lambdas...). Free resources allocated for this method collection Report an error if adding the edge (method1, method2) to the ctor-initializer graph would add a new cycle to that graph. a calling ctor the chained-to ctor where to report a cyclic error if needed a diagnostic bag for receiving the diagnostic Represents various options that affect compilation, such as whether to emit an executable or a library, whether to optimize generated code, and so on. Allow unsafe regions (i.e. unsafe modifiers on members and unsafe blocks). Global namespace usings. Flags applied to the top-level binder created for each syntax tree in the compilation as well as for the binder of global imports. Global Nullable context options. Determines if the given raw kind value belongs to the C# enumeration. The raw value to test. when the raw value belongs to the C# syntax kind; otherwise, . Returns for from property. Returns for from property. Returns for from property. Returns for from property. Insert one or more tokens in the list at the specified index. A new list with the tokens inserted. Creates a new token with the specified old trivia replaced with computed new trivia. The trivia to be replaced; descendants of the root token. A function that computes a replacement trivia for the argument trivia. The first argument is the original trivia. The second argument is the same trivia rewritten with replaced structure. Creates a new token with the specified old trivia replaced with a new trivia. The old trivia may appear in the token's leading or trailing trivia. The trivia to be replaced. The new trivia to use in the new tree in place of the old trivia. Returns this list as a . The type of the list elements in the separated list. Gets the first directive of the tree rooted by this node. Gets the last directive of the tree rooted by this node. Gets the semantic information for an ordering clause in an orderby query clause. Gets the semantic information associated with a select or group clause. Returns what symbol(s), if any, the given expression syntax bound to in the program. An AliasSymbol will never be returned by this method. What the alias refers to will be returned instead. To get information about aliases, call GetAliasInfo. If binding the type name C in the expression "new C(...)" the actual constructor bound to will be returned (or all constructor if overload resolution failed). This occurs as long as C unambiguously binds to a single type that has a constructor. If C ambiguously binds to multiple types, or C binds to a static class, then type(s) are returned. Returns what 'Add' method symbol(s), if any, corresponds to the given expression syntax within . Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program. Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program. Returns what symbol(s), if any, the given attribute syntax bound to in the program. Gets the semantic information associated with a documentation comment cref. Binds the expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code. Binds the CrefSyntax expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code. Bind the attribute in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about an attribute that did not actually appear in the source code. Bind the constructor initializer in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code. NOTE: This will only work in locations where there is already a constructor initializer. Bind the constructor initializer in the context of the specified location and get semantic information about symbols. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code. NOTE: This will only work in locations where there is already a constructor initializer. . Gets type information about a constructor initializer. Gets type information about an expression. Gets type information about an attribute. Binds the expression in the context of the specified location and gets type information. This method is used to get type information about an expression that did not actually appear in the source code. Gets the underlying information from this . This must have been created from CSharp code. The conversion expression to get original info from. The underlying . If the was not created from CSharp code. Gets the underlying information from this . This conversion is applied before the operator is applied to the result of this conversion and . This compound assignment must have been created from C# code. Gets the underlying information from this . This conversion is applied after the operator is applied, before the result is assigned to . This compound assignment must have been created from C# code. Gets the underlying element information from this . This spread operation must have been created from C# code. Returns the list of accessible, non-hidden indexers that could be invoked with the given expression as receiver. Gets the semantic information associated with a query clause. If resolves to an alias name, return the AliasSymbol corresponding to A. Otherwise return null. Binds the name in the context of the specified location and sees if it resolves to an alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null. Analyze control-flow within a part of a method body. Analyze control-flow within a part of a method body. Analyze data-flow within a . Analyze data-flow within a initializer. Analyze data-flow within an . Analyze data-flow within a part of a method body. Analyze data-flow within a part of a method body. Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body. Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body. Get a SemanticModel object that is associated with a type syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a type syntax that did not appear in source code. Get a SemanticModel object that is associated with a cref syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a cref syntax that did not appear in source code. Get a SemanticModel object that is associated with a statement that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a statement that did not appear in source code. Get a SemanticModel object that is associated with an initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a field initializer or default parameter value that did not appear in source code. Get a SemanticModel object that is associated with an expression body that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an expression body that did not appear in source code. Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code. NOTE: This will only work in locations where there is already a constructor initializer. Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code. NOTE: This will only work in locations where there is already a constructor initializer. Get a SemanticModel object that is associated with an attribute that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an attribute that did not appear in source code. Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression. Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression. Given a member declaration syntax, get the corresponding symbol. Given a compilation unit syntax, get the corresponding Simple Program entry point symbol. Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly. Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly. Given a type declaration, get the corresponding type symbol. Given a delegate declaration, get the corresponding type symbol. Given a enum member declaration, get the corresponding field symbol. Given a base method declaration syntax, get the corresponding method symbol. Given a syntax node that declares a property, indexer or an event, get the corresponding declared symbol. Given a syntax node that declares a property, get the corresponding declared symbol. Given a syntax node that declares an indexer, get the corresponding declared symbol. Given a syntax node that declares a (custom) event, get the corresponding event symbol. Given a syntax node of anonymous object creation initializer, get the anonymous object property symbol. Given a syntax node of anonymous object creation expression, get the anonymous object type symbol. Given a syntax node of tuple expression, get the tuple type symbol. Given a syntax node of a tuple argument, get the tuple element symbol. Given a syntax node that declares a property or member accessor, get the corresponding symbol. Given a variable declarator syntax, get the corresponding symbol. Given a variable declarator syntax, get the corresponding symbol. Given a tuple element syntax, get the corresponding symbol. Given a labeled statement syntax, get the corresponding label symbol. Given a switch label syntax, get the corresponding label symbol. Given a using declaration get the corresponding symbol for the using alias that was introduced. Given an extern alias declaration get the corresponding symbol for the alias that was introduced. Given a parameter declaration syntax node, get the corresponding symbol. Given a type parameter declaration (field or method), get the corresponding symbol Given a foreach statement, get the symbol for the iteration variable Given a catch declaration, get the symbol for the exception variable Get the query range variable declared in a join into clause. Get the query range variable declared in a query continuation clause. Given a local function declaration syntax, get the corresponding symbol. If the call represented by is referenced in an InterceptsLocationAttribute, returns the original definition symbol which is decorated with that attribute. Otherwise, returns null. If cannot be intercepted syntactically, returns null. Otherwise, returns an instance which can be used to intercept the call denoted by . Gets an attribute list syntax consisting of an InterceptsLocationAttribute, which intercepts the call referenced by parameter . Emit the IL for the compilation into the specified stream. Compilation. Path of the file to which the PE image will be written. Path of the file to which the compilation's debug info will be written. Also embedded in the output file. Null to forego PDB generation. Path of the file to which the compilation's XML documentation will be written. Null to forego XML generation. Path of the file from which the compilation's Win32 resources will be read (in RES format). Null to indicate that there are none. List of the compilation's managed resources. Null to indicate that there are none. To cancel the emit process. Compilation or path is null. Path is empty or invalid. An error occurred while reading or writing a file. This class stores several source parsing related options and offers access to their values. The default parse options. Gets the effective language version, which the compiler uses to select the language rules to apply to the program. Gets the specified language version, which is the value that was specified in the call to the constructor, or modified using the method, or provided on the command line. Gets the names of defined preprocessor symbols. Enable some experimental language features for testing. A Declaration summarizes the declaration structure of a source file. Each entity declaration in the program that is a container (specifically namespaces, classes, interfaces, structs, and delegate declarations) is represented by a node in this tree. At the top level, the compilation unit is treated as a declaration of the unnamed namespace. Special treatment is required for namespace declarations, because a single namespace declaration can declare more than one namespace. For example, in the declaration namespace A.B.C {} we see that namespaces A and B and C are declared. This declaration is represented as three declarations. All three of these ContainerDeclaration objects contain a reference to the syntax tree for the declaration. A "single" declaration represents a specific namespace or type declaration at a point in source code. A "root" declaration is a special single declaration which summarizes the contents of an entire file's types and namespaces. Each source file is represented as a tree of single declarations. A "merged" declaration merges together one or more declarations for the same symbol. For example, the root namespace has multiple single declarations (one in each source file) but there is a single merged declaration for them all. Similarly partial classes may have multiple declarations, grouped together under the umbrella of a merged declaration. In the common trivial case, a merged declaration for a single declaration contains only that single declaration. The whole program, consisting of the set of all declarations in all of the source files, is represented by a tree of merged declarations. A declaration table is a device which keeps track of type and namespace declarations from parse trees. It is optimized for the case where there is one set of declarations that stays constant, and a specific root namespace declaration corresponding to the currently edited file which is being added and removed repeatedly. It maintains a cache of information for "merging" the root declarations into one big summary declaration; this cache is efficiently re-used provided that the pattern of adds and removes is as we expect. Cache of node to the last set of member names computed for it. Helpful for avoiding excess hashset allocations for common scenarios where compilations are created with the same trees used to create prior compilations. We store as green nodes for two purposes. First, it allows the data to be stored, without holding onto the whole tree. It allows files with multiple types in them to reuse the member names for untouched types when others in the file are edited. Stored in lexical order for the types in this tree that had member names the last time we created decls for the tree. Any special attributes we may be referencing through a using alias in the file. For example using X = System.Runtime.CompilerServices.TypeForwardedToAttribute. The index of the current type we're processing in lexicographic order with respect to all other types in the file. For example: class A // Index 0 { class B // Index 1 { } } class C // Index 2 { } Creates a root declaration that contains a Script class declaration (possibly in a namespace) and namespace declarations. Top-level declarations in script code are nested in Script class. Returns the original syntax nodes for this type declaration across all its parts. If is provided, attributes will not be returned if it is certain there are none that could match the request. This prevents going back to source unnecessarily. Any special attributes we may be referencing directly through a global using alias in the file. global using X = System.Runtime.CompilerServices.TypeForwardedToAttribute. Any diagnostics reported while converting the Namespace/Type syntax into the Declaration instance. Generally, we determine and store some diagnostics here because we don't want to have to go back to Syntax when we have our NamespaceSymbol or NamedTypeSymbol. Stored as a so that we can point weak-references at this instance and attempt to reuse it across edits if the original hasn't been GC'ed. Any special attributes we may be referencing directly as an attribute on this type or through a using alias in the file. For example using X = System.Runtime.CompilerServices.TypeForwardedToAttribute or [TypeForwardedToAttribute]. Can be used to avoid having to go back to source to retrieve attributes when there is no chance they would bind to attribute of interest. Simple program uses await expressions. Set only in conjunction with Set only in conjunction with Set only in conjunction with A visitor that generates the part of the documentation comment after the initial type and colon. Matches symbols from an assembly in one compilation to the corresponding assembly in another. Assumes that only one assembly has changed between the two compilations. Matches symbols from an assembly in one compilation to the corresponding assembly in another. Assumes that only one assembly has changed between the two compilations. Match local declarations to names to generate a map from declaration to local slot. The names are indexed by slot and the assumption is that declarations are in the same order as slots. Members that are not listed directly on their containing type or namespace symbol as they were synthesized in a lowering phase, after the symbol has been created. A cache of members per type, populated when the first member for a given type is needed. Within each type, members are indexed by name. The reason for caching, and indexing by name, is to avoid searching sequentially through all members of a given kind each time a member is matched. Return a version of the baseline with all definitions mapped to this compilation. Definitions from the initial generation, from metadata, are not mapped since the initial generation is always included as metadata. That is, the symbols from types, methods, ... in the TypesAdded, MethodsAdded, ... collections are replaced by the corresponding symbols from the current compilation. Represents a reference to a generic method instantiation, closed over type parameters, e.g. MyNamespace.Class.Method{T}() Represents a reference to a generic type instantiation that is not nested. e.g. MyNamespace.A{int} Represents a reference to a generic type instantiation that is nested in a non-generic type. e.g. A.B{int} Represents a reference to a generic type instantiation. Subclasses represent nested and namespace types. Additional types injected by the Expression Evaluator. This is a cache of a subset of . We don't include manifest resources in ref assemblies The behavior of the C# command-line compiler is as follows: 1) If the /out switch is specified, then the explicit assembly name is used. 2) Otherwise, a) if the assembly is executable, then the assembly name is derived from the name of the file containing the entrypoint; b) otherwise, the assembly name is derived from the name of the first input file. Since we don't know which method is the entrypoint until well after the SourceAssemblySymbol is created, in case 2a, its name will not reflect the name of the file containing the entrypoint. We leave it to our caller to provide that name explicitly. In cases 1 and 2b, we expect (metadataName == sourceAssembly.MetadataName). The compiler-generated implementation type for each fixed-size buffer. Returns a value indicating which embedded attributes should be generated during emit phase. The value is set during binding the symbols that need those attributes, and is frozen on first trial to get it. Freezing is needed to make sure that nothing tries to modify the value after the value is read. Gets a list of documents from the method definitions in the types in or any nested types of those types. Ignore accessibility when resolving well-known type members, in particular for generic type arguments (e.g.: binding to internal types in the EE). Override the dynamic operation context type for all dynamic calls in the module. Builds an array of public type symbols defined in netmodules included in the compilation and type forwarders defined in this compilation or any included netmodule (in this order). Returns a set of top-level forwarded types Set the underlying implementation type for a given fixed-size buffer field. Given a type , which is either a nullable reference type OR is a constructed type with a nullable reference type present in its type argument tree, returns a synthesized NullableAttribute with encoded nullable transforms array. Creates the ThrowSwitchExpressionException helper if needed. Creates the ThrowSwitchExpressionExceptionParameterless helper if needed. Creates the ThrowInvalidOperationException helper if needed. Represents a reference to a field of a generic type instantiation. e.g. A{int}.Field A{int}.B{string}.C.Field Represents a generic method of a generic type instantiation, closed over type parameters. e.g. A{T}.M{S}() A.B{T}.C.M{S}() Represents a reference to an instantiation of a generic type nested in an instantiation of another generic type. e.g. A{int}.B{string} A.B{int}.C.D{string} Represents a method of a generic type instantiation. e.g. A{int}.M() A.B{int}.C.M() Represents a reference to a type nested in an instantiation of a generic type. e.g. A{int}.B A.B{int}.C.D Used only for testing. Returns true if the type can be embedded. If the type is defined in a linked (/l-ed) assembly, but doesn't meet embeddable type requirements, this function returns false and reports appropriate diagnostics. Returns the common value if all bytes are the same value. Otherwise returns null. A diagnostic, along with the location where it occurred. Add a diagnostic to the bag. Add a diagnostic to the bag. Adds diagnostics from useSiteDiagnostics into diagnostics and returns True if there were any errors. Adds diagnostics from useSiteDiagnostics into diagnostics and returns True if there were any errors. Don't call this during a parse--it loads resources Don't call this during a parse--it loads resources Don't call this during a parse--it loads resources Returns true if this is a build-only diagnostic that is never reported from API. Diagnostics generated during compilation phases such as lowering, emit, etc. are example of build-only diagnostics. When converting an anonymous function to a delegate type, there are some diagnostics that will occur regardless of the delegate type - particularly those that do not depend on the substituted types (e.g. name uniqueness). Even though we need to produce a diagnostic in such cases, we do not need to abandon overload resolution - we can choose the overload that is best without regard to such diagnostics. True if seeing the ErrorCode should prevent a delegate conversion from completing successfully. WARNING: will resolve lazy diagnostics - do not call this before the member lists are completed or you could trigger infinite recursion. A lazily calculated diagnostic for use of nullable annotations outside of a '#nullable' annotations context. A `?` annotation on a type that isn't a value type causes: - an error before C# 8.0 - a warning outside of a NonNullTypes context An abstract flow pass that takes some shortcuts in analyzing finally blocks, in order to enable the analysis to take place without tracking exceptions or repeating the analysis of a finally block for each exit from a try statement. The shortcut results in a slightly less precise (but still conservative) analysis, but that less precise analysis is all that is required for the language specification. The most significant shortcut is that we do not track the state where exceptions can arise. That does not affect the soundness for most analyses, but for those analyses whose soundness would be affected (e.g. "data flows out"), we track "unassignments" to keep the analysis sound. Formally, this is a fairly conventional lattice flow analysis () that moves upward through the operation. The compilation in which the analysis is taking place. This is needed to determine which conditional methods will be compiled and which will be omitted. The method whose body is being analyzed, or the field whose initializer is being analyzed. May be a top-level member or a lambda or local function. It is used for references to method parameters. Thus, '_symbol' should not be used directly, but 'MethodParameters', 'MethodThisParameter' and 'AnalyzeOutParameters(...)' should be used instead. _symbol is null during speculative binding. Reflects the enclosing member, lambda or local function at the current location (in the bound tree). The bound node of the method or initializer being analyzed. The flow analysis state at each label, computed by calling on the state from branches to that label with the state when we fall into the label. Entries are created when the label is encountered. One case deserves special attention: when the destination of the branch is a label earlier in the code, it is possible (though rarely occurs in practice) that we are changing the state at a label that we've already analyzed. In that case we run another pass of the analysis to allow those changes to propagate. This repeats until no further changes to the state of these labels occurs. This can result in quadratic performance in unlikely but possible code such as this: "int x; if (cond) goto l1; x = 3; l5: print x; l4: goto l5; l3: goto l4; l2: goto l3; l1: goto l2;" Set to true after an analysis scan if the analysis was incomplete due to state changing after it was used by another analysis component. In this case the caller scans again (until this is false). Since the analysis proceeds by monotonically changing the state computed at each label, this must terminate. All of the labels seen so far in this forward scan of the body Pending escapes generated in the current scope (or more deeply nested scopes). When jump statements (goto, break, continue, return) are processed, they are placed in the pendingBranches buffer to be processed later by the code handling the destination statement. As a special case, the processing of try-finally statements might modify the contents of the pendingBranches buffer to take into account the behavior of "intervening" finally clauses. The definite assignment and/or reachability state at the point currently being analyzed. Indicates that the transfer function for a particular node (the function mapping the state before the node to the state after the node) is not monotonic, in the sense that it can change the state in either direction in the lattice. If the transfer function is monotonic, the transfer function can only change the state toward the . Reachability and definite assignment are monotonic, and permit a more efficient analysis. Region analysis and nullable analysis are not monotonic. This is just an optimization; we could treat all of them as nonmonotonic without much loss of performance. In fact, this only affects the analysis of (relatively rare) try statements, and is only a slight optimization. Where all diagnostics are deposited. A cache of the state at the backward branch point of each loop. This is not needed during normal flow analysis, but is needed for DataFlowsOut region analysis. Subclasses may override EnterRegion to perform any actions at the entry to the region. Subclasses may override LeaveRegion to perform any action at the end of the region. A pending branch. These are created for a return, break, continue, goto statement, yield return, yield break, await expression, and await foreach/using. The idea is that we don't know if the branch will eventually reach its destination because of an intervening finally block that cannot complete normally. So we store them up and handle them as we complete processing each construct. At the end of a block, if there are any pending branches to a label in that block we process the branch. Otherwise we relay it up to the enclosing construct as a pending branch of the enclosing construct. Perform a single pass of flow analysis. Note that after this pass, this.backwardBranchChanged indicates if a further pass is required. If a method is currently being analyzed returns its parameters, returns an empty array otherwise. If a method is currently being analyzed returns its 'this' parameter, returns null otherwise. Specifies whether or not method's out parameters should be analyzed. location to be used true if the out parameters of the method should be analyzed Return the flow analysis state associated with a label. Return to the caller the set of pending return statements. Set the current state to one that indicates that it is unreachable. Visit a boolean condition expression. Visit a general expression, where we will only need to determine if variables are assigned (or not). That is, we will not be needing AssignedWhenTrue and AssignedWhenFalse. True when visiting an rvalue that will actually be used as an lvalue, for example a ref parameter when simulating a read of it, or an argument corresponding to an in parameter Visit a statement. Called at the point in a loop where the backwards branch would go to. Called at the point in a loop where the backward branch is placed. Used to resolve break statements in each statement form that has a break statement (loops, switch). Used to resolve continue statements in each statement form that supports it. Subclasses override this if they want to take special actions on processing a goto statement, when both the jump and the label have been located. To handle a label, we resolve all branches to that label. Returns true if the state of the label changes as a result. Target label Statement containing the target label Since branches cannot branch into constructs, only out, we save the pending branches when visiting more nested constructs. When tracking exceptions, we store the current state as the exception state for the following code. We use this when closing a block that may contain labels or branches - branches to new labels are resolved - new labels are removed (no longer can be reached) - unresolved pending branches are carried forward The old pending branches, which are to be merged with the current ones Since each language construct must be handled according to the rules of the language specification, the default visitor reports that the construct for the node is not implemented in the compiler. Certain (struct) types are known by the compiler to be immutable. In these cases calling a method on the type is known (by flow analysis) not to write the receiver. Do not call for a local function. Writes ref and out parameters Join state from other try block, potentially in a nested method. Visits a node only if it is a conditional access. Returns 'true' if and only if the node was visited. "State when not null" can only propagate out of a conditional access if it is not subject to a user-defined conversion whose parameter is not of a non-nullable value type. Unconditionally visits an expression. If the expression has "state when not null" after visiting, the method returns 'true' and writes the state to . This visitor represents just the assignment part of the null coalescing assignment operator. This visitor represents just the non-assignment part of the null coalescing assignment operator (when the left operand is non-null). This is the "top" state of the data flow lattice. Generally, it is considered the state which is reachable, but no information is yet available. This is the state used at the start of method bodies. This is the absolute "bottom" state of the data flow lattice. C# does not specify a difference between unreachable states, so there can only be one. This is the state used for unreachable code, like statements after a "return" or "throw" statement. This should be a reachable state that won't affect another reachable state in a . Nontrivial implementation is required for DataFlowsOutWalker or any flow analysis pass that "tracks unassignments" like the nullable walker. The result should be a state, for each variable, that is the strongest result possible (i.e. definitely assigned for the data flow passes, or not null for the nullable analysis). operation. The "Join" operation is used when two separate control flow paths converge at a single statement. This operation is used to combine the if/else paths of a conditional, or two "goto" statements to the same label, for example. According to convention, Join moves "up" the lattice, so the following equations must hold: 1. Join(Unreachable(), X) = X 2. Join(Top, X) = Top True if was changed. False otherwise. The Meet operation is the inverse of . It's used when combining state additively, like when the state from a return statement inside a 'try' clause is combined with the end state of a 'finally' clause. This moves "down" our flow lattice, by convention. The following equations must hold: 1. Meet(Unreachable, X) = Unreachable 2. Meet(ReachableBottom, X - Unreachable) = ReachableBottom 3. Meet(Top, X) = X Produce a duplicate of this flow analysis state. Is the code reachable? Returns the unordered collection of branches. Returns the unordered collection of branches. This is the state from the local function which makes the current state less specific. For example, in nullable analysis this would be captured variables that may be nullable after calling the local function. When a local function is called, this state is with the current state. This is the part of the local function transfer function which transfers knowledge additively. For example, in definite assignment this would be captured state which is assigned by the local function. When a local function is called, this state is with the current state. Executed at the start of visiting a local function body. The parameter holds the current state information for the local function being visited. To save state information across the analysis, return an instance of . Executed after visiting a local function body. The is the return value from . The is state information for the local function that was just visited. is the state after visiting the method. Is the switch statement one that could be interpreted as a C# 6 or earlier switch statement? The possible places that we are processing when there is a region. This should be nested inside but is not due to https://github.com/dotnet/roslyn/issues/36992 . To scan the whole body, we start outside (before) the region. A region analysis walker that computes the set of variables that are always assigned a value in the region. A variable is "always assigned" in a region if an analysis of the region that starts with the variable unassigned ends with the variable assigned. This class implements the region control flow analysis operations. Region control flow analysis provides information about statements which enter and leave a region. The analysis is done lazily. When created, it performs no analysis, but simply caches the arguments. Then, the first time one of the analysis results is used it computes that one result and caches it. Each result is computed using a custom algorithm. A collection of statements outside the region that jump into the region. A collection of statements inside the region that jump to locations outside the region. Returns true if and only if the endpoint of the last statement in the region is reachable or the region contains no statements. A collection of return (or yield break) statements found within the region that return from the enclosing method or lambda. Returns true if and only if analysis was successful. Analysis can fail if the region does not properly span a single expression, a single statement, or a contiguous series of statements within the enclosing block. Produce a duplicate of this flow analysis state. Perform control flow analysis, reporting all necessary diagnostics. Returns true if the end of the body might be reachable... Analyze the body, reporting all necessary diagnostics. Returns true if the end of the body might be reachable. This class implements the region data flow analysis operations. Region data flow analysis provides information how data flows into and out of a region. The analysis is done lazily. When created, it performs no analysis, but simply caches the arguments. Then, the first time one of the analysis results is used it computes that one result and caches it. Each result is computed using a custom algorithm. A collection of the local variables that are declared within the region. Note that the region must be bounded by a method's body or a field's initializer, so method parameter symbols are never included in the result, but lambda parameters might appear in the result. A collection of the local variables for which a value assigned outside the region may be used inside the region. The set of local variables which are definitely assigned a value when a region is entered. The set of local variables which are definitely assigned a value when a region is exited. A collection of the local variables for which a value assigned inside the region may be used outside the region. Note that every reachable assignment to a ref or out variable will be included in the results. A collection of the local variables for which a value is always assigned inside the region. A collection of the local variables that are read inside the region. A collection of local variables that are written inside the region. A collection of the local variables that are read outside the region. A collection of local variables that are written outside the region. A collection of the non-constant local variables and parameters that have been referenced in anonymous functions and therefore must be moved to a field of a frame class. A collection of the non-constant local variables and parameters that have had their address (or the address of one of their fields) taken using the '&' operator. If there are any of these in the region, then a method should not be extracted. Returns true if and only if analysis was successful. Analysis can fail if the region does not properly span a single expression, a single statement, or a contiguous series of statements within the enclosing block. A region analysis walker that computes the set of variables whose values flow into (are used in) the region. A variable assigned outside is used inside if an analysis that leaves the variable unassigned on entry to the region would cause the generation of "unassigned" errors within the region. A region analysis walker that computes the set of variables for which their assigned values flow out of the region. A variable assigned inside is used outside if an analysis that treats assignments in the region as unassigning the variable would cause "unassigned" errors outside the region. Implement C# definite assignment. A mapping from local variables to the index of their slot in a flow analysis local state. A mapping from the local variable slot to the symbol for the local variable itself. This is used in the implementation of region analysis (support for extract method) to compute the set of variables "always assigned" in a region of code. The first slot, slot 0, is reserved for indicating reachability, so the first tracked variable will be given slot 1. When referring to VariableIdentifier.ContainingSlot, slot 0 indicates that the variable in VariableIdentifier.Symbol is a root, i.e. not nested within another tracked variable. Slots less than 0 are illegal. Some variables that should be considered initially assigned. Used for region analysis. Variables that were used anywhere, in the sense required to suppress warnings about unused variables. Parameters of record primary constructors that were read anywhere. Variables that were used anywhere, in the sense required to suppress warnings about unused variables. Variables that were initialized or written anywhere. Struct fields that are implicitly initialized, due to being used before being written, or not being written at an exit point. Map from variables that had their addresses taken, to the location of the first corresponding address-of expression. Doesn't include fixed statement address-of operands. Variables that were captured by anonymous functions. The current source assembly. A set of address-of expressions for which the operand is not definitely assigned. Tracks variables for which we have already reported a definite assignment error. This allows us to report at most one such error per variable. true if we should check to ensure that out parameters are assigned on every exit point. Track fields of classes in addition to structs. Track static fields, properties, events, in addition to instance members. The topmost method of this analysis. Check that every rvalue has been converted in the definite assignment pass only (not later passes deriving from it). Constructor to be used for region analysis, for which a struct type should never be considered empty. Perform data flow analysis, reporting all necessary diagnostics. Analyze the body, reporting all necessary diagnostics. Check if the variable is captured and, if so, add it to this._capturedVariables. The variable to be checked If variable.Kind is RangeVariable, its underlying lambda parameter. Else null. Add the variable to the captured set. For range variables we only add it if inside the region. This reflects the Dev10 compiler's rules for when a variable initialization is considered a "use" for the purpose of suppressing the warning about unused variables. Check that the given variable is definitely assigned. If not, produce an error. Report a given variable as not definitely assigned. Once a variable has been so reported, we suppress further reports of that variable. Mark a variable as assigned (or unassigned). Node being assigned to. The value being assigned. True if target location is considered written to. Ref assignment or value assignment. True if target location is considered read from. Does the struct variable at the given slot have all of its instance fields assigned? Marks attribute arguments as used. Variables declared in a using statement are always considered used, so this is just an assert. Produce a duplicate of this flow analysis state. Check that the given variable is definitely assigned when replaying local function reads. If not, produce an error. Specifying the slot manually may be necessary if the symbol is a field, in which case will not know which containing slot to look for. State changes are handled by the base class. We override to find captured variables that have been read before they were assigned and determine if the set has changed. Does a data flow analysis for state attached to local variables and fields of struct locals. Indicates whether this variable is nested inside another tracked variable. For instance, if a field `x` of a struct is a tracked variable, the symbol is not sufficient to uniquely determine which field is being tracked. The containing slot(s) would identify which tracked variable the field `x` is part of. True if new variables introduced in should be set to the bottom state. False if they should be set to the top state. A cache for remember which structs are empty. Locals are given slots when their declarations are encountered. We only need give slots to local variables, out parameters, and the "this" variable of a struct constructs. Other variables are not given slots, and are therefore not tracked by the analysis. This returns -1 for a variable that is not tracked, for fields of structs that have the same assigned status as the container, and for structs that (recursively) contain no data members. We do not need to track references to variables that occur before the variable is declared, as those are reported in an earlier phase as "use before declaration". That allows us to avoid giving slots to local variables before processing their declarations. Force a variable to have a slot. Returns -1 if the variable has an empty struct type. Sets the starting state for any newly declared variables in the LocalDataFlowPass. Descends through Rest fields of a tuple if "symbol" is an extended field As a result the "symbol" will be adjusted to be the field of the innermost tuple and a corresponding containingSlot is returned. Return value -1 indicates a failure which could happen for the following reasons a) Rest field does not exist, which could happen in rare error scenarios involving broken ValueTuple types b) Rest is not tracked already and forceSlotsToExist is false (otherwise we create slots on demand) Return the slot for a variable, or -1 if it is not tracked (because, for example, it is an empty struct). A region analysis walker that computes the set of variables that are definitely assigned when a region is entered or exited. A small cache for remembering empty struct types for flow analysis. When set, we ignore private reference fields of structs loaded from metadata. Create a cache for computing whether or not a struct type is "empty". Enable compatibility with the native compiler, which ignores inaccessible fields of reference type for structs loaded from metadata. if is true, set to the compilation from which to check accessibility. Specialized EmptyStructTypeCache that reports all structs as not empty Determine if the given type is an empty struct type. Determine if the given type is an empty struct type,. "typesWithMembersOfThisType" contains a list of types that have members (directly or indirectly) of this type. to remove circularity. Get all instance fields of a struct. They are not necessarily returned in order. Get all instance fields of a struct. They are not necessarily returned in order. When deciding what struct fields to drop on the floor, the native compiler looks through arrays, and does not ignore value types or type parameters. Is it possible that the given symbol can be accessed somewhere in the given assembly? For the purposes of this test, we assume that code in the given assembly might derive from any type. So protected members are considered potentially accessible. A region analysis walker that records jumps into the region. Works by overriding NoteBranch, which is invoked by a superclass when the two endpoints of a jump have been identified. A region analysis walker that records jumps out of the region. The flow analysis pass. This pass reports required diagnostics for unreachable statements and uninitialized variables (through the call to FlowAnalysisWalker.Analyze), and inserts a final return statement if the end of a void-returning method is reachable. the method to be analyzed the method's body The state of compilation of the enclosing type the receiver of the reported diagnostics indicates whether this Script had a trailing expression the original method body is the last statement in the block the rewritten block for the method (with a return statement possibly inserted) Nullability flow analysis. Nullable analysis data for methods, parameter default values, and attributes stored on the Compilation during testing only. The key is a symbol for methods or parameters, and syntax for attributes. Used to copy variable slots and types from the NullableWalker for the containing method or lambda to the NullableWalker created for a nested lambda or local function. Data recorded for a particular analysis run. Number of entries tracked during analysis. True if analysis was required; false if analysis was optional and results dropped. Represents the result of visiting an expression. Contains a result type which tells us whether the expression may be null, and an l-value type which tells us whether we can assign null to the expression. For expressions whose constituent parts contribute to method type inference (such as collection expressions), we need to keep track of the visit results for those parts. Binder for symbol being analyzed. Conversions with nullability and unknown matching any. 'true' if non-nullable member warnings should be issued at return points. One situation where this is 'false' is when we are analyzing field initializers and there is a constructor symbol in the type. If true, the parameter types and nullability from _delegateInvokeMethod is used for initial parameter state. If false, the signature of CurrentSymbol is used instead. If true, the return type and nullability from _delegateInvokeMethod is used. If false, the signature of CurrentSymbol is used instead. Method signature used for return or parameter types. Distinct from CurrentSymbol signature when CurrentSymbol is a lambda and type is inferred from MethodTypeInferrer. Return statements and the result types from analyzing the returned expressions. Used when inferring lambda return type in MethodTypeInferrer. Invalid type, used only to catch Visit methods that do not set _result.Type. See VisitExpressionWithoutStackGuard. Contains the map of expressions to inferred nullabilities and types used by the optional rewriter phase of the compiler. Manages creating snapshots of the walker as appropriate. Null if we're not taking snapshots of this walker. State of method group receivers, used later when analyzing the conversion to a delegate. (Could be replaced by _analyzedNullabilityMapOpt if that map is always available.) Variables instances for each lambda or local function defined within the analyzed region. Map from a target-typed expression (such as a target-typed conditional, switch or new) to the delegate that completes analysis once the target type is known. The delegate is invoked by . True if we're analyzing speculative code. This turns off some initialization steps that would otherwise be taken. True if this walker was created using an initial state. The result and l-value type of the last visited expression. The visit result of the receiver for the current conditional access. For example: A conditional invocation uses a placeholder as a receiver. By storing the visit result from the actual receiver ahead of time, we can give this placeholder a correct result. The result type represents the state of the last visited expression. Force the inference of the LValueResultType from ResultType. Force the inference of the ResultType from LValueResultType. Sets the analyzed nullability of the expression to be the given result. Placeholder locals, e.g. for objects being constructed. For methods with annotations, we'll need to visit the arguments twice. Once for diagnostics and once for result state (but disabling diagnostics). Whether we are going to read the currently visited expression. Used to allow to substitute the correct slot for a when it's encountered. We have multiple ways of entering the nullable walker: we could be just analyzing the initializers, with a BoundStatementList body and _baseOrThisInitializer having been provided, or we could be analyzing the body of a constructor, with a BoundConstructorBody body and _baseOrThisInitializer being null. Analyzes a method body if settings indicate we should. Gets the "after initializers state" which should be used at the beginning of nullable analysis of certain constructors. Analyzes a set of bound nodes, recording updated nullability information. This method is only used when nullable is explicitly enabled for all methods but disabled otherwise to verify that correct semantic information is being recorded for all bound nodes. The results are thrown away. Analyzes a set of bound nodes, recording updated nullability information, and returns an updated BoundNode with the information populated. Returns true if the nullable analysis is needed for the region represented by . The syntax node is used to determine the overall nullable context for the region. Analyzes a node in a "one-off" context, such as for attributes or parameter default values. is the syntax span used to determine the overall nullable context. The contents of this method, particularly , are problematic when inlined. The methods themselves are small but they end up allocating significantly larger frames due to the use of biggish value types within them. The method is used on a hot path for fluent calls and this size change is enough that it causes us to exceed our thresholds in EndToEndTests.OverflowOnFluentCall. Should we warn for assigning this state into this type? This should often be checked together with It catches putting a `null` into a `[DisallowNull]int?` for example, which cannot simply be represented as a non-nullable target type. Reports top-level nullability problem in assignment. Any conversion of the value should have been applied. Update tracked value on assignment. Whenever assigning a variable, and that variable is not declared at the point the state is being set, and the new state is not , this method should be called to perform the state setting and to ensure the mutation is visible outside the finally block when the mutation occurs in a finally block. If , is known only within returned delegate. A delegate to complete the initializer analysis. If , is known only within returned delegate. A delegate to complete the element initializer analysis. Returns true if the type is a struct with no fields or properties. For target-typed expressions, we first visit the constituent parts to determine the effect on the State, but the final VisitResult isn't determined and the conversions on the constituent parts are not analyzed until the target-type is known and the containing conversion is processed. This is done using . All registered completions must be processed (ie. analyzed via some conversion) before the nullable analysis completes. Applies analysis similar to . The expressions returned from a lambda are not converted though, so we'll have to classify fresh conversions. Note: even if some conversions fail, we'll proceed to infer top-level nullability. That is reasonable in common cases. If we learn that the operand is non-null, we can infer that certain sub-expressions were also non-null. Get all nested conditional slots for those sub-expressions. For example in a?.b?.c we'll set a, b, and c. Only returns slots for tracked expressions. https://github.com/dotnet/roslyn/issues/53397 This method should potentially be removed. Visits a node only if it is a conditional access. Returns 'true' if and only if the node was visited. Unconditionally visits an expression and returns the "state when not null" for the expression. Placeholders are bound expressions with type and state. But for typeless expressions (such as `null` or `(null, null)` we hold onto the original bound expression, as it will be useful for conversions from expression. Fix a TypeWithAnnotations based on Allow/DisallowNull annotations prior to a conversion or assignment. Note this does not work for nullable value types, so an additional check with may be required. Update the null-state based on MaybeNull/NotNull If you pass in a method symbol, its type arguments will be re-inferred and the re-inferred method will be returned. Verifies that an argument's nullability is compatible with its parameter's on the way in. Returns if this is an assignment forbidden by DisallowNullAttribute, otherwise . Verifies that outbound assignments (from parameter to argument) are safe and tracks those assignments (or learns from post-condition attributes) Learn from postconditions on a by-value or 'in' argument. Return top-level nullability for the expression. This method should be called on a limited set of expressions only. It should not be called on expressions tracked by flow analysis other than which is an expression specifically created in NullableWalker to represent the flow analysis state. Returns the expression without the top-most conversion plus the conversion. If the expression is not a conversion, returns the original expression plus the Identity conversion. If `includeExplicitConversions` is true, implicit and explicit conversions are considered. If `includeExplicitConversions` is false only implicit conversions are considered and if the expression is an explicit conversion, the expression is returned as is, with the Identity conversion. (Currently, the only visit method that passes `includeExplicitConversions: true` is VisitConversion. All other callers are handling implicit conversions only.) Returns true if the expression should be used as the source when calculating a conversion from this expression, rather than using the type (with nullability) calculated by visiting this expression. Typically, that means expressions that do not have an explicit type but there are several other cases as well. (See expressions handled in ClassifyImplicitBuiltInConversionFromExpression.) Adjust declared type based on inferred nullability at the point of reference. Gets the corresponding member for a symbol from initial binding to match an updated receiver type in NullableWalker. For instance, this will map from List<string~>.Add(string~) to List<string?>.Add(string?) in the following example: string s = null; var list = new[] { s }.ToList(); list.Add(null); Visit an expression. If an explicit target type is provided, the expression is converted to that type. This method should be called whenever an expression may contain an implicit conversion, even if that conversion was omitted from the bound tree, so the conversion can be re-classified with nullability. Set the nullability of tuple elements for tuples at the point of construction. If is true, the tuple was constructed with an explicit 'new ValueTuple' call, in which case the 8-th element, if any, represents the 'Rest' field. Gets the conversion node for passing to VisitConversion, if one should be passed. Apply the conversion to the type of the operand and return the resulting type. If the operand does not have an explicit type, the operand expression is used. If , the incoming conversion is assumed to be from binding and will be re-calculated, this time considering nullability. Note that the conversion calculation considers nested nullability only. The caller is responsible for checking the top-level nullability of the type returned by this method. If , the nullability of any members of the operand will be copied to the converted result when possible. If , indicates that the "non-safety" diagnostic should be given for an invalid conversion. Return the return type for a lifted operator, given the nullability state of its operands. When the allowed output of a property/indexer is not-null but the allowed input is maybe-null, we store a not-null value instead. This way, assignment of a legal input value results in a legal output value. This adjustment doesn't apply to oblivious properties/indexers. Return the sub-expressions for the righthand side of a deconstruction assignment. cf. LocalRewriter.GetRightParts. Report warning passing argument where nested nullability does not match parameter (e.g.: calling `void F(object[] o)` with `F(new[] { maybeNull })`). A bit array containing the nullability of variables associated with a method scope. If the method is a nested function (a lambda or a local function), there is a reference to the corresponding instance for the containing method scope. The instances in the chain are associated with a corresponding chain, and the field in this type matches . Produce a duplicate of this flow analysis state. Defines the starting state used in the local function body to produce diagnostics and determine types. A symbol to be used as a placeholder for an instance being constructed by , or the input expression of a pattern-matching operation. It is used to track the state of an expression, such as members being initialized. The int key corresponds to . The snapshot array should be sorted in ascending order by the position tuple element in order for the binary search algorithm to function correctly. Contains the map of expression and original symbol to reinferred symbols, used by the optional rewriter phase of the compiler. Lambda symbols are mapped to the NameTypeSymbol of the delegate type they were reinferred to, and are stored with a null node. The LambdaSymbol itself is position-independent, and does not need any more information to serve as a key. All other symbol types are stored mapped to exactly the same type as was provided. Shared walker states are the parts of the walker state that are not unique at a single position, but are instead used by all snapshots. Each shared state corresponds to one invocation of Analyze, so entering a lambda or local function will create a new state here. The indexes in this array correspond to . Snapshots are kept in a dictionary of position -> snapshot at that position. These are stored in descending order. Every walker is walking a specific symbol, and can potentially walk each symbol multiple times to get to a stable state. Each of these symbols gets a single shared state slot, which this dictionary keeps track of. These slots correspond to indexes into . Contains the shared state used to restore the walker at a specific point Contains a snapshot of the state of the NullableWalker at any given point of execution, used for restoring the walker to a specific point for speculatively analyzing a piece of code that does not appear in the original tree. An immutable copy of . Unique identifier in the chain of nested VariablesSnapshot instances. The value starts at 0 for the outermost method and increases at each nested function. VariablesSnapshot instance for containing method, or null if this is the outermost method. Symbol that contains this set of variables. This is typically a method but may be a field when analyzing a field initializer. The symbol may be null at the outermost scope when analyzing an attribute argument value or a parameter default value. Mapping from variable to slot. Mapping from local or parameter to inferred type. A collection of variables associated with a method scope. For a particular method, the variables may contain parameters and locals and any fields from other variables in the collection. If the method is a nested function (a lambda or a local function), there is a reference to the variables collection at the containing method scope. The outermost scope may also contain variables for static fields. Each variable (parameter, local, or field of other variable) must be associated with the variables collection for that method where the parameter or local are declared, even if the variable is used in a nested scope. Unique identifier in the chain of nested Variables instances. The value starts at 0 for the outermost method and increases at each nested function. Variables instance for containing method, or null if this is the outermost method. Symbol that contains this set of variables. This is typically a method but may be a field when analyzing a field initializer. The symbol may be null at the outermost scope when analyzing an attribute argument value or a parameter default value. A mapping from local variables to the index of their slot in a flow analysis local state. The inferred type at the point of declaration of var locals and parameters. A mapping from the local variable slot to the symbol for the local variable itself. The first slot, slot 0, is reserved for indicating reachability, so the first tracked variable will be given slot 1. When referring to VariableIdentifier.ContainingSlot, slot 0 indicates that the variable in VariableIdentifier.Symbol is a root, i.e. not nested within another tracked variable. Slots less than 0 are illegal. Learn something about the input from a test of a given expression against a given pattern. The given state is updated to note that any slots that are tested against `null` may be null. Learn from any constant null patterns appearing in the pattern. Type type of the input expression (before nullable analysis). Used to determine which types can contain null. A region analysis walker that records reads and writes of all variables, both inside and outside the region. Note that a variable is read. The variable If variable.Kind is RangeVariable, its underlying lambda parameter. Else null. When we read a field from a struct, the receiver isn't seen as being read until we get to the end of the field access expression, because we only read the relevant piece of the struct. But we want the receiver to be considered to be read in the region in that case. For example, if an rvalue expression is x.y.z and the region is x.y, we want x to be included in the ReadInside set. That is implemented here. Compute the underlying lambda parameter symbol for a range variable, if any. The bound node for the expansion of the range variable Represents region analysis context attributes such as compilation, region, etc... Compilation to use Containing symbol if available, null otherwise Bound node, not null Region to be used Region to be used True if the input was bad, such as no first and last nodes Construct context A region analysis walker that computes whether or not the region completes normally. It does this by determining if the point at which the region ends is reachable. An analysis that computes all cases where the address is taken of a variable that has not yet been assigned An analysis that computes the set of variables that may be used before being assigned anywhere within a method. A region analysis walker that records declared variables. Record declared variables in the pattern. Specifies the language version. C# language version 1 C# language version 2 C# language version 3 Features: LINQ. C# language version 4 Features: dynamic. C# language version 5 Features: async, caller info attributes. C# language version 6 Features: Using of a static class Exception filters Await in catch/finally blocks Auto-property initializers Expression-bodied methods and properties Null-propagating operator ?. String interpolation nameof operator Dictionary initializer C# language version 7.0 Features: Out variables Pattern-matching Tuples Deconstruction Discards Local functions Digit separators Ref returns and locals Generalized async return types More expression-bodied members Throw expressions C# language version 7.1 Features: Async Main Default literal Inferred tuple element names Pattern-matching with generics C# language version 7.2 Features: Ref readonly Ref and readonly structs Ref extensions Conditional ref operator Private protected Digit separators after base specifier Non-trailing named arguments C# language version 7.3 Features: Indexing fixed fields does not require pinning ref local variables may be reassigned stackalloc arrays support initializers More types support the fixed statement Enhanced generic constraints Tuples support == and != Attach attributes to the backing fields for auto-implemented properties Method overload resolution improvements when arguments differ by 'in' Extend expression variables in initializers Improved overload candidates New compiler options (-publicsign and -pathmap) C# language version 8.0 Features: Readonly members Default interface methods Pattern matching enhancements (switch expressions, property patterns, tuple patterns, and positional patterns) Using declarations Static local functions Disposable ref structs Nullable reference types Asynchronous streams Asynchronous disposable Indices and ranges Null-coalescing assignment Unmanaged constructed types Stackalloc in nested expressions Enhancement of interpolated verbatim strings C# language version 9.0 Features: Records Init only setters Top-level statements Pattern matching enhancements Native sized integers Function pointers Suppress emitting localsinit flag Target-typed new expressions Static anonymous functions Target-typed conditional expressions Covariant return types Extension GetEnumerator support for foreach loops Lambda discard parameters Attributes on local functions Module initializers New features for partial methods C# language version 10.0 Features: Record structs Global using directives Lambda improvements Improved definite assignment Constant interpolated strings Mix declarations and variables in deconstruction Extended property patterns Sealed record ToString Source Generator v2 APIs Method-level AsyncMethodBuilder C# language version 11.0
Features: Raw string literals Static abstract members in interfaces Generic attributes Newlines in interpolations List-patterns Required members Span<char> constant pattern Struct auto-default Nameof(parameter) Checked user-defined operators UTF-8 string literals Unsigned right-shift operator Relaxed shift operator Ref fields File-local types
C# language version 12.0
Features: Primary constructors Using aliases for any types Nameof accessing instance members Inline arrays Collection expressions Ref readonly parameters Lambda optional parameters
C# language version 13.0
Features: Escape character Method group natural type improvements `Lock` object Implicit indexer access in object initializers `params` collections ref/unsafe in iterators/async `allows ref struct` constraint Partial properties
The latest major supported version. Preview of the next language version. The latest supported version of the language. The default language version, which is the latest supported version. Usages of: - TestOptions.RegularNext, - LanguageVersionFacts.CSharpNext, - Microsoft.CodeAnalysis.CSharp.Shared.Extensions.LanguageVersionExtensions.CSharpNext will be replaced with: - TestOptions.RegularN, - LanguageVersion.CSharpN, - LanguageVersion.CSharpN when language version N is introduced. Displays the version number in the format expected on the command-line (/langver flag). For instance, "6", "7.0", "7.1", "latest". Try parse a from a string input, returning default if input was null. Map a language version (such as Default, Latest, or CSharpN) to a specific version (CSharpM). Inference of tuple element names was added in C# 7.1 The purpose of this rewriter is to replace await-containing catch and finally handlers with surrogate replacements that keep actual handler code in regular code blocks. That allows these constructs to be further lowered at the async lowering pass. Lower a block of code by performing local rewritings. The goal is to not have exception handlers that contain awaits in them. 1) Await containing finally blocks: The general strategy is to rewrite await containing handlers into synthetic handlers. Synthetic handlers are not handlers in IL sense so it is ok to have awaits in them. Since synthetic handlers are just blocks, we have to deal with pending exception/branch/return manually (this is the hard part of the rewrite). try{ code; }finally{ handler; } Into ===> Exception ex = null; int pendingBranch = 0; try{ code; // any gotos/returns are rewritten to code that pends the necessary info and goes to finallyLabel goto finallyLabel; }catch (ex){ // essentially pend the currently active exception }; finallyLabel: { handler; if (ex != null) throw ex; // unpend the exception unpend branches/return } 2) Await containing catches: try{ code; }catch (Exception ex){ handler; throw; } Into ===> Object pendingException; int pendingCatch = 0; try{ code; }catch (Exception temp){ // essentially pend the currently active exception pendingException = temp; pendingCatch = 1; }; switch(pendingCatch): { case 1: { Exception ex = (Exception)pendingException; handler; throw pendingException } } Rewrites Try/Catch part of the Try/Catch/Finally Analyzes method body for try blocks with awaits in finally blocks Also collects labels that such blocks contain. Returns true if a finally of the given try contains awaits Returns true if a catch contains awaits Returns true if body contains await in a finally block. Labels reachable from within this frame without invoking its finally. null if there are no such labels. Additional information for rewriting an async-iterator. Produces a MoveNext() method for an async-iterator method. Compared to an async method, this handles rewriting `yield return` (with states decreasing from -3) and `yield break`, and adds special handling for `try` to allow disposal. `await` is handled like in async methods (with states 0 and up). Where should we jump to to continue the execution of disposal path. Initially, this is the method's return value label (). Inside a `try` or `catch` with a `finally`, we'll use the label directly preceding the `finally`. Inside a `try` or `catch` with an extracted `finally`, we will use the label preceding the extracted `finally`. Inside a `finally`, we'll have no/null label (disposal continues without a jump). We use _exprReturnLabel for normal end of method (ie. no more values) and `yield break;`. We use _exprReturnLabelTrue for `yield return;`. States for `yield return` are decreasing from . Lower the body, adding an entry state (-3) at the start, so that we can differentiate an async-iterator that was never moved forward with MoveNextAsync() from one that is running (-1). Then we can guard against some bad usages of DisposeAsync. An async-iterator state machine has a flag indicating "dispose mode". We enter dispose mode by calling DisposeAsync() when the state machine is paused on a `yield return`. DisposeAsync() will resume execution of the state machine from that state (using existing dispatch mechanism to restore execution from a given state, without executing other code to get there). From there, we don't want normal code flow: - from `yield return` within a try, we'll jump to its `finally` if it has one (or method exit) - after finishing a `finally` within a `finally`, we'll continue - after finishing a `finally` within a `try`, jump to the its `finally` if it has one (or method exit) Some `finally` clauses may have already been rewritten and extracted to a plain block (). In those cases, we saved the finally-entry label in . Some `finally` clauses may have already been rewritten and extracted to a plain block (). The extracted block will have been wrapped as a so that we can process it as a `finally` block here. Async methods have both a return type (void, Task, or Task<T>) and a 'result' type, which is the operand type of any return expressions in the async method. The result type is void in the case of Task-returning and void-returning async methods, and T in the case of Task<T>-returning async methods. System.Runtime.CompilerServices provides a collection of async method builders that are used in the generated code of async methods to create and manipulate the async method's task. There are three distinct async method builder types, one of each async return type: AsyncVoidMethodBuilder, AsyncTaskMethodBuilder, and AsyncTaskMethodBuilder<T>. AsyncMethodBuilderMemberCollection provides a common mechanism for accessing the well-known members of each async method builder type. This avoids having to inspect the return style of the current async method to pick the right async method builder member during async rewriting. The builder's constructed type. The result type of the constructed task: T for Task<T>, void otherwise. Create an instance of the method builder. Binds an exception to the method builder. Marks the method builder as successfully completed, and sets the result if method is Task<T>-returning. Schedules the state machine to proceed to the next action when the specified awaiter completes. Schedules the state machine to proceed to the next action when the specified awaiter completes. This method can be called from partially trusted code. Begins running the builder with the associated state machine. Associates the builder with the specified state machine. Get the constructed task for a Task-returning or Task<T>-returning async method. True if generic method constraints should be checked at the call-site. Produces a MoveNext() method for an async method. The method being rewritten. The field of the generated async class used to store the async method builder: an instance of , , or depending on the return type of the async method. A collection of well-known members for the current async method builder. The exprReturnLabel is used to label the return handling code at the end of the async state-machine method. Return expressions are rewritten as unconditional branches to exprReturnLabel. The label containing a return from the method when the async method has not completed. The field of the generated async class used in generic task returning async methods to store the value of rewritten return expressions. The return-handling code then uses SetResult on the async method builder to make the result available to the caller. Generate the body for MoveNext(). This rewriter rewrites an async-iterator method. See async-streams.md for design overview. Generates the `ValueTask<bool> MoveNextAsync()` method. Prepares most of the parts for MoveNextAsync() and DisposeAsync() methods. Generates the `ValueTask IAsyncDisposable.DisposeAsync()` method. The DisposeAsync method should not be called from states -1 (running) or 0-and-up (awaits). Generates the Current property. Generates the GetAsyncEnumerator method. Rewrite an async method into a state machine type. Returns true if all types and members we need are present and good Note: do not use a static/singleton instance of this type, as it holds state. The class that represents a translated async or async-iterator method. The rewriter for removing lambda expressions from method bodies and introducing closure classes as containers for captured variables along the lines of the example in section 6.5.3 of the C# language specification. A closure is the lowered form of a nested function, consisting of a synthesized method and a set of environments containing the captured variables. The entry point is the public method . It operates as follows: First, an analysis of the whole method body is performed that determines which variables are captured, what their scopes are, and what the nesting relationship is between scopes that have captured variables. The result of this analysis is left in . Then we make a frame, or compiler-generated class, represented by an instance of for each scope with captured variables. The generated frames are kept in . Each frame is given a single field for each captured variable in the corresponding scope. These are maintained in . Next, we walk and rewrite the input bound tree, keeping track of the following: (1) The current set of active frame pointers, in (2) The current method being processed (this changes within a lambda's body), in (3) The "this" symbol for the current method in , and (4) The symbol that is used to access the innermost frame pointer (it could be a local variable or "this" parameter) Lastly, we visit the top-level method and each of the lowered methods to rewrite references (e.g., calls and delegate conversions) to local functions. We visit references to local functions separately from lambdas because we may see the reference before we lower the target local function. Lambdas, on the other hand, are always convertible as they are being lowered. There are a few key transformations done in the rewriting. (1) Lambda expressions are turned into delegate creation expressions, and the body of the lambda is moved into a new, compiler-generated method of a selected frame class. (2) On entry to a scope with captured variables, we create a frame object and store it in a local variable. (3) References to captured variables are transformed into references to fields of a frame class. In addition, the rewriting deposits into a (, ) pair for each generated method. produces its output in two forms. First, it returns a new bound statement for the caller to use for the body of the original method. Second, it returns a collection of (, ) pairs for additional methods that the lambda rewriter produced. These additional methods contain the bodies of the lambdas moved into ordinary methods of their respective frame classes, and the caller is responsible for processing them just as it does with the returned bound node. For example, the caller will typically perform iterator method and asynchronous method transformations, and emit IL instructions into an assembly. Perform a first analysis pass in preparation for removing all lambdas from a method body. The entry point is Analyze. The results of analysis are placed in the fields seenLambda, blockParent, variableBlock, captured, and captures. If a local function is in the set, at some point in the code it is converted to a delegate and should then not be optimized to a struct closure. Also contains all lambdas (as they are converted to delegates implicitly). True if the method signature can be rewritten to contain ref/out parameters. The root of the scope tree for this method. Must be called only after has been calculated. Finds the most optimal capture environment to place a closure in. This roughly corresponds to the 'highest' Scope in the tree where all the captured variables for this closure are in scope. This minimizes the number of indirections we may have to traverse to access captured variables. We may have ended up with a closure environment containing only 'this'. This is basically equivalent to the containing type itself, so we can inline the 'this' parameter into environments that reference this one or lower closures directly onto the containing type. Calculates all functions which directly or indirectly capture a scope's variables. Must be called only after and . In order to reduce allocations, merge environments into a parent environment when it is safe to do so. This must be done whilst preserving semantics. We also have to make sure not to extend the life of any variable. This means that we can only merge an environment into its parent if exactly the same closures directly or indirectly reference both environments. Walk up the scope tree looking for a variable declaration. Find the parent of the corresponding to the given . Finds a with a matching as the one given. Walk up the scope tree looking for a nested function. A tuple of the found and the it was found in. Finds a with a matching original symbol somewhere in the given scope or nested scopes. This is the core node for a Scope tree, which stores all semantically meaningful information about declared variables, closures, and environments in each scope. It can be thought of as the essence of the bound tree -- stripping away many of the unnecessary details stored in the bound tree and just leaving the pieces that are important for closure conversion. The root scope is the method scope for the method being analyzed and has a null . A list of all nested functions (all lambdas and local functions) declared in this scope. A list of all locals or parameters that were declared in this scope and captured in this scope or nested scopes. "Declared" refers to the start of the variable lifetime (which, at this point in lowering, should be equivalent to lexical scope). It's important that this is a set and that enumeration order is deterministic. We loop over this list to generate proxies and if we loop out of order this will cause non-deterministic compilation, and if we generate duplicate proxies we'll generate wasteful code in the best case and incorrect code in the worst. The bound node representing this scope. This roughly corresponds to the bound node for the block declaring locals for this scope, although parameters of methods/functions are introduced into their Body's scope and do not get their own scope. The nested function that this scope is nested inside. Null if this scope is not nested inside a nested function. Environment created in this scope to hold . At the moment, all variables declared in the same scope always get assigned to the same environment. Is it safe to move any of the variables declared in this scope to the parent scope, or would doing so change the meaning of the program? The NestedFunction type represents a lambda or local function and stores information related to that function. After initially building the tree the only information available is and . Subsequent passes are responsible for translating captured variables into captured environments and for calculating the rewritten signature of the method. The method symbol for the original lambda or local function. Syntax for the block of the nested function. True if this function directly or transitively captures 'this' (captures a local function which directly or indirectly captures 'this'). Calculated in . Assigned by . True if this environment references a class environment declared in a higher scope. Visit all nested functions in all nested scopes and run the . Visit all the functions and return true when the returns true. Otherwise, returns false. Visit the tree with the given root and run the Builds a tree of nodes corresponding to a given method. visits the bound tree and translates information from the bound tree about variable scope, declared variables, and variable captures into the resulting tree. At the same time it sets for each Scope. This is done by looking for s and s that jump from a point after the beginning of a , to a before the start of the scope, but after the start of . All loops have been converted to gotos and labels by this stage, so we do not have to visit them to do so. Similarly all s have been converted to s, so we do not have to visit them. Do not set this directly, except when setting the root scope. Instead use or . Null if we're not inside a nested function, otherwise the nearest nested function. A mapping from all captured vars to the scope they were declared in. This is used when recording captured variables as we must know what the lifetime of a captured variable is to determine the lifetime of its capture environment. If a local function is in the set, at some point in the code it is converted to a delegate and should then not be optimized to a struct closure. Also contains all lambdas (as they are converted to delegates implicitly). For every label visited so far, this dictionary maps to a list of all scopes either visited so far, or currently being visited, that are both after the label, and are on the same level of the scope tree as the label. Contains a list of the labels visited so far for each scope. The outer ArrayBuilder is a stack representing the chain of scopes from the root scope to the current scope, and for each item on the stack, the ArrayBuilder is the list of the labels visited so far for the scope. Used by to determine which labels a new child scope appears after. This is where we calculate . is always true unless we jump from after the beginning of a scope, to a point in between the beginning of the parent scope, and the beginning of the scope Add a diagnostic if the type of a captured variable is a restricted type Create a new nested scope under the current scope, and replace with the new scope, or reuse the current scope if there's no change in the bound node for the nested scope. Records the given locals as declared in the aforementioned scope. Creates a new nested scope which is a child of , and replaces with the new scope Requires that scope is either the same as , or is the of . Returns immediately in the first case, Replaces with scope in the second. Temporary bag for methods synthesized by the rewriting. Added to at the end of rewriting. TODO(https://github.com/dotnet/roslyn/projects/26): Delete this. This should only be used by which hasn't had logic to move the proxy analysis into , where the could be walked to build the proxy list. Rewrite the given node to eliminate lambda expressions. Also returned are the method symbols and their bound bodies for the extracted lambda bodies. These would typically be emitted by the caller such as MethodBodyCompiler. See this class' documentation for a more thorough explanation of the algorithm and its use by clients. The bound node to be rewritten The type of the top-most frame The "this" parameter in the top-most frame, or null if static method The containing method of the node to be rewritten Index of the method symbol in its containing type member list. If this is non-null, then will be treated as this for uses of parent symbols. For use in EE. Information on lambdas defined in needed for debugging. EnC rude edit information on lambdas defined in . Information on closures defined in needed for debugging. Slot allocator. The caller's buffer into which we produce additional methods to be emitted by the caller Diagnostic bag for diagnostics The set of original locals that should be assigned to proxies if lifted Adds synthesized types to the compilation state and creates hoisted fields for all locals captured by the environments. Synthesize closure methods for all nested functions. Get the static container for closures or create one if one doesn't already exist. associate the frame with the first lambda that caused it to exist. we need to associate this with some syntax. unfortunately either containing method or containing class could be synthetic therefore could have no syntax. Produce a bound expression representing a pointer to a frame of a particular frame type. The syntax to attach to the bound nodes produced The type of frame to be returned A bound node that computes the pointer to the required frame Produce a bound expression representing a pointer to a frame of a particular frame class. Note that for generic frames, the frameClass parameter is the generic definition, but the resulting expression will be constructed with the current type parameters. The syntax to attach to the bound nodes produced The class type of frame to be returned A bound node that computes the pointer to the required frame Introduce a frame around the translation of the given node. The node whose translation should be translated to contain a frame The environment for the translated node A function that computes the translation of the node. It receives lists of added statements and added symbols The translated statement, as returned from F Rewrites a reference to an unlowered local function to the newly lowered local function. Substitutes references from old type arguments to new type arguments in the lowered methods. Consider the following method: void M() { void L<T>(T t) => Console.Write(t); L("A"); } In this example, L<T> is a local function that will be lowered into its own method and the type parameter T will be alpha renamed to something else (let's call it T'). In this case, all references to the original type parameter T in L must be rewritten to the renamed parameter, T'. The closure doesn't declare any variables, and is never converted to a delegate. Lambdas are emitted directly to the containing class as a static method. The closure doesn't declare any variables, and is converted to a delegate at least once. Display class is a singleton and may be shared with other top-level methods. The closure only contains a reference to the containing class instance ("this"). We don't emit a display class, lambdas are emitted directly to the containing class as its instance methods. General closure. Display class may only contain lambdas defined in the same top-level method. Visit the expression, but do so in a way that ensures that its type is precise. That means that any sometimes-unnecessary conversions (such as an implicit reference conversion) are retained. A field of a frame class that represents a variable that has been captured in a lambda. When the containing top-level method body is updated we don't need to attempt to update field (it has no "body"). The synthesized type added to a compilation to hold captured variables for closures. The closest method/lambda that this frame is originally from. Null if nongeneric static closure. Useful because this frame's type parameters are constructed from this method and all methods containing this method. All fields should have already been added as synthesized members on the , so we don't want to duplicate them here. A method that results from the translation of a single lambda expression. This pass detects and reports diagnostics that do not affect lambda convertibility. This part of the partial class focuses on features that cannot be used in expression trees. CAVEAT: Errors may be produced for ObsoleteAttribute, but such errors don't affect lambda convertibility. This pass detects and reports diagnostics that do not affect lambda convertibility. This part of the partial class focuses on expression and operator warnings. Called when a local represents an out variable declaration. Its syntax is of type DeclarationExpressionSyntax. This is for when we are taking the address of a field. Distinguish from . This is for when we are dotting into a field. Distinguish from . NOTE: dev11 also calls this on string initializers in fixed statements, but never accomplishes anything since string is a reference type. This is probably a bug, but fixing it would be a breaking change. Based on OutputContext::IsNonAgileField. Returns the expression if the statement is actually an expression (ExpressionStatementSyntax with no trailing semicolon). This type provides means for instrumenting compiled methods for dynamic analysis. It can be combined with other s. Utility class, provides a convenient way of combining various s in a chain, allowing each of them to apply specific instrumentations in particular order. Default implementation of all APIs delegates to the "previous" passed as a parameter to the constructor of this class. Usually, derived types are going to let the base (this class) to do its work first and then operate on the result they get back. Returns with instrumenter set to . This type is responsible for adding debugging sequence points for the executable code. It can be combined with other s. Usually, this class should be the root of the chain in order to ensure sound debugging experience for the instrumented code. In other words, sequence points are typically applied after all other changes. A singleton object that performs only one type of instrumentation - addition of debugging sequence points. Add sequence point |here|: foreach (Type var in |expr|) { } Hit once, before looping begins. Add sequence point |here|: |foreach| (Type var in expr) { } Hit once, before looping begins. Add sequence point |here|: foreach (|Type var| in expr) { } Hit every iteration. Manages instrumentation state. Used to temporarily suspend instrumentation, for example when lowering expression tree. Current instrumenter. A base class for components that instrument various portions of executable code. It provides a set of APIs that are called by to instrument specific portions of the code. These APIs have at least two parameters: - original bound node produced by the for the relevant portion of the code; - rewritten bound node created by the for the original node. The APIs are expected to return new state of the rewritten node, after they apply appropriate modifications, if any. The base class provides default implementation for all APIs, which simply returns the rewritten node. The singleton NoOp instrumenter, can be used to terminate the chain of s. Called before the statements of the block are lowered. Instruments block. Original block. Local rewriter. Local symbols to be added to of the resulting block. Node to be added to the beginning of the statement list of the instrumented block. Node to be added at the end of the statement list of the instrumented block. Similarly to an interceptor, gives the instrumenter an opportunity to adjust call target, receiver and arguments. Unlike interceptors, called also for constructor calls (with being null). Instrument a switch case when clause, which is translated to a conditional branch to the body of the case block. the bound expression of the when clause the lowered conditional branch into the case block Instrument the expression of a switch arm of a switch expression. Implements instrumentation for . Adds calls to well-known instrumentation helpers defined by to the bodies of instrumented methods. These allow tracing method entries, returns and writes to user-defined local variables and parameters. The instrumenter also adds the ability to stitch calls to MoveNext methods of a state machine that are executed as continuations of the same instance of the state machine but potentially from multiple different threads. The instrumentation introduces several new bound nodes: 1) This node is attached to a that represents the lowered body of an instrumented method, lambda or local function. It defines a local variable used to store instrumentation context and prologue and epilogue. with block instrumentation is eventually lowered to: [[prologue]] try { [[method body]] } finally { [[epilogue]] } The prologue is: var $context = LocalStateTracker.LogXyzEntry($ids); Where Xyz is a combination of StateMachine and either Method or Lambda, and $ids is the corresponding set of arguments identifying the context. LogXyzEntry methods are static factory methods for . The tracker type is a ref struct. It can only be allocated on the stack and accessed only directly from the declaring method (no lifting). For member methods $ids is a single argument that is the method token. For lambdas and local functions the token of the lambda method is passed in addition to the containing method token. This allows the logger to determine which lambda belongs to which method, as that it not apparent from metadata. For state machines, the state machine instance id is passed. The instance id is stored on a new synthesized field of the state machine type added by the instrumentation that is initialized to a unique number when the state machine type is instantiated. The number is provided by . The epilogue is simply: $context.LogReturn(); 2) This node represents a reference to a synthesized state machine instance id field of the state machine. Lowered to a field read during state machine lowering. 3) / Represents id of a user-defined parameter/local. Emitted as ldc.i4 of either the parameter/local ordinal if the variable was not lifted, or the token of its hoisted field. Each local variable write is followed by a call to one of the LogLocalStoreXyz or LogParameterStoreXyz instance methods on $context. Writes to locals passed to a function call site by-ref are logged after the call returns. LogParameterStoreXyz are emitted on explicit parameter assignment and also at the beginning of a method with parameters to log their initial values. The loggers are specialized to handle all kinds of variable types efficiently (without boxing). Specialized loggers are also used to track local variable aliases via ref assignments. Represents instrumentation scope - i.e. method, lambda or local function body. We define a new (of LocalStoreTracker well-known type) in each scope, so that this variable is always directly accessible within any instrumented code and always stack-allocated. Type of the variable that holds on the instrumentation context (LocalStateTracker). Implements instrumentation for . - Adds a static writable field of type to PrivateImplementationDetails. The host can set this token via Reflection before executing the compiled code. - Inserts calls to on the host token into each method, loop or goto. - Replaces any tokens passed as arguments with the host token. - Replaces calls to methods that do not take as the last parameter with matching overloads that do and passes it the host token. Implements instrumentation for . - Adds a static writable field of type to PrivateImplementationDetails. The host can set this token via Reflection before executing the compiled code. - Inserts calls to on the host token into each method, loop or goto. - Replaces any tokens passed as arguments with the host token. - Replaces calls to methods that do not take as the last parameter with matching overloads that do and passes it the host token. Find an overload whose last parameter is and the parameter types and ref kinds of all other parameters match those of . Implements instrumentation for . Implements instrumentation for . The constructor of the class that is the translation of an iterator method. A synthesized Finally method containing finalization code for a resumable try statement. Finalization code for such try may run when: 1) control flow goes out of try scope by dropping through 2) control flow goes out of try scope by conditionally or unconditionally branching outside of one ore more try/finally frames. 3) enumerator is disposed by the owner. 4) enumerator is being disposed after an exception. It is easier to manage partial or complete finalization when every finally is factored out as a separate method. NOTE: Finally is a private void nonvirtual instance method with no parameters. It is a valid JIT inlining target as long as JIT may consider inlining profitable. The field of the generated iterator class that underlies the Current property. Tells us if a particular try contains yield returns When this is more that 0, returns are emitted as "methodValue = value; goto exitLabel;" The current iterator finally frame in the tree of finally frames. By default there is a root finally frame. Root frame does not have a handler, but may contain nested frames. Finally state of the next Finally frame if such created. Finally state is a negative decreasing number starting with -3. (-2 is used for something else). Root frame has finally state -1. The Finally state is the state that we are in when "between states". Regular states are positive and are the only states that can be resumed to. The purpose of distinct finally states is to have enough information about which finally handlers must run when we need to finalize iterator after a fault. Produces a Try/Finally if frame has a handler (otherwise a regular block). Handler goes into the Finally. If there are nested frames, they are emitted into the try block. This way the handler for the current frame is guaranteed to run even if nested handlers throw exceptions. { switch(state) { case state1: case state2: case state3: case state4: try { switch(state) { case state3: case state4: try { ... more nested state dispatches if any .... } finally { // handler for a try where state3 and state4 can be observed handler_3_4() } break; } } finally { // handler for a try where state1 and state2 can be observed handler_1_2() } break; case state5: ... another dispatch of nested states to their finally blocks ... break; } } Analyzes method body for yields in try blocks and labels that they contain. Returns true if given try or any of its nested try blocks contain yields Returns true if body contains yield returns within try blocks. Labels reachable from within this frame without invoking its finally. null if there are none such labels. Analyzes method body for labels. Rewrite an iterator method into a state machine class. Returns true if all types and members we need are present and good Check that the property and its getter exist and collect any use-site errors. Add IEnumerator<elementType> IEnumerable<elementType>.GetEnumerator() The class that represents a translated iterator method. This type helps rewrite the delegate creations that target static method groups to use a cached instance of delegate. Additional locals that will be added to the outermost block of the current method, lambda, or local function. This is used for inline array temporaries where the scope of the temporary must be at least as wide as the scope of references to that temporary. The original body of the current lambda or local function body, or null if not currently lowering a lambda. Lower a block of code by performing local rewritings. Return the translated node, or null if no code is necessary in the translation. Returns substitution currently used by the rewriter for a placeholder node. Each occurrence of the placeholder node is replaced with the node returned. Throws if there is no substitution. Sets substitution used by the rewriter for a placeholder node. Each occurrence of the placeholder node is replaced with the node returned. Throws if there is already a substitution. Removes substitution currently used by the rewriter for a placeholder node. Asserts if there isn't already a substitution. This function provides a false sense of security, it is likely going to surprise you when the requested member is missing. Recommendation: Do not use, use instead! If used, a unit-test with a missing member is absolutely a must have. This function provides a false sense of security, it is likely going to surprise you when the requested member is missing. Recommendation: Do not use, use instead! If used, a unit-test with a missing member is absolutely a must have. Returns true if the initializer is a field initializer which should be optimized out A common base class for lowering a decision dag. Get the builder for code in the given section of the switch. For an is-pattern expression, this is a singleton. The lowered decision dag. This includes all of the code to decide which pattern is matched, but not the code to assign to pattern variables and evaluate when clauses. The label in the code for the beginning of code for each node of the dag. A utility class that is used to scan a when clause to determine if it might assign a pattern variable declared in that case, directly or indirectly. Used to determine if we can skip the allocation of pattern-matching temporary variables and use user-declared pattern variables instead, because we can conclude that they are not mutated by a when clause while the pattern-matching automaton is running. If we have a type test followed by a cast to that type, and the types are reference types, then we can replace the pair of them by a conversion using `as` and a null check. true if we generated code for the test Generate a switch dispatch for a contiguous sequence of dag nodes if applicable. Returns true if it was applicable. Push the set of equality tests down to the level of the leaves in the value dispatch tree. A comparer for sorting cases containing values of type float, double, or decimal. Checks whether we are generating a hash table based string switch and we need to generate a new helper method for computing string hash value. Creates the method if needed. Translate the decision dag for node, given that it will be followed by the translation for nextNode. A node in a tree representing the form of a generated decision tree for classifying an input value. A node representing the dispatch by value (equality). This corresponds to a classical C switch statement, except that it also handles values of type float, double, decimal, and string. A node representing a final destination that requires no further dispatch. A node representing a dispatch based on a relational test of the input value by some constant. Nodes of this kind are required to be height-balanced when constructed, so that when the full decision tree is produced it generates a balanced tree of comparisons. The shape of the tree keeps tests for lower values on the left and tests for higher values on the right: For and , the branch is and the branch is ; for and it is reversed. See for where that is computed. The side of the test handling lower values. The true side for < and <=, the false side for > and >=. The side of the test handling higher values. The false side for < and <=, the true side for > and >=. Is the operator among those for which is ? A common base class for lowering constructs that use pattern-matching. True if we should produce instrumentation and sequence points, which we do for a switch statement and a switch expression. This affects - whether or not we invoke the instrumentation APIs - production of sequence points - synthesized local variable kind The temp variables must be long lived in a switch statement since their lifetime spans across sequence points. Try setting a user-declared variable (given by its accessing expression) to be used for a pattern-matching temporary variable. Returns true when not already assigned. The return value of this method is typically ignored by the caller as once we have made an assignment we can keep it (we keep the first assignment we find), but we return a success bool to emphasize that the assignment is not unconditional. Return the side-effect expression corresponding to an evaluation. Return the boolean expression to be evaluated for the given test. Returns `null` if the test is trivially true. Lower a test followed by an evaluation into a side-effect followed by a test. This permits us to optimize a type test followed by a cast into an `as` expression followed by a null check. Returns true if the optimization applies and the results are placed into and . The caller should place the side-effect before the test in the generated code. true if the optimization is applied Produce assignment of the input expression. This method is also responsible for assigning variables for some pattern-matching temps that can be shared with user variables. We have a decision dag whose input is a tuple literal, and the decision dag does not need the tuple itself. We rewrite the decision dag into one which doesn't touch the tuple, but instead works directly with the values that have been stored in temps. This permits the caller to avoid creation of the tuple object itself. We also emit assignments of the tuple values into their corresponding temps. An expression that produces the value of the original input if needed by the caller. A new decision dag that does not reference the input directly Generates a lowered form of the assignment operator for the given left and right sub-expressions. Left and right sub-expressions must be in lowered form. Generates a lowered form of the assignment operator for the given left and right sub-expressions. Left and right sub-expressions must be in lowered form. Lower an await expression that has already had its components rewritten. A common base class for lowering the pattern switch statement and the pattern switch expression. Map from when clause's syntax to the lowered code for the matched pattern. The code for a section includes the code to assign to the pattern variables and evaluate the when clause. Since a when clause can yield a false value, it can jump back to a label in the lowered decision dag. Lower the given nodes into _loweredDecisionDag. Should only be called once per instance of this. This function provides a false sense of security, it is likely going to surprise you when the requested member is missing. Recommendation: Do not use, use instead! If used, a unit-test with a missing member is absolutely a must have. This function provides a false sense of security, it is likely going to surprise you when the requested member is missing. Recommendation: Do not use, use instead! If used, a unit-test with a missing member is absolutely a must have. Spec section 7.9: if the left operand is int or uint, mask the right operand with 0x1F; if the left operand is long or ulong, mask the right operand with 0x3F. This rather confusing method tries to reproduce the functionality of ExpressionBinder::bindPtrAddMul and ExpressionBinder::bindPtrMul. The basic idea is that we have a numeric expression, x, and a pointer type, T*, and we want to multiply x by sizeof(T). Unfortunately, we need to stick in some conversions to make everything work. 1) If x is an int, then convert it to an IntPtr (i.e. a native int). Dev10 offers no explanation (ExpressionBinder::bindPtrMul). 2) Do overload resolution based on the (possibly converted) type of X and int (the type of sizeof(T)). 3) If the result type of the chosen multiplication operator is signed, convert the product to IntPtr; otherwise, convert the product to UIntPtr. Visit a partial list of statements that possibly contain using declarations The array builder to append statements to The list of statements to visit The index of the to begin visiting at An of Visits a node that is possibly a The node to visit All statements in the block containing this node The current statement being visited in Set to true if this visited a node A The node being visited is not necessarily equal to statements[startIndex]. When traversing down a set of labels, we set node to the label.body and recurse, but statements[startIndex] still refers to the original parent label as we haven't actually moved down the original statement list No special capture of the receiver, unless arguments need to refer to it. For example, in case of a string interpolation handler. Used for a regular indexer compound assignment rewrite. Everything is going to be in a single setter call with a getter call inside its value argument. Only receiver and the indexes can be evaluated prior to evaluating the setter call. Used for situations when additional arbitrary side-effects are possibly involved. Think about deconstruction, etc. Visits all arguments of a method, doing any necessary rewriting for interpolated string handler conversions that might be present in the arguments and creating temps for any discard parameters. Rewrites arguments of an invocation according to the receiving method or indexer. It is assumed that each argument has already been lowered, but we may need additional rewriting for the arguments, such as re-ordering arguments based on map, etc. Patch refKinds for arguments that match 'in', 'ref', or 'ref readonly' parameters to have effective RefKind. For the purpose of further analysis we will mark the arguments as - - In if was originally passed as None and matches an 'in' or 'ref readonly' parameter - StrictIn if was originally passed as In or Ref and matches an 'in' or 'ref readonly' parameter - Ref if the argument is an interpolated string literal subject to an interpolated string handler conversion. No other types are patched here. Here and in the layers after the lowering we only care about None/notNone differences for the arguments Except for async stack spilling which needs to know whether arguments were originally passed as "In" and must obey "no copying" rule. Process tempStores and add them as side-effects to arguments where needed. The return value tells how many temps are actually needed. For unnecessary temps the corresponding temp store will be cleared. Returns true if the collection expression has a known length and that length should be used in the lowered code to avoid resizing the collection instance, or allocating intermediate storage, during construction. If the collection expression includes spreads, the spreads must be countable. The caller will need to delay adding elements and iterating spreads until the last spread has been evaluated, to determine the overall length of the collection. Therefore, this method only returns true if the number of preceding elements is below a maximum. Create and populate an array from a collection expression where the collection has a known length, although possibly including spreads. For the purpose of optimization, conversions to ReadOnlySpan and/or Span are known on the following types: System.Array, System.Span, System.ReadOnlySpan, System.Collections.Immutable.ImmutableArray, and System.Collections.Generic.List. Not-null if non-identity conversion was found. If is 'true', will only return 'true' with a conversion to Span. If is 'false', may return either a conversion to ReadOnlySpan or to Span, depending on the source type. For System.Array and 'false' argument for , only a conversion to ReadOnlySpan may be returned. For System.Array and 'true' argument for , only a conversion to Span may be returned. For System.Span, only a conversion to System.Span is may be returned. For System.ReadOnlySpan, only a conversion to System.ReadOnlySpan may be returned. For System.Collections.Immutable.ImmutableArray, only a conversion to System.ReadOnlySpan may be returned. For System.Collections.Generic.List, only a conversion to System.Span may be returned. We are assuming that the well-known types we are converting to/from do not have constraints on their type parameters. Verifies presence of methods necessary for the CopyTo optimization without performing mutating actions e.g. appending to side effects or locals builders. Create and populate an list from a collection expression. The collection may or may not have a known length. Returns true if the was lowered and transformed. The is not changed if this function returns false. In the expanded form of a compound assignment (or increment/decrement), the LHS appears multiple times. If we aren't careful, this can result in repeated side-effects. This creates (ordered) temps for all of the subexpressions that could result in side-effects and returns a side-effect-free expression that can be used in place of the LHS in the expanded form. The LHS sub-expression of the compound assignment (or increment/decrement). Populated with a list of assignment expressions that initialize the temporary locals. Populated with a list of temporary local symbols. True if the compound assignment is a dynamic operation. A side-effect-free expression representing the LHS. The returned node needs to be lowered but its children are already lowered. Variables local to current frame do not need temps when re-read multiple times as long as there is no code that may write to locals in between accesses and they are not captured. Example: l += goo(ref l); even though l is a local, we must access it via a temp since "goo(ref l)" may change it on between accesses. Note: In this.x++, this cannot change between reads. But in (this, ...) == (..., this.Mutate()) it can. If the condition has a constant value, then just use the selected branch. e.g. "true ? x : y" becomes "x". Helper method to generate a lowered conversion. Helper method to generate a lowered conversion from the given to the given . If we're converting a default parameter value to the parameter type, then the conversion can actually fail (e.g. if the default value was specified by an attribute and was, therefore, not checked by the compiler). Set acceptFailingConversion if you want to see default(rewrittenType) in such cases. The error will be suppressed only for conversions from or . If the nullable expression always has a value, returns the value, otherwise null. This is normally performed on a lowered expression, however for the purpose of tuples and tuple equality operators, we do this on a partially lowered expression in which conversions appearing at the top of the expression have not been lowered. If this method is updated to recognize more complex patterns, callers should be reviewed. Reports diagnostics and returns Conversion.NoConversion in case of missing runtime helpers. Reports diagnostics and returns Conversion.NoConversion in case of missing runtime helpers. Reports diagnostics and returns Conversion.NoConversion in case of missing runtime helpers. The left represents a tree of L-values. The structure of right can be missing parts of the tree on the left. The conversion holds nested conversions and deconstruction information, which matches the tree from the left, and it provides the information to fill in the missing parts of the tree from the right and convert it to the tree from the left. A bound sequence is returned which has different phases of side-effects: - the initialization phase includes side-effects from the left, followed by evaluations of the right - the deconstruction phase includes all the invocations of Deconstruct methods and tuple element accesses below a Deconstruct call - the conversion phase - the assignment phase This method recurses through leftTargets, right and conversion at the same time. As it does, it collects side-effects into the proper buckets (init, deconstructions, conversions, assignments). The side-effects from the right initially go into the init bucket. But once we started drilling into a Deconstruct invocation, subsequent side-effects from the right go into the deconstructions bucket (otherwise they would be evaluated out of order). Evaluate side effects into a temp, if any. Return the expression to give the value later. The argument to evaluate early. A store of the argument into a temp, if necessary, is added here. Any generated temps are added here. An expression evaluating the argument later (e.g. reading the temp), including a possible deferred user-defined conversion. Adds the side effects to effects and returns temporaries to access them. The caller is responsible for releasing the nested ArrayBuilders. The variables should be unlowered. If we have a WinRT type event, we need to encapsulate the adder call (which returns an EventRegistrationToken) with a call to WindowsRuntimeMarshal.AddEventHandler or RemoveEventHandler, but these require us to create a new Func representing the adder and another Action representing the Remover. The rewritten call looks something like: WindowsRuntimeMarshal.AddEventHandler<EventHandler> (new Func<EventHandler, EventRegistrationToken>(@object.add), new Action<EventRegistrationToken>(@object.remove), handler); Where @object is a compiler-generated local temp if needed. TODO: use or delete isDynamic. Converts access to a tuple instance into access into the underlying ValueTuple(s). For instance, tuple.Item8 produces fieldAccess(field=Item1, receiver=fieldAccess(field=Rest, receiver=ValueTuple for tuple)) Basically, what we need to know is, if an exception occurred within the fixed statement, would additional code in the current method be executed before its stack frame was popped? If two (or more) fixed statements are nested, then we want to avoid having the outer fixed statement re-traverse the lowered bound tree of the inner one. We accomplish this by having each fixed statement cache a set of unmatched gotos that can be reused by any containing fixed statements. Look for gotos without corresponding labels in the lowered body of a fixed statement. Assumes continue, break, etc have already been rewritten to gotos. pinned ref int pinnedTemp = ref v; // pinning managed ref int* ptr = (int*)&pinnedTemp; // unsafe cast to unmanaged ptr . . . ]]> pinned ref int pinnedTemp = ref v; // pinning managed ref int* ptr = (int*)&pinnedTemp; // unsafe cast to unmanaged ptr . . . ]]> fixed(char* ptr = stringVar){ ... } == becomes ===> pinned string pinnedTemp = stringVar; // pinning managed ref char* ptr = (char*)pinnedTemp; // unsafe cast to unmanaged ptr if (pinnedTemp != null) ptr += OffsetToStringData(); . . . pinned int[] pinnedTemp = arr; // pinning managed ref int* ptr = pinnedTemp != null && pinnedTemp.Length != 0 ? (int*)&pinnedTemp[0] : // unsafe cast to unmanaged ptr 0; . . . ]]> This is the entry point for foreach-loop lowering. It delegates to RewriteEnumeratorForEachStatement RewriteSingleDimensionalArrayForEachStatement RewriteMultiDimensionalArrayForEachStatement CanRewriteForEachAsFor We are diverging from the C# 4 spec (and Dev10) to follow the C# 5 spec. The iteration variable will be declared *inside* each loop iteration, rather than outside the loop. Lower a foreach loop that will enumerate a collection using an enumerator. There are three possible cases where we need disposal: - pattern-based disposal (we have a Dispose/DisposeAsync method) - interface-based disposal (the enumerator type converts to IDisposable/IAsyncDisposable) - we need to do a runtime check for IDisposable Finally block, or null if none should be emitted. Produce: await /* disposeCall */; Optionally apply a conversion to the receiver. If the receiver is of struct type and the method is an interface method, then skip the conversion. When we call the interface method directly - the code generator will detect it and generate a constrained virtual call. A syntax node to attach to the synthesized bound node. Receiver of method call. Method to invoke. Conversion to be applied to the receiver if not calling an interface method on a struct. Type of the receiver after applying the conversion. Lower a foreach loop that will enumerate a collection via indexing. NOTE: We're assuming that sequence points have already been generated. Otherwise, lowering to for-loops would generated spurious ones. Takes the expression for the current value of the iteration variable and either (1) assigns it into a local, or (2) deconstructs it into multiple locals (if there is a deconstruct step). Produces V v = /* expression */ or (D1 d1, ...) = /* expression */. Lower a foreach loop that will enumerate a single-dimensional array. A[] a = x; for (int p = 0; p < a.Length; p = p + 1) { V v = (V)a[p]; /* OR */ (D1 d1, ...) = (V)a[p]; // body } We will follow Dev10 in diverging from the C# 4 spec by ignoring Array's implementation of IEnumerable and just indexing into its elements. NOTE: We're assuming that sequence points have already been generated. Otherwise, lowering to for-loops would generated spurious ones. Lower a foreach loop that will enumerate a multi-dimensional array. A[...] a = x; int q_0 = a.GetUpperBound(0), q_1 = a.GetUpperBound(1), ...; for (int p_0 = a.GetLowerBound(0); p_0 <= q_0; p_0 = p_0 + 1) for (int p_1 = a.GetLowerBound(1); p_1 <= q_1; p_1 = p_1 + 1) ... { V v = (V)a[p_0, p_1, ...]; /* OR */ (D1 d1, ...) = (V)a[p_0, p_1, ...]; /* body */ } We will follow Dev10 in diverging from the C# 4 spec by ignoring Array's implementation of IEnumerable and just indexing into its elements. NOTE: We're assuming that sequence points have already been generated. Otherwise, lowering to nested for-loops would generated spurious ones. So that the binding info can return an appropriate SemanticInfo.Converted type for the collection expression of a foreach node, it is wrapped in a BoundConversion to the collection type in the initial bound tree. However, we may be able to optimize away (or entirely disregard) the conversion so we pull out the bound node for the underlying expression. Used to produce an expression translating to an integer offset according to the . The implementation should be in sync with . The lowered input for the translation An expression accessing the length of the indexing target. This should be a non-side-effecting operation. The translation strategy Determine the lowering strategy for translating a System.Index value to an integer offset value and prepare the lowered input for the translation process handled by . The implementation should be in sync with . A local rewriter for lowering an is-pattern expression. This handles the general case by lowering the decision dag, and returning a "true" or "false" value as the result at the end. Accumulates side-effects that come before the next conjunct. Accumulates conjuncts (conditions that must all be true) for the translation. When a conjunct is added, elements of the _sideEffectBuilder, if any, should be added as part of a sequence expression for the conjunct being added. Translate the single test into _sideEffectBuilder and _conjunctBuilder. Translate an is-pattern expression into a sequence of tests separated by the control-flow-and operator. Lowers a lock statement to a try-finally block that calls (before and after the body, respectively): Lock.EnterScope and Lock+Scope.Dispose if the argument is of type Lock, or Monitor.Enter and Monitor.Exit. A map from section syntax to the first label in that section. We revise the returned label for a leaf so that all leaves in the same switch section are given the same label. This enables the switch emitter to produce better code. The strategy of this rewrite is to do rewrite "locally". We analyze arguments of the concat in a shallow fashion assuming that lowering and optimizations (including this one) is already done for the arguments. Based on the arguments we select the most appropriate pattern for the current node. NOTE: it is not guaranteed that the node that we chose will be the most optimal since we have only local information - i.e. we look at the arguments, but we do not know about siblings. When we move to the parent, the node may be rewritten by this or some another optimization. Example: result = ( "abc" + "def" + null ?? expr1 + "moo" + "baz" ) + expr2 Will rewrite into: result = Concat("abcdef", expr2) However there will be transient nodes like Concat(expr1 + "moo") that will not be present in the resulting tree. digs into known concat operators and unwraps their arguments otherwise returns the expression as-is Generally we only need to recognize same node patterns that we create as a result of concatenation rewrite. Determines whether an expression is a known string concat operator (with or without a subsequent ?? ""), and extracts its args if so. True if this is a call to a known string concat operator and its arguments are successfully extracted, false otherwise folds two concat operands into one expression if possible otherwise returns null folds two concat constants into one if possible otherwise returns null. It is generally always possible to concat constants, unless resulting string would be too large. Strangely enough there is such a thing as unary concatenation and it must be rewritten. Most of the above optimizations are not applicable in expression trees as the operator must stay a binary operator. We cannot do much beyond constant folding which is done in binder. Returns an expression which converts the given expression into a string (or null). If necessary, this invokes .ToString() on the expression, to avoid boxing value types. Helper method to generate a lowered conversion from the given to the given . Rewrites the given interpolated string to the set of handler creation and Append calls, returning an array builder of the append calls and the result local temp. Caller is responsible for freeing the ArrayBuilder Is there any code to execute in the given statement that could have side-effects, such as throwing an exception? This implementation is conservative, in the sense that it may return true when the statement actually may have no side effects. Rewrite GetTuple() == (1, 2) to tuple.Item1 == 1 && tuple.Item2 == 2. Also supports the != operator, nullable and nested tuples. Note that all the side-effects for visible expressions are evaluated first and from left to right. The initialization phase contains side-effects for: - single elements in tuple literals, like a in (a, ...) == (...) for example - nested expressions that aren't tuple literals, like GetTuple() in (..., GetTuple()) == (..., (..., ...)) On the other hand, Item1 and Item2 of GetTuple() are not saved as part of the initialization phase of GetTuple() == (..., ...) Element-wise conversions occur late, together with the element-wise comparisons. They might not be evaluated. Walk down tuple literals and replace all the side-effecting elements that need saving with temps. Expressions that are not tuple literals need saving, as are tuple literals that are involved in a simple comparison rather than a tuple comparison. Evaluate side effects into a temp, if necessary. If there is an implicit user-defined conversion operation near the top of the arg, preserve that in the returned expression to be evaluated later. Conversions at the head of the result are unlowered, though the nested arguments within it are lowered. That resulting expression must be passed through to complete the lowering. Produce a .HasValue and a .GetValueOrDefault() for nullable expressions that are neither always null or never null, and functionally equivalent parts for other cases. Returns a temp which is initialized with lowered-expression.HasValue Produces a chain of equality (or inequality) checks combined logically with AND (or OR) For tuple literals, we just return the element. For expressions with tuple type, we access Item{i+1}. Produce an element-wise comparison and logic to ensure the result is a bool type. If an element-wise comparison doesn't return bool, then: - if it is dynamic, we'll do !(comparisonResult.false) or comparisonResult.true - if it implicitly converts to bool, we'll just do the conversion - otherwise, we'll do !(comparisonResult.false) or comparisonResult.true (as we'd do for if or while) Lower any conversions appearing near the top of the bound expression, assuming non-conversions appearing below them have already been lowered. Converts the expression for creating a tuple instance into an expression creating a ValueTuple (if short) or nested ValueTuples (if longer). For instance, for a long tuple we'll generate: creationExpression(ctor=largestCtor, args=firstArgs+(nested creationExpression for remainder, with smaller ctor and next few args)) This rewriter lowers pre-/post- increment/decrement operations (initially represented as unary operators). We use BoundSequenceExpressions because we need to capture the RHS of the assignment in a temp variable. This rewriter assumes that it will be run before decimal rewriting (so that it does not have to lower decimal constants and operations) and call rewriting (so that it does not have to lower property accesses). The rewrites are as follows: suppose the operand x is a variable of type X. The chosen increment/decrement operator is modelled as a static method on a type T, which takes a value of type T and returns the result of incrementing or decrementing that value. x++ X temp = x x = (X)(T.Increment((T)temp)) return temp x-- X temp = x x = (X)(T.Decrement((T)temp)) return temp ++x X temp = (X)(T.Increment((T)x)) x = temp return temp --x X temp = (X)(T.Decrement((T)x)) x = temp return temp Note: Dev11 implements dynamic prefix operators incorrectly. result = ++x.P is emitted as result = SetMember{"P"}(t, UnaryOperation{Inc}(GetMember{"P"}(x))) The difference is that Dev11 relies on SetMember returning the same value as it was given as an argument. Failing to do so changes the semantics of ++/-- operator which is undesirable. We emit the same pattern for both dynamic and static operators. For example, we might have a class X with user-defined implicit conversions to and from short, but no user-defined increment or decrement operators. We would bind x++ as "X temp = x; x = (X)(short)((int)(short)temp + 1); return temp;" The unary operator expression representing the increment/decrement. A bound sequence that uses a temp to achieve the correct side effects and return value. Transform an expression from a form suitable as an lvalue to a form suitable as an rvalue. The children of this node must already be lowered. Fully lowered node. Rewrite a using statement into a try finally statement. Four forms are possible: 1) using (expr) stmt 2) await using (expr) stmt 3) using (C c = expr) stmt 4) await using (C c = expr) stmt The first two are handled by RewriteExpressionUsingStatement and the latter two are handled by RewriteDeclarationUsingStatement (called in a loop, once for each local declared). For the async variants, `IAsyncDisposable` is used instead of `IDisposable` and we produce `... await expr.DisposeAsync() ...` instead of `... expr.Dispose() ...`. It would be more in line with our usual pattern to rewrite using to try-finally in the ControlFlowRewriter, but if we don't do it here the BoundMultipleLocalDeclarations will be rewritten into a form that makes them harder to separate. Lower "[await] using var x = (expression)" to a try-finally block. Lower "using [await] (expression) statement" to a try-finally block. Lower "using [await] (ResourceType resource = expression) statement" to a try-finally block. Assumes that the local symbol will be declared (i.e. in the LocalsOpt array) of an enclosing block. Assumes that using statements with multiple locals have already been split up into multiple using statements. The node that declares the type of the resource (might be shared by multiple resource declarations, e.g. using T x = expr, y = expr;) The node that declares the resource storage, e.g. x = expr in using T x = expr, y = expr;. The node that declares the type of the resource (might be shared by multiple resource declarations, e.g. using T x = expr, y = expr;) The node that declares the resource storage, e.g. x = expr in using T x = expr, y = expr;. Synthesize a call `expression.Method()`, but with some extra smarts to handle extension methods. This call expects that the receiver parameter has already been visited. The dynamic operation factories below return this struct so that the caller have the option of separating the call-site initialization from its invocation. Most callers just call to get the combo but some (object and array initializers) hoist all call-site initialization code and emit multiple invocations of the same site. Corresponds to Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags. Corresponds to Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags. If there are any discards in the arguments, create locals for each, updates the arguments and returns the symbols that were created. Returns default if no discards found. If an expression node that declares synthesized short-lived locals (currently only sequence) contains a spill sequence (from an await or switch expression), these locals become long-lived since their values may be read by code that follows. We promote these variables to long-lived of kind . Rewrite the replacement expression for the hoisted local so all synthesized field are accessed as members of the appropriate frame. A walker that computes the set of local variables of an iterator/async method that must be hoisted to the state machine. Data flow analysis is used to calculate the locals. At yield/await we mark all variables as "unassigned". When a read from an unassigned variable is reported we add the variable to the captured set. "this" parameter is captured if a reference to "this", "base" or an instance field is encountered. Variables used in finally also need to be captured if there is a yield in the corresponding try block. The "state" of the state machine that is the translation of the iterator method. Cached "state" of the state machine within the MoveNext method. We work with a copy of the state to avoid shared mutable state between threads. (Two threads can be executing in a Task's MoveNext method because an awaited task may complete after the awaiter has tested whether the subtask is complete but before the awaiter has returned) Cached "this" local, used to store the captured "this", which is safe to cache locally since "this" is semantically immutable. It would be hard for such caching to happen at JIT level (since JIT does not know that it never changes). NOTE: this field is null when we are not caching "this" which happens when - not optimizing - method is not capturing "this" at all - containing type is a struct (we could cache "this" as a ref local for struct containers, but such caching would not save as much indirection and could actually be done at JIT level, possibly more efficiently) Allocates resumable states, i.e. states that resume execution of the state machine after await expression or yield return. For each distinct label, the set of states that need to be dispatched to that label. Note that there is a dispatch occurring at every try-finally statement, so this variable takes on a new set of values inside each try block. A pool of fields used to hoist locals. They appear in this set when not in scope, so that members of this set may be allocated to locals when the locals come into scope. Fields allocated for temporary variables are given unique names distinguished by a number at the end. This counter ensures they are unique within a given translated method. Used to enumerate the instance fields of a struct. The set of local variables and parameters that were hoisted and need a proxy. EnC support: the rewriter stores debug info for each await/yield in this builder. Generate return statements from the state machine method body. Generates code that switches over states and jumps to the target labels listed in . If this is the outermost state dispatch switching over all states of the state machine - i.e. not state dispatch generated for a try-block. Translate a statement that declares a given set of locals. Also allocates and frees hoisted temps as required for the translation. The set of locals declared in the original version of this statement A delegate to return the translation of the body of this statement Must remain in sync with . Must remain in sync with . Might the given type be, or contain, managed references? This is used to determine which fields allocated to temporaries should be cleared when the underlying variable goes out of scope, so that they do not cause unnecessary object retention. The try statement is the most complex part of the state machine transformation. Since the CLR will not allow a 'goto' into the scope of a try statement, we must generate the dispatch to the state's label stepwise. That is done by translating the try statements from the inside to the outside. Within a try statement, we start with an empty dispatch table (representing the mapping from state numbers to labels). During translation of the try statement's body, the dispatch table will be filled in with the data necessary to dispatch once we're inside the try block. We generate that at the head of the translated try statement. Then, we copy all of the states from that table into the table for the enclosing construct, but associate them with a label just before the translated try block. That way the enclosing construct will generate the code necessary to get control into the try block for all of those states. Set the state field and the cached state Allocates resumable states, i.e. states that resume execution of the state machine after await expression or yield return. The number of the next generated resumable state (i.e. state that resumes execution of the state machine after await expression or yield return). EnC support: number of states in this state machine that match states of the previous generation state machine. True if any of the states generated for any previous state machine has not been allocated in this version. Represents a synthesized state machine field. True if the initial values of locals in the rewritten method and the initial thread ID need to be preserved. (e.g. enumerable iterator methods and async-enumerable iterator methods) Add fields to the state machine class that control the state machine. Initialize the state machine class. Generate implementation-specific state machine initialization for the kickoff method body. Generate implementation-specific state machine member method implementations. Produce Environment.CurrentManagedThreadId if available, otherwise CurrentThread.ManagedThreadId Generate the GetEnumerator() method for iterators and GetAsyncEnumerator() for async-iterators. Generate logic to reset the current instance (rather than creating a new instance) Returns true if either Thread.ManagedThreadId or Environment.CurrentManagedThreadId are available State machine interface method implementation. Represents a state machine MoveNext method. Handles special behavior around inheriting some attributes from the original async/iterator method. Represents a state machine method other than a MoveNext method. All such methods are considered debugger hidden. Tracks synthesized fields that are needed in a submission being compiled. For every other submission referenced by this submission we add a field, so that we can access members of the target submission. A field is also needed for the host object, if provided. A helper class for synthesizing quantities of code. Thrown by the bound node factory when there is a failure to synthesize code. An appropriate diagnostic is included that should be reported. Currently the only diagnostic handled through this mechanism is a missing special/well-known member. A binder suitable for performing overload resolution to synthesize a call to a helper method. A binder used only for performing overload resolution of runtime helper methods. Create a bound node factory. Note that the use of the factory to get special or well-known members that do not exist will result in an exception of type being thrown. The top-level method that will contain the code The syntax node to which generated code should be attributed The state of compilation of the enclosing type A bag where any diagnostics should be output Instrumentation state, if the factory is used for local lowering phase. The top-level method that will contain the code The enclosing class The syntax node to which generated code should be attributed The state of compilation of the enclosing type A bag where any diagnostics should be output Instrumentation state, if the factory is used for local lowering phase. Get the symbol for a well-known member. The use of this method to get a well-known member that does not exist will result in an exception of type being thrown containing an appropriate diagnostic for the caller to report. The desired well-known member If true, the method may return null for a missing member without an exception A symbol for the well-known member, or null if it is missing and == true Get the symbol for a special member. The use of this method to get a special member that does not exist will result in an exception of type MissingPredefinedMember being thrown containing an appropriate diagnostic for the caller to report. The desired special member A symbol for the special member. Creates a general assignment that might be instrumented. Creates a general assignment that might be instrumented. An internal helper class for building a switch statement. Produce an int switch. Check for (and assert that there are no) duplicate case labels in the switch. Synthesizes an expression that evaluates to the current module's MVID. Synthesizes an expression that evaluates to the index of a source document in the table of debug source documents. Helper that will use Array.Empty if available and elements have 0 length NOTE: it is valid only if we know that the API that is being called will not retain or use the array argument for any purpose (like locking or key in a hash table) Typical example of valid use is Linq.Expressions factories - they do not make any assumptions about array arguments and do not keep them or rely on their identity. Takes an expression and returns the bound local expression "temp" and the bound assignment expression "temp = expr". Compiles a list of all labels that are targeted by gotos within a node, but are not declared within the node. newPosition represents the position we are in the final SourceText. As we consume and reuse nodes from the old tree we will update our position in the new text accordingly. Likewise, when we must lex tokens out of the new tree we will update as well. NOTE(cyrusn): We do not need an oldPosition because it is redundant given the oldTreeCursor. The oldPosition is implicitly defined by the position of the cursor. Affected range of a change is the range within which nodes can be affected by a change and cannot be reused. Because of lookahead effective range of a change is larger than the change itself. THe cursor represents a location in the tree that we can move around to indicate where we are in the original tree as we're incrementally parsing. When it is at a node or token, it can either move forward to that entity's next sibling. It can also move down to a node's first child or first token. Once the cursor hits the end of file, it's done. Note: the cursor will skip any other zero length nodes in the tree. Returns the cursor of our next non-empty (or EOF) sibling in our parent if one exists, or `default` if if doesn't. An error/warning directive tells the compiler to indicate a syntactic error/warning at the current location. Format: #error Error message string Resulting message: from the first non-whitespace character after the directive keyword until the end of the directive (aka EOD) at the line break or EOF. Resulting span: [first non-whitespace char, EOD) Examples (pipes indicate span): #error |goo| #error |goo| #error |goo | #error |goo baz| #error |//goo| #error |/*goo*/| #error |/*goo| The '#' token. The 'error' or 'warning' token. True if the error/warning should be recorded. An ErrorDirective or WarningDirective node. These aren't acceptable in place of ASCII quotation marks in XML, but we want to consume them (and produce an appropriate error) if they occur in a place where a quotation mark is legal. ACASEY: This grammar is derived from the behavior and sources of the native compiler. Tokens start with underscores (I've cheated for _PredefinedTypeToken, which is not actually a SyntaxKind), "*" indicates "0 or more", "?" indicates "0 or 1", and parentheses are for grouping. Cref = CrefType _DotToken CrefMember | CrefType | CrefMember | CrefFirstType _OpenParenToken CrefParameterList? _CloseParenToken CrefName = _IdentifierToken (_LessThanToken _IdentifierToken (_CommaToken _IdentifierToken)* _GreaterThanToken)? CrefFirstType = ((_IdentifierToken _ColonColonToken)? CrefName) | _PredefinedTypeToken CrefType = CrefFirstType (_DotToken CrefName)* CrefMember = CrefName (_OpenParenToken CrefParameterList? _CloseParenToken)? | _ThisKeyword (_OpenBracketToken CrefParameterList _CloseBracketToken)? | _OperatorKeyword _OperatorToken (_OpenParenToken CrefParameterList? _CloseParenToken)? | (_ImplicitKeyword | _ExplicitKeyword) _OperatorKeyword CrefParameterType (_OpenParenToken CrefParameterList? _CloseParenToken)? CrefParameterList = CrefParameter (_CommaToken CrefParameter)* CrefParameter = (_RefKeyword | _OutKeyword)? CrefParameterType CrefParameterType = CrefParameterType2 _QuestionToken? _AsteriskToken* (_OpenBracketToken _CommaToken* _CloseBracketToken)* CrefParameterType2 = (((_IdentifierToken _ColonColonToken)? CrefParameterType3) | _PredefinedTypeToken) (_DotToken CrefParameterType3)* CrefParameterType3 = _IdentifierToken (_LessThanToken CrefParameterType (_CommaToken CrefParameterType)* _GreaterThanToken)? NOTE: type parameters, not type arguments NOTE: the first production of Cref is preferred to the other two NOTE: pointer, array, and nullable types only work in parameters NOTE: CrefParameterType2 and CrefParameterType3 correspond to CrefType and CrefName, respectively. Since the only difference is that they accept non-identifier type arguments, this is accomplished using parameters on the parsing methods (rather than whole new methods). Parse the custom cref syntax for a named member (method, property, etc), an indexer, an overloadable operator, or a user-defined conversion. Parse a named member (method, property, etc), with optional type parameters and regular parameters. Parse an indexer member, with optional parameters. Parse an overloadable operator, with optional parameters. Parse a user-defined conversion, with optional parameters. Parse a parenthesized parameter list. Parse a bracketed parameter list. Parse the parameter list (if any) of a cref member (name, indexer, operator, or conversion). True if the current token could be the beginning of a cref parameter. Parse an element of a cref parameter list. "ref", "ref readonly", "in", "out" work, but "params", "this", and "__arglist" don't. Parse an identifier, optionally followed by an angle-bracketed list of type parameters. True to give an error when a non-identifier type argument is seen, false to accept. No change in the shape of the tree. Parse a type. May include an alias, a predefined type, and/or a qualified name. Pointer, nullable, or array types are only allowed if is false. Leaves a dot and a name unconsumed if the name is not followed by another dot and checkForMember is true. True to give an error when a non-identifier type argument is seen, false to accept. No change in the shape of the tree. True means that the last name should not be consumed if it is followed by a parameter list. Parse a type. May include an alias, a predefined type, and/or a qualified name. No pointer, nullable, or array types. Leaves a dot and a name unconsumed if the name is not followed by another dot and checkForMember is true. True to give an error when a non-identifier type argument is seen, false to accept. No change in the shape of the tree. True means that the last name should not be consumed if it is followed by a parameter list. Once the name part of a type (including type parameter/argument lists) is parsed, we need to consume ?, *, and rank specifiers. Ends at appropriate quotation mark, EOF, or EndOfDocumentationComment. Convenience method for checking the mode. Ends at appropriate quotation mark, EOF, or EndOfDocumentationComment. Set of well-known SyntaxTokens commonly found within XML doc comments. Look up a well known SyntaxToken for a given XML element tag or attribute. This is a performance optimization to avoid creating duplicate tokens for the same content. The text of the tag or attribute. The leading trivia of the token. The SyntaxToken representing the well-known tag or attribute or null if it's not well-known. Are we possibly at the start of an attribute list, or at a modifier which is valid on a type, or on a keyword of a type declaration? Are we at a modifier which is valid on a type declaration or at a type keyword? Returns true if the lookahead tokens compose extern alias directive. Changes in this function around member parsing should be mirrored in . Try keeping structure of both functions similar to simplify this task. The split was made to reduce the stack usage during recursive parsing. Returns null if we can't parse anything (even partially). Changes in this function should be mirrored in . Try keeping structure of both functions similar to simplify this task. The split was made to reduce the stack usage during recursive parsing. Returns null if we can't parse anything (even partially). Parses any block or expression bodies that are present. Also parses the trailing semicolon if one is present. WARNING: it is possible that "list" is really the underlying builder of a SeparateSyntaxListBuilder, so it is important that we not add anything to the list. Parses the !! as skipped tokens following a parameter name token. If the parameter name is followed by !!= or ! !=, then the final equals will be returned through . Merges two successive tokens into a single token with the given . If the two tokens have no trivia between them, then the final token will be trivially generated, properly passing on the right leading/trailing trivia. However, if there is trivia between the tokens, then appropriate errors will be reported that the tokens cannot merge successfully. IsFabricatedToken should be updated for tokens whose SyntaxKind is . True if current identifier token is not really some contextual keyword True if the given token is not really some contextual keyword. This method is for use in executable code, as it treats partial as an identifier. This is an adjusted version of . When it returns true, it stops at operator keyword (). When it returns false, it does not advance in the token stream. Definitely not a type name. Definitely a type name: either a predefined type (int, string, etc.) or an array type (ending with a [] brackets), or a pointer type (ending with *s), or a function pointer type (ending with > in valid cases, or a *, ), or calling convention identifier, in invalid cases). Might be a generic (qualified) type name or a method name. Might be a generic (qualified) type name or an expression or a method name. Might be a non-generic (qualified) type name or an expression. A type name with alias prefix (Alias::Name). Note that Alias::Name.X would not fall under this. This only is returned for exactly Alias::Name. Nullable type (ending with ?). Might be a pointer type or a multiplication. Might be a tuple type. Returns TupleType when a possible tuple type is found. Note that this is not MustBeType, so that the caller can consider deconstruction syntaxes. The caller is expected to have consumed the opening paren. If we're being called while parsing a C# top-level statements (Script or Simple Program). At the top level in Script, we allow most statements *except* for local-decls/local-funcs. Those will instead be parsed out as script-fields/methods. true if the current token can be the first token of a typed identifier (a type name followed by an identifier), false if it definitely can't be, null if we need to scan further to find out. Used to parse the block-body for a method or accessor. For blocks that appear *inside* method bodies, call . If is true, then we produce a special diagnostic if the open brace is missing. Used to parse normal blocks that appear inside method bodies. For the top level block of a method/accessor use . Is the following set of tokens, interpreted as a type, the type var? Parses any kind of local declaration statement: local variable or local function. Parse a single variable designation (e.g. x) or a wildcard designation (e.g. _) Parse a local variable declaration for constructs where the variable declaration is enclosed in parentheses. Specifically, only for the `fixed (...)` `for(...)` or `using (...)` statements. Is the current token one that could start an expression? Is the current token one that could be in an expression? Parse a subexpression of the enclosing operator of the given precedence. Returns true if... 1. The precedence is less than or equal to Assignment, and 2. The current token is the identifier var or a predefined type, and 3. it is followed by (, and 4. that ( begins a valid parenthesized designation, and 5. the token following that designation is = Tokens that match the following are considered a possible lambda expression: attribute-list* ('async' | 'static')* type? ('(' | identifier) ... For better error recovery 'static =>' is also considered a possible lambda expression. Parse expected lambda expression but assume `x ? () => y :` is a conditional expression rather than a lambda expression with an explicit return type and return null in that case only. Parses a comma separated list of nodes. The type of node to return back in the . The token preceding the separated elements. Used to attach skipped tokens to if no elements have been parsed out yet, and the error recovery algorithm chooses to continue parsing, versus aborting the list parsing. The token kind to look for that indicates the list is complete Callback to indicate if the parser is at a point in the source that could parse out a . Callback to actually parse out an element. May be called even at a location where returned for. Error recovery callback. Used to determine if the list parsing routine should skip tokens (attaching them to the last thing successfully parsed), and continue looking for more elements. Or if it should abort parsing the list entirely. Whether or not a trailing comma is allowed at the end of the list. For example, an array initializer allows for a trailing comma at the end of it, while a parameter list does not. Whether or not at least one element is required in the list. For example, a parameter list does not require any elements, while an attribute list "[...]" does. Whether or not an errant semicolon found in a location where a comma is expected should just be treated as a comma (still with an error reported). Useful for constructs where users often forget which separator is needed and use the wrong one. All the callbacks should passed as static lambdas or static methods to prevent unnecessary delegate allocations. Interpret the given raw text from source as an InterpolatedStringTextToken. The text for the full string literal, including the quotes and contents The kind of the interpolated string we were processing Parses the type, or pattern, right-hand operand of an is expression. Priority is the TypeSyntax. It may return a TypeSyntax which turns out in binding to be a constant pattern such as enum 'Days.Sunday'. We handle such cases in the binder of the is operator. Note that the syntax `_` will be parsed as a type. Given tk, the type of the current token, does this look like the type of a pattern? Is the current token something that could follow a type in a pattern? Check the next token to see if it is valid as the first token of a subpattern element. Used to assist in error recovery for subpattern lists (e.g. determining which tokens to skip) to ensure we make forward progress during recovery. The lexer is for the contents of an interpolation that is followed by a colon that signals the start of the format string. This method is essentially the same as ScanIdentifier_SlowPath, except that it can handle XML entities. Since ScanIdentifier is hot code and since this method does extra work, it seem worthwhile to separate it from the common case. Scans a new-line sequence (either a single new-line character or a CR-LF combo). A trivia node with the new-line text Scans all of the whitespace (not new-lines) into a trivia node until it runs out. A trivia node with the whitespace text Lexer entry point for LexMode.XmlDocComment Lexer entry point for LexMode.XmlElementTag Determines whether this Unicode character can start a XMLName. The Unicode character. Determines if this Unicode character can be part of an XML Name. The Unicode character. Lexer entry point for LexMode.XmlAttributeText Lexer entry point for LexerMode.XmlCharacter. Scan a single XML character (or entity). Assumes that leading trivia has already been consumed. Lexer entry point for LexerMode.XmlCrefQuote, LexerMode.XmlCrefDoubleQuote, LexerMode.XmlNameQuote, and LexerMode.XmlNameDoubleQuote. Scan a single cref attribute token. Assumes that leading trivia has already been consumed. Within this method, characters that are not XML meta-characters can be seamlessly replaced with the corresponding XML entities. Given a character, advance the input if either the character or the corresponding XML entity appears next in the text window. Convenience property for determining whether we are currently lexing the value of a cref or name attribute. Convenience property for determining whether we are currently lexing the value of a name attribute. Diagnostics that occur within cref attributes need to be wrapped with ErrorCode.WRN_ErrorOverride. Diagnostics that occur within cref attributes need to be wrapped with ErrorCode.WRN_ErrorOverride. Lexer entry point for LexMode.XmlCDataSectionText Lexer entry point for LexMode.XmlCommentText Lexer entry point for LexMode.XmlProcessingInstructionText Collects XML doc comment exterior trivia, and therefore is a no op unless we are in the Start or Exterior of an XML doc comment. List in which to collect the trivia Collects whitespace and new line trivia for XML doc comments. Does not see XML doc comment exterior trivia, and is a no op unless we are in the interior. List in which to collect the trivia Given that the next character is an ampersand ('&'), attempt to interpret the following characters as an XML entity. On success, populate the out parameters with the low and high UTF-16 surrogates for the character represented by the entity. e.g. '<' for &lt;. e.g. '\uDC00' for &#x10000; (ch == '\uD800'). True if a valid XML entity was consumed. NOTE: Always advances, even on failure. Range of the format colon in the interpolation. Empty if there is no colon. Range of the close brace. Empty if there was no close brace (an error condition). The number of quotes that were consumed Returns true if starts with . Turn a (parsed) interpolated string nonterminal into an interpolated string token. Normal interpolated string that just starts with $" Verbatim interpolated string that starts with $@" or @$" Single-line raw interpolated string that starts with at least one $, and at least three "s. Multi-line raw interpolated string that starts with at least one $, and at least three "s. Non-copyable ref-struct so that this will only live on the stack for the lifetime of the lexer/parser recursing to process interpolated strings. Error encountered while scanning. If we run into an error, then we'll attempt to stop parsing at the next potential ending location to prevent compounding the issue. Number of '$' characters this interpolated string started with. We'll need to see that many '{' in a row to start an interpolation. Any less and we'll treat that as just text. Note if this count is '1' then this is a normal (non-raw) interpolation and `{{` is treated as an escape. Number of '"' characters this interpolated string started with. if we successfully processed the open quote range and can proceed to the rest of the literal. if we were not successful and should stop processing. Returns if the quote was an end delimiter and lexing of the contents of the interpolated string literal should stop. If it was an end delimiter it will not be consumed. If it is content and should not terminate the string then it will be consumed by this method. Scan past the hole inside an interpolated string literal, leaving the current character on the '}' (if any) The lexer can run away consuming the rest of the input when delimiters are mismatched. This is a test for when we are attempting to recover from that situation. Note that just running into new lines will not make us think we're in runaway lexing. Keeps a sliding buffer over the SourceText of a file for the lexer. Also provides the lexer with the ability to keep track of a current "lexeme" by leaving a marker and advancing ahead the offset. The lexer can then decide to "keep" the lexeme by erasing the marker, or abandon the current lexeme by moving the offset back to the marker. In many cases, e.g. PeekChar, we need the ability to indicate that there are no characters left and we have reached the end of the stream, or some other invalid or not present character was asked for. Due to perf concerns, things like nullable or out variables are not viable. Instead we need to choose a char value which can never be legal. In .NET, all characters are represented in 16 bits using the UTF-16 encoding. Fortunately for us, there are a variety of different bit patterns which are *not* legal UTF-16 characters. 0xffff (char.MaxValue) is one of these characters -- a legal Unicode code point, but not a legal UTF-16 bit pattern. The current absolute position in the text file. The current offset inside the window (relative to the window start). The buffer backing the current window. Returns the start of the current lexeme relative to the window start. Number of characters in the character window. The absolute position of the start of the current lexeme in the given SourceText. The number of characters in the current lexeme. Start parsing a new lexeme. After reading , a consumer can determine if the InvalidCharacter was in the user's source or a sentinel. Comments and string literals are allowed to contain any Unicode character. Advance the current position by one. No guarantee that this position is valid. Advances the text window if it currently pointing at the character. Returns if it did advance, otherwise. Advance the current position by n. No guarantee that this position is valid. Moves past the newline that the text window is currently pointing at. The text window must be pointing at a newline. If the newline is \r\n then that entire sequence will be skipped. Otherwise, the text window will only advance past a single character. Gets the length of the newline the text window must be pointing at here. For \r\n this is 2, for everything else, this is 1. Grab the next character and advance the position. The next character, if there were no characters remaining. Gets the next character if there are any characters in the SourceText. May advance the window if we are at the end. The next character if any are available. InvalidCharacter otherwise. Gets the character at the given offset to the current position if the position is valid within the SourceText. The next character if any are available. InvalidCharacter otherwise. If the next characters in the window match the given string, then advance past those characters. Otherwise, do nothing. Because syntax nodes need to be constructed with context information - to allow us to determine whether or not they can be reused during incremental parsing - the syntax factory needs a view of some internal parser state. Read-only outside SyntaxParser (not enforced for perf reasons). Reference type so that the factory stays up-to-date. If a method goes from async to non-async, or vice versa, then every occurrence of "await" within the method (but not within a lambda) needs to be reinterpreted, to determine whether it is a keyword or an identifier. If we are forcing that ?[ is parsed as a conditional-access-expression, and not a conditional-expression with a collection-expression in it. If the end of a query expression statement is commented out, then the following statement may appear to be part of the query. When this occurs, identifiers within the following statement may need to be reinterpreted as query keywords. If an accessor kind changes, "field" within the accessor may need to be reinterpreted, to determine whether the token is a keyword or an identifier. Returns and consumes the current token if it has the requested . Otherwise, returns . Converts skippedSyntax node into tokens and adds these as trivia on the target token. Also adds the first error (in depth-first preorder) found in the skipped syntax tree to the target token. This function searches for the given location node within the subtree rooted at root node. If it finds it, the function computes the offset span of that child node within the root and returns true, otherwise it returns false. Root node Node to search in the subtree rooted at root node Offset of the location node within the subtree rooted at child NOTE: we are specifically diverging from dev11 to improve the user experience. Since treating the "async" keyword as an identifier in older language versions can never result in a correct program, we instead accept it as a keyword regardless of the language version and produce an error if the version is insufficient. Whenever parsing in a while (true) loop and a bug could prevent the loop from making progress, this method can prevent the parsing from hanging. Use as: int tokenProgress = -1; while (IsMakingProgress(ref tokenProgress)) It should be used as a guardrail, not as a crutch, so it asserts if no progress was made. Should only be called during construction. This should probably be an extra constructor parameter, but we don't need more constructor overloads. Gets the syntax node represented the structure of this trivia, if any. The HasStructure property can be used to determine if this trivia has structure. A CSharpSyntaxNode derived from StructuredTriviaSyntax, with the structured view of this trivia node. If this trivia node does not have structure, returns null. Some types of trivia have structure that can be accessed as additional syntax nodes. These forms of trivia include: directives, where the structure describes the structure of the directive. documentation comments, where the structure describes the XML structure of the comment. skipped tokens, where the structure describes the tokens that were skipped by the parser. Class which represents the syntax node for identifier name. SyntaxToken representing the keyword for the kind of the identifier name. Class which represents the syntax node for name colon syntax. IdentifierNameSyntax representing the identifier name. SyntaxToken representing colon. Creates a token whose and are the same. Returns the string representation of this token, not including its leading and trailing trivia. The string representation of this token, not including its leading and trailing trivia. The length of the returned string is always the same as Span.Length Base class for type declaration syntax (class, struct, interface, record). Gets the type keyword token ("class", "struct", "interface", "record"). Gets the type constraint list. Gets the member declarations. Class type declaration syntax. Gets the class keyword token. Interface type declaration syntax. Gets the interface keyword token. Struct type declaration syntax. Gets the struct keyword token. Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. SyntaxToken representing the identifier of the simple name. Class which represents the syntax node for qualified name. NameSyntax node representing the name on the left side of the dot token of the qualified name. SyntaxToken representing the dot. SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. Class which represents the syntax node for generic name. SyntaxToken representing the name of the identifier of the generic name. TypeArgumentListSyntax node representing the list of type arguments of the generic name. Class which represents the syntax node for type argument list. SyntaxToken representing less than. SeparatedSyntaxList of TypeSyntax node representing the type arguments. SyntaxToken representing greater than. Class which represents the syntax node for alias qualified name. IdentifierNameSyntax node representing the name of the alias SyntaxToken representing colon colon. SimpleNameSyntax node representing the name that is being alias qualified. Class which represents the syntax node for predefined types. SyntaxToken which represents the keyword corresponding to the predefined type. Class which represents the syntax node for the array type. TypeSyntax node representing the type of the element of the array. SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. Class which represents the syntax node for pointer type. TypeSyntax node that represents the element type of the pointer. SyntaxToken representing the asterisk. SyntaxToken representing the delegate keyword. SyntaxToken representing the asterisk. Node representing the optional calling convention. List of the parameter types and return type of the function pointer. Function pointer parameter list syntax. SyntaxToken representing the less than token. SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. SyntaxToken representing the greater than token. Function pointer calling convention syntax. SyntaxToken representing whether the calling convention is managed or unmanaged. Optional list of identifiers that will contribute to an unmanaged calling convention. Function pointer calling convention syntax. SyntaxToken representing open bracket. SeparatedSyntaxList of calling convention identifiers. SyntaxToken representing close bracket. Individual function pointer unmanaged calling convention. SyntaxToken representing the calling convention identifier. Class which represents the syntax node for a nullable type. TypeSyntax node representing the type of the element. SyntaxToken representing the question mark. Class which represents the syntax node for tuple type. SyntaxToken representing the open parenthesis. SyntaxToken representing the close parenthesis. Tuple type element. Gets the type of the tuple element. Gets the name of the tuple element. Class which represents a placeholder in the type argument list of an unbound generic type. SyntaxToken representing the omitted type argument. The ref modifier of a method's return value or a local. Gets the optional "readonly" keyword. The 'scoped' modifier of a local. Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. Class which represents the syntax node for parenthesized expression. SyntaxToken representing the open parenthesis. ExpressionSyntax node representing the expression enclosed within the parenthesis. SyntaxToken representing the close parenthesis. Class which represents the syntax node for tuple expression. SyntaxToken representing the open parenthesis. SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. SyntaxToken representing the close parenthesis. Class which represents the syntax node for prefix unary expression. SyntaxToken representing the kind of the operator of the prefix unary expression. ExpressionSyntax representing the operand of the prefix unary expression. Class which represents the syntax node for an "await" expression. SyntaxToken representing the kind "await" keyword. ExpressionSyntax representing the operand of the "await" operator. Class which represents the syntax node for postfix unary expression. ExpressionSyntax representing the operand of the postfix unary expression. SyntaxToken representing the kind of the operator of the postfix unary expression. Class which represents the syntax node for member access expression. ExpressionSyntax node representing the object that the member belongs to. SyntaxToken representing the kind of the operator in the member access expression. SimpleNameSyntax node representing the member being accessed. Class which represents the syntax node for conditional access expression. ExpressionSyntax node representing the object conditionally accessed. SyntaxToken representing the question mark. ExpressionSyntax node representing the access expression to be executed when the object is not null. Class which represents the syntax node for member binding expression. SyntaxToken representing dot. SimpleNameSyntax node representing the member being bound to. Class which represents the syntax node for element binding expression. BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. Class which represents the syntax node for a range expression. ExpressionSyntax node representing the expression on the left of the range operator. SyntaxToken representing the operator of the range expression. ExpressionSyntax node representing the expression on the right of the range operator. Class which represents the syntax node for implicit element access expression. BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. Class which represents an expression that has a binary operator. ExpressionSyntax node representing the expression on the left of the binary operator. SyntaxToken representing the operator of the binary expression. ExpressionSyntax node representing the expression on the right of the binary operator. Class which represents an expression that has an assignment operator. ExpressionSyntax node representing the expression on the left of the assignment operator. SyntaxToken representing the operator of the assignment expression. ExpressionSyntax node representing the expression on the right of the assignment operator. Class which represents the syntax node for conditional expression. ExpressionSyntax node representing the condition of the conditional expression. SyntaxToken representing the question mark. ExpressionSyntax node representing the expression to be executed when the condition is true. SyntaxToken representing the colon. ExpressionSyntax node representing the expression to be executed when the condition is false. Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. Class which represents the syntax node for a this expression. SyntaxToken representing the this keyword. Class which represents the syntax node for a base expression. SyntaxToken representing the base keyword. Class which represents the syntax node for a literal expression. SyntaxToken representing the keyword corresponding to the kind of the literal expression. Class which represents the syntax node for a field expression. SyntaxToken representing the field keyword. Class which represents the syntax node for MakeRef expression. SyntaxToken representing the MakeRefKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for RefType expression. SyntaxToken representing the RefTypeKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for RefValue expression. SyntaxToken representing the RefValueKeyword. SyntaxToken representing open parenthesis. Typed reference expression. Comma separating the arguments. The type of the value. SyntaxToken representing close parenthesis. Class which represents the syntax node for Checked or Unchecked expression. SyntaxToken representing the checked or unchecked keyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for Default expression. SyntaxToken representing the DefaultKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for TypeOf expression. SyntaxToken representing the TypeOfKeyword. SyntaxToken representing open parenthesis. The expression to return type of. SyntaxToken representing close parenthesis. Class which represents the syntax node for SizeOf expression. SyntaxToken representing the SizeOfKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for invocation expression. ExpressionSyntax node representing the expression part of the invocation. ArgumentListSyntax node representing the list of arguments of the invocation expression. Class which represents the syntax node for element access expression. ExpressionSyntax node representing the expression which is accessing the element. BracketedArgumentListSyntax node representing the list of arguments of the element access expression. Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. Class which represents the syntax node for the list of arguments. SyntaxToken representing open parenthesis. SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. SyntaxToken representing close parenthesis. Class which represents the syntax node for bracketed argument list. SyntaxToken representing open bracket. SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. SyntaxToken representing close bracket. Class which represents the syntax node for argument. NameColonSyntax node representing the optional name arguments. SyntaxToken representing the optional ref or out keyword. ExpressionSyntax node representing the argument. Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. Declaration representing the variable declared in an out parameter or deconstruction. Class which represents the syntax node for cast expression. SyntaxToken representing the open parenthesis. TypeSyntax node representing the type to which the expression is being cast. SyntaxToken representing the close parenthesis. ExpressionSyntax node representing the expression that is being casted. Provides the base class from which the classes that represent anonymous function expressions are derived. BlockSyntax node representing the body of the anonymous function. Only one of Block or ExpressionBody will be non-null. ExpressionSyntax node representing the body of the anonymous function. Only one of Block or ExpressionBody will be non-null. Class which represents the syntax node for anonymous method expression. SyntaxToken representing the delegate keyword. List of parameters of the anonymous method expression, or null if there no parameters are specified. BlockSyntax node representing the body of the anonymous function. This will never be null. Inherited from AnonymousFunctionExpressionSyntax, but not used for AnonymousMethodExpressionSyntax. This will always be null. Provides the base class from which the classes that represent lambda expressions are derived. SyntaxToken representing equals greater than. Class which represents the syntax node for a simple lambda expression. ParameterSyntax node representing the parameter of the lambda expression. SyntaxToken representing equals greater than. BlockSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. ExpressionSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. Class which represents the syntax node for parenthesized lambda expression. ParameterListSyntax node representing the list of parameters for the lambda expression. SyntaxToken representing equals greater than. BlockSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. ExpressionSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. Class which represents the syntax node for initializer expression. SyntaxToken representing the open brace. SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. SyntaxToken representing the close brace. SyntaxToken representing the new keyword. ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. InitializerExpressionSyntax representing the initializer expression for the object being created. Class which represents the syntax node for implicit object creation expression. SyntaxToken representing the new keyword. ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. InitializerExpressionSyntax representing the initializer expression for the object being created. Class which represents the syntax node for object creation expression. SyntaxToken representing the new keyword. TypeSyntax representing the type of the object being created. ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. InitializerExpressionSyntax representing the initializer expression for the object being created. InitializerExpressionSyntax representing the initializer expression for the with expression. NameEqualsSyntax representing the optional name of the member being initialized. ExpressionSyntax representing the value the member is initialized with. Class which represents the syntax node for anonymous object creation expression. SyntaxToken representing the new keyword. SyntaxToken representing the open brace. SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. SyntaxToken representing the close brace. Class which represents the syntax node for array creation expression. SyntaxToken representing the new keyword. ArrayTypeSyntax node representing the type of the array. InitializerExpressionSyntax node representing the initializer of the array creation expression. Class which represents the syntax node for implicit array creation expression. SyntaxToken representing the new keyword. SyntaxToken representing the open bracket. SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. SyntaxToken representing the close bracket. InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. Class which represents the syntax node for stackalloc array creation expression. SyntaxToken representing the stackalloc keyword. TypeSyntax node representing the type of the stackalloc array. InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. Class which represents the syntax node for implicit stackalloc array creation expression. SyntaxToken representing the stackalloc keyword. SyntaxToken representing the open bracket. SyntaxToken representing the close bracket. InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. Gets the identifier. Gets the identifier. Gets the identifier. Gets the identifier. Gets the identifier. Class which represents a placeholder in an array size list. SyntaxToken representing the omitted array size expression. The first part of an interpolated string, $" or $@" or $""" List of parts of the interpolated string, each one is either a literal part or an interpolation. The closing quote of the interpolated string. Class which represents a simple pattern-matching expression using the "is" keyword. ExpressionSyntax node representing the expression on the left of the "is" operator. PatternSyntax node representing the pattern on the right of the "is" operator. ExpressionSyntax node representing the constant expression. SyntaxToken representing the operator of the relational pattern. The type for the type pattern. The text contents of a part of the interpolated string. This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). The text contents of the format specifier for an interpolation. Represents the base class for all statements syntax classes. Gets the identifier. Gets the optional semicolon token. Gets the modifier list. Gets the identifier. Represents a labeled statement syntax. Gets the identifier. Gets a SyntaxToken that represents the colon following the statement's label. Represents a goto statement syntax Gets a SyntaxToken that represents the goto keyword. Gets a SyntaxToken that represents the case or default keywords if any exists. Gets a constant expression for a goto case statement. Gets a SyntaxToken that represents the semi-colon at the end of the statement. Gets the identifier. The variable(s) of the loop. In correct code this is a tuple literal, declaration expression with a tuple designator, or a discard syntax in the form of a simple identifier. In broken code it could be something else. Represents an if statement syntax. Gets a SyntaxToken that represents the if keyword. Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. Gets an ExpressionSyntax that represents the condition of the if statement. Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. Gets a StatementSyntax the represents the statement to be executed when the condition is true. Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. Represents an else statement syntax. Gets a syntax token Represents a switch statement syntax. Gets a SyntaxToken that represents the switch keyword. Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. Gets an ExpressionSyntax representing the expression of the switch statement. Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. Gets a SyntaxToken that represents the open braces preceding the switch sections. Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. Gets a SyntaxToken that represents the open braces following the switch sections. Represents a switch section syntax of a switch statement. Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. Represents a switch label within a switch statement. Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. Gets a SyntaxToken that represents the colon that terminates the switch label. Represents a case label within a switch statement. Gets the case keyword token. Gets a PatternSyntax that represents the pattern that gets matched for the case label. Represents a case label within a switch statement. Gets the case keyword token. Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. Represents a default label within a switch statement. Gets the default keyword token. Gets the attribute declaration list. Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. SyntaxToken representing the extern keyword. SyntaxToken representing the alias keyword. Gets the identifier. SyntaxToken representing the semicolon token. Member declaration syntax. Gets the attribute declaration list. Gets the modifier list. Gets the optional semicolon token. Class representing one or more attributes applied to a language construct. Gets the open bracket token. Gets the optional construct targeted by the attribute. Gets the attribute declaration list. Gets the close bracket token. Class representing what language construct an attribute targets. Gets the identifier. Gets the colon token. Attribute syntax. Gets the name. Attribute argument list syntax. Gets the open paren token. Gets the arguments syntax list. Gets the close paren token. Attribute argument syntax. Gets the expression. Class representing an identifier name followed by an equals token. Gets the identifier name. Type parameter list syntax. Gets the < token. Gets the parameter list. Gets the > token. Type parameter syntax. Gets the attribute declaration list. Gets the identifier. Base class for type declaration syntax. Gets the identifier. Gets the base type list. Gets the open brace token. Gets the close brace token. Gets the optional semicolon token. Enum type declaration syntax. Gets the enum keyword token. Gets the members declaration list. Gets the optional semicolon token. Delegate declaration syntax. Gets the "delegate" keyword. Gets the return type. Gets the identifier. Gets the parameter list. Gets the constraint clause list. Gets the semicolon token. Gets the identifier. Base list syntax. Gets the colon token. Gets the base type references. Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. Type parameter constraint clause. Gets the identifier. Gets the colon token. Gets the constraints list. Base type for type parameter constraint syntax. Constructor constraint syntax. Gets the "new" keyword. Gets the open paren keyword. Gets the close paren keyword. Class or struct constraint syntax. Gets the constraint keyword ("class" or "struct"). SyntaxToken representing the question mark. Type constraint syntax. Gets the type syntax. Default constraint syntax. Gets the "default" keyword. The allows type parameter constraint clause. Gets the constraints list. Base type for allow constraint syntax. Ref struct constraint syntax. Gets the "ref" keyword. Gets the "struct" keyword. Base type for method declaration syntax. Gets the parameter list. Gets the optional semicolon token. Method declaration syntax. Gets the return type syntax. Gets the identifier. Gets the constraint clause list. Gets the optional semicolon token. Operator declaration syntax. Gets the return type. Gets the "operator" keyword. Gets the "checked" keyword. Gets the operator token. Gets the optional semicolon token. Conversion operator declaration syntax. Gets the "implicit" or "explicit" token. Gets the "operator" token. Gets the "checked" keyword. Gets the type. Gets the optional semicolon token. Constructor declaration syntax. Gets the identifier. Gets the optional semicolon token. Constructor initializer syntax. Gets the colon token. Gets the "this" or "base" keyword. Destructor declaration syntax. Gets the tilde token. Gets the identifier. Gets the optional semicolon token. Base type for property declaration syntax. Gets the type syntax. Gets the optional explicit interface specifier. Gets the identifier. The syntax for the expression body of an expression-bodied member. Gets the identifier. Gets the parameter list. Gets the attribute declaration list. Gets the modifier list. Gets the keyword token, or identifier if an erroneous accessor declaration. Gets the optional body block which may be empty, but it is null if there are no braces. Gets the optional expression body. Gets the optional semicolon token. Base type for parameter list syntax. Gets the parameter list. Parameter list syntax. Gets the open paren token. Gets the close paren token. Parameter list syntax with surrounding brackets. Gets the open bracket token. Gets the close bracket token. Base parameter syntax. Gets the attribute declaration list. Gets the modifier list. Parameter syntax. Gets the attribute declaration list. Gets the modifier list. Gets the identifier. Parameter syntax. Gets the attribute declaration list. Gets the modifier list. A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). For example, the M in <see cref="M" />. A symbol reference that definitely refers to a type. For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol might be a non-type member. A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. For example, cref="System.String.ToString()". NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol might be a non-type member. The unqualified part of a CrefSyntax. For example, "ToString()" in "object.ToString()". NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol might be a non-type member. A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, with an optional type parameter list) and an optional parameter list. For example, "M", "M<T>" or "M(int)". Also, "A::B()" or "string()". A MemberCrefSyntax specified by a this keyword and an optional parameter list. For example, "this" or "this[int]". A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. For example, "operator +" or "operator -[int]". NOTE: the operator must be overloadable. Gets the operator token. A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. For example, "implicit operator int" or "explicit operator MyType(int)". A list of cref parameters with surrounding punctuation. Unlike regular parameters, cref parameters do not have names. Gets the parameter list. A parenthesized list of cref parameters. Gets the open paren token. Gets the close paren token. A bracketed list of cref parameters. Gets the open bracket token. Gets the close bracket token. An element of a BaseCrefParameterListSyntax. Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, an optional readonly keyword, and a type - there is no name and there are no attributes or other modifiers. Class which represents the syntax node for alias qualified name. This node is associated with the following syntax kinds: IdentifierNameSyntax node representing the name of the alias SyntaxToken representing colon colon. SimpleNameSyntax node representing the name that is being alias qualified. Provides the base class from which the classes that represent anonymous function expressions are derived. Either the if it is not null or the otherwise. If the given is default, remove all async keywords, if any. Otherwise, replace the existing (the first one) or add a new one. BlockSyntax node representing the body of the anonymous function. Only one of Block or ExpressionBody will be non-null. ExpressionSyntax node representing the body of the anonymous function. Only one of Block or ExpressionBody will be non-null. Class which represents the syntax node for anonymous method expression. This node is associated with the following syntax kinds: SyntaxToken representing the delegate keyword. List of parameters of the anonymous method expression, or null if there no parameters are specified. BlockSyntax node representing the body of the anonymous function. This will never be null. Inherited from AnonymousFunctionExpressionSyntax, but not used for AnonymousMethodExpressionSyntax. This will always be null. Class which represents the syntax node for argument. This node is associated with the following syntax kinds: Pre C# 7.2 back-compat overload, which simply calls the replacement property . Pre C# 7.2 back-compat overload, which simply calls the replacement method . NameColonSyntax node representing the optional name arguments. SyntaxToken representing the optional ref or out keyword. ExpressionSyntax node representing the argument. This node is associated with the following syntax kinds: Attribute syntax. This node is associated with the following syntax kinds: Return the name used in syntax for the attribute. This is typically the class name without the "Attribute" suffix. (For certain diagnostics, the native compiler uses the attribute name from syntax rather than the class name.) Gets the name. Class representing what language construct an attribute targets. This node is associated with the following syntax kinds: Gets the identifier. Gets the colon token. Base type for method declaration syntax. Gets the parameter list. Gets the optional semicolon token. Base type for property declaration syntax. Gets the type syntax. Gets the optional explicit interface specifier. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Class type declaration syntax. This node is associated with the following syntax kinds: Gets the class keyword token. Class or struct constraint syntax. This node is associated with the following syntax kinds: Gets the constraint keyword ("class" or "struct"). SyntaxToken representing the question mark. This node is associated with the following syntax kinds: Returns #r directives specified in the compilation. Returns #load directives specified in the compilation. Gets the attribute declaration list. Constructor declaration syntax. This node is associated with the following syntax kinds: Gets the identifier. Gets the optional semicolon token. This node is associated with the following syntax kinds: Conversion operator declaration syntax. This node is associated with the following syntax kinds: Gets the "implicit" or "explicit" token. Gets the "operator" token. Gets the "checked" keyword. Gets the type. Gets the optional semicolon token. A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. For example, "implicit operator int" or "explicit operator MyType(int)". This node is associated with the following syntax kinds: An element of a BaseCrefParameterListSyntax. Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, an optional readonly keyword, and a type - there is no name and there are no attributes or other modifiers. This node is associated with the following syntax kinds: Pre C# 7.2 back-compat overload, which simply calls the replacement property . Pre C# 7.2 back-compat overload, which simply calls the replacement method . Adds C# specific parts to the line directive map. Describes how to report a warning diagnostic. Report a diagnostic by default. Either there is no corresponding #pragma, or the action is "restore". Diagnostic is enabled. NOTE: this may be removed as part of https://github.com/dotnet/roslyn/issues/36550 Diagnostic is disabled. This node is associated with the following syntax kinds: Gets the modifier list. Delegate declaration syntax. This node is associated with the following syntax kinds: Gets the "delegate" keyword. Gets the return type. Gets the identifier. Gets the parameter list. Gets the constraint clause list. Gets the semicolon token. Destructor declaration syntax. This node is associated with the following syntax kinds: Gets the tilde token. Gets the identifier. Gets the optional semicolon token. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: Returns true if the property is allowed by the rules of the language to be an arbitrary expression, not just a statement expression. True if, for example, this expression statement represents the last expression statement of the interactive top-level code. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: The variable(s) of the loop. In correct code this is a tuple literal, declaration expression with a tuple designator, or a discard syntax in the form of a simple identifier. In broken code it could be something else. This node is associated with the following syntax kinds: Class which represents the syntax node for generic name. This node is associated with the following syntax kinds: SyntaxToken representing the name of the identifier of the generic name. TypeArgumentListSyntax node representing the list of type arguments of the generic name. This node is associated with the following syntax kinds: Represents a goto statement syntax This node is associated with the following syntax kinds: Gets a SyntaxToken that represents the goto keyword. Gets a SyntaxToken that represents the case or default keywords if any exists. Gets a constant expression for a goto case statement. Gets a SyntaxToken that represents the semi-colon at the end of the statement. Class which represents the syntax node for identifier name. This node is associated with the following syntax kinds: SyntaxToken representing the keyword for the kind of the identifier name. Represents an if statement syntax. This node is associated with the following syntax kinds: Gets a SyntaxToken that represents the if keyword. Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. Gets an ExpressionSyntax that represents the condition of the if statement. Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. Gets a StatementSyntax the represents the statement to be executed when the condition is true. Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. This node is associated with the following syntax kinds: Gets the parameter list. Interface type declaration syntax. This node is associated with the following syntax kinds: Gets the interface keyword token. Represents a labeled statement syntax. This node is associated with the following syntax kinds: Gets the identifier. Gets a SyntaxToken that represents the colon following the statement's label. Provides the base class from which the classes that represent lambda expressions are derived. SyntaxToken representing equals greater than. This node is associated with the following syntax kinds: Gets the identifier. Gets the optional semicolon token. This node is associated with the following syntax kinds: This class contains a variety of helper methods for determining whether a position is within the scope (and not just the span) of a node. In general, general, the scope extends from the first token up to, but not including, the last token. For example, the open brace of a block is within the scope of the block, but the close brace is not. A position is considered to be inside a block if it is on or after the open brace and strictly before the close brace. A position is inside a property body only if it is inside an expression body. All block bodies for properties are part of the accessor declaration (a type of BaseMethodDeclaration), not the property declaration. A position is inside a property body only if it is inside an expression body. All block bodies for properties are part of the accessor declaration (a type of BaseMethodDeclaration), not the property declaration. A position is inside an accessor body if it is inside the block or expression body. A position is inside a body if it is inside the block or expression body. A position is considered to be inside a block if it is on or after the open brace and strictly before the close brace. A position is considered to be inside an expression body if it is on or after the '=>' and strictly before the semicolon. Returns true if position is within the given node and before the first excluded token. Used to determine whether it would be appropriate to use the binder for the statement (if any). Not used to determine whether the position is syntactically within the statement. Used to determine whether it would be appropriate to use the binder for the switch section (if any). Not used to determine whether the position is syntactically within the statement. Used to determine whether it would be appropriate to use the binder for the statement (if any). Not used to determine whether the position is syntactically within the statement. Used to determine whether it would be appropriate to use the binder for the statement (if any). Not used to determine whether the position is syntactically within the statement. Method declaration syntax. This node is associated with the following syntax kinds: Gets the return type syntax. Gets the identifier. Gets the constraint clause list. Gets the optional semicolon token. Class which represents the syntax node for name colon syntax. This node is associated with the following syntax kinds: IdentifierNameSyntax representing the identifier name. SyntaxToken representing colon. This node is associated with the following syntax kinds: Gets the optional semicolon token. Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. Returns the unqualified (right-most) part of a qualified or alias-qualified name, or the name itself if already unqualified. The unqualified (right-most) part of a qualified or alias-qualified name, or the name itself if already unqualified. If called on an instance of returns the value of the property. If called on an instance of returns the value of the property. If called on an instance of returns the instance itself. Return the name in string form, without trivia or generic arguments, for use in diagnostics. This inspection is entirely syntactic. We are not trying to find the alias corresponding to the assembly symbol containing the explicitly implemented interface symbol - there may be more than one. We just want to know how the name was qualified in source so that we can make a similar qualification (for uniqueness purposes). Contains the nullable warnings and annotations context state at a given position in source. Returns whether nullable warnings are enabled within the span. Returns true if nullable warnings are enabled anywhere in the span; false if nullable warnings are disabled throughout the span; and null otherwise. Operator declaration syntax. This node is associated with the following syntax kinds: Gets the return type. Gets the "operator" keyword. Gets the "checked" keyword. Gets the operator token. Gets the optional semicolon token. A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. For example, "operator +" or "operator -[int]". NOTE: the operator must be overloadable. This node is associated with the following syntax kinds: Gets the operator token. Parameter list syntax. This node is associated with the following syntax kinds: Gets the open paren token. Gets the close paren token. Parameter syntax. This node is associated with the following syntax kinds: Gets the attribute declaration list. Gets the modifier list. Gets the identifier. Class which represents the syntax node for parenthesized lambda expression. This node is associated with the following syntax kinds: ParameterListSyntax node representing the list of parameters for the lambda expression. SyntaxToken representing equals greater than. BlockSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. ExpressionSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: Gets the attribute declaration list. Gets the modifier list. Gets the keyword token, or identifier if an erroneous accessor declaration. Gets the optional body block which may be empty, but it is null if there are no braces. Gets the optional expression body. Gets the optional semicolon token. Class which represents the syntax node for qualified name. This node is associated with the following syntax kinds: NameSyntax node representing the name on the left side of the dot token of the qualified name. SyntaxToken representing the dot. SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. This node is associated with the following syntax kinds: The ref modifier of a method's return value or a local. This node is associated with the following syntax kinds: Gets the optional "readonly" keyword. This node is associated with the following syntax kinds: Class which represents the syntax node for a simple lambda expression. This node is associated with the following syntax kinds: ParameterSyntax node representing the parameter of the lambda expression. SyntaxToken representing equals greater than. BlockSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. ExpressionSyntax node representing the body of the lambda. Only one of Block or ExpressionBody will be non-null. Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. SyntaxToken representing the identifier of the simple name. This node is associated with the following syntax kinds: Class which represents the syntax node for stackalloc array creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the stackalloc keyword. TypeSyntax node representing the type of the stackalloc array. InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. Struct type declaration syntax. This node is associated with the following syntax kinds: Gets the struct keyword token. It's a non terminal Trivia CSharpSyntaxNode that has a tree underneath it. Get parent trivia. This node is associated with the following syntax kinds: Represents a switch statement syntax. This node is associated with the following syntax kinds: Gets a SyntaxToken that represents the switch keyword. Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. Gets an ExpressionSyntax representing the expression of the switch statement. Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. Gets a SyntaxToken that represents the open braces preceding the switch sections. Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. Gets a SyntaxToken that represents the open braces following the switch sections. Returns whether the specified token is also the end of the line. This will be true for , , and all preprocessor directives. Returns the first end of line found in a . Tells if the given SyntaxNode is inside single-line initializer context. Initializers in such context are not expected to be large, so formatting them in single-line fashion looks more compact. Current cases: Interpolation holes in strings Attribute arguments Normal arguments Tells if given SyntaxNode is an initializer in a single-line initializer context. See This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Base class for type declaration syntax (class, struct, interface, record). Gets the type keyword token ("class", "struct", "interface", "record"). Gets the type constraint list. Gets the member declarations. Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Returns the name this points at, or if it does not point at a name. A normal using X.Y.Z; or using static X.Y.Z; will always point at a name and will always return a value for this. However, a using-alias (e.g. using x = ...;) may or may not point at a name and may return here. An example of when that may happen is the type on the right side of the = is not a name. For example using x = (X.Y.Z, A.B.C);. Here, as the type is a tuple-type there is no name to return. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Class which represents the syntax node for type argument list. This node is associated with the following syntax kinds: SyntaxToken representing less than. SeparatedSyntaxList of TypeSyntax node representing the type arguments. SyntaxToken representing greater than. Class which represents the syntax node for predefined types. This node is associated with the following syntax kinds: SyntaxToken which represents the keyword corresponding to the predefined type. Class which represents the syntax node for the array type. This node is associated with the following syntax kinds: TypeSyntax node representing the type of the element of the array. SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. Class which represents the syntax node for pointer type. This node is associated with the following syntax kinds: TypeSyntax node that represents the element type of the pointer. SyntaxToken representing the asterisk. This node is associated with the following syntax kinds: SyntaxToken representing the delegate keyword. SyntaxToken representing the asterisk. Node representing the optional calling convention. List of the parameter types and return type of the function pointer. Function pointer parameter list syntax. This node is associated with the following syntax kinds: SyntaxToken representing the less than token. SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. SyntaxToken representing the greater than token. Function pointer calling convention syntax. This node is associated with the following syntax kinds: SyntaxToken representing whether the calling convention is managed or unmanaged. Optional list of identifiers that will contribute to an unmanaged calling convention. Function pointer calling convention syntax. This node is associated with the following syntax kinds: SyntaxToken representing open bracket. SeparatedSyntaxList of calling convention identifiers. SyntaxToken representing close bracket. Individual function pointer unmanaged calling convention. This node is associated with the following syntax kinds: SyntaxToken representing the calling convention identifier. Class which represents the syntax node for a nullable type. This node is associated with the following syntax kinds: TypeSyntax node representing the type of the element. SyntaxToken representing the question mark. Class which represents the syntax node for tuple type. This node is associated with the following syntax kinds: SyntaxToken representing the open parenthesis. SyntaxToken representing the close parenthesis. Tuple type element. This node is associated with the following syntax kinds: Gets the type of the tuple element. Gets the name of the tuple element. Class which represents a placeholder in the type argument list of an unbound generic type. This node is associated with the following syntax kinds: SyntaxToken representing the omitted type argument. The 'scoped' modifier of a local. This node is associated with the following syntax kinds: Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. Class which represents the syntax node for parenthesized expression. This node is associated with the following syntax kinds: SyntaxToken representing the open parenthesis. ExpressionSyntax node representing the expression enclosed within the parenthesis. SyntaxToken representing the close parenthesis. Class which represents the syntax node for tuple expression. This node is associated with the following syntax kinds: SyntaxToken representing the open parenthesis. SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. SyntaxToken representing the close parenthesis. Class which represents the syntax node for prefix unary expression. This node is associated with the following syntax kinds: SyntaxToken representing the kind of the operator of the prefix unary expression. ExpressionSyntax representing the operand of the prefix unary expression. Class which represents the syntax node for an "await" expression. This node is associated with the following syntax kinds: SyntaxToken representing the kind "await" keyword. ExpressionSyntax representing the operand of the "await" operator. Class which represents the syntax node for postfix unary expression. This node is associated with the following syntax kinds: ExpressionSyntax representing the operand of the postfix unary expression. SyntaxToken representing the kind of the operator of the postfix unary expression. Class which represents the syntax node for member access expression. This node is associated with the following syntax kinds: ExpressionSyntax node representing the object that the member belongs to. SyntaxToken representing the kind of the operator in the member access expression. SimpleNameSyntax node representing the member being accessed. Class which represents the syntax node for conditional access expression. This node is associated with the following syntax kinds: ExpressionSyntax node representing the object conditionally accessed. SyntaxToken representing the question mark. ExpressionSyntax node representing the access expression to be executed when the object is not null. Class which represents the syntax node for member binding expression. This node is associated with the following syntax kinds: SyntaxToken representing dot. SimpleNameSyntax node representing the member being bound to. Class which represents the syntax node for element binding expression. This node is associated with the following syntax kinds: BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. Class which represents the syntax node for a range expression. This node is associated with the following syntax kinds: ExpressionSyntax node representing the expression on the left of the range operator. SyntaxToken representing the operator of the range expression. ExpressionSyntax node representing the expression on the right of the range operator. Class which represents the syntax node for implicit element access expression. This node is associated with the following syntax kinds: BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. Class which represents an expression that has a binary operator. This node is associated with the following syntax kinds: ExpressionSyntax node representing the expression on the left of the binary operator. SyntaxToken representing the operator of the binary expression. ExpressionSyntax node representing the expression on the right of the binary operator. Class which represents an expression that has an assignment operator. This node is associated with the following syntax kinds: ExpressionSyntax node representing the expression on the left of the assignment operator. SyntaxToken representing the operator of the assignment expression. ExpressionSyntax node representing the expression on the right of the assignment operator. Class which represents the syntax node for conditional expression. This node is associated with the following syntax kinds: ExpressionSyntax node representing the condition of the conditional expression. SyntaxToken representing the question mark. ExpressionSyntax node representing the expression to be executed when the condition is true. SyntaxToken representing the colon. ExpressionSyntax node representing the expression to be executed when the condition is false. Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. Class which represents the syntax node for a this expression. This node is associated with the following syntax kinds: SyntaxToken representing the this keyword. Class which represents the syntax node for a base expression. This node is associated with the following syntax kinds: SyntaxToken representing the base keyword. Class which represents the syntax node for a literal expression. This node is associated with the following syntax kinds: SyntaxToken representing the keyword corresponding to the kind of the literal expression. Class which represents the syntax node for a field expression. This node is associated with the following syntax kinds: SyntaxToken representing the field keyword. Class which represents the syntax node for MakeRef expression. This node is associated with the following syntax kinds: SyntaxToken representing the MakeRefKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for RefType expression. This node is associated with the following syntax kinds: SyntaxToken representing the RefTypeKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for RefValue expression. This node is associated with the following syntax kinds: SyntaxToken representing the RefValueKeyword. SyntaxToken representing open parenthesis. Typed reference expression. Comma separating the arguments. The type of the value. SyntaxToken representing close parenthesis. Class which represents the syntax node for Checked or Unchecked expression. This node is associated with the following syntax kinds: SyntaxToken representing the checked or unchecked keyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for Default expression. This node is associated with the following syntax kinds: SyntaxToken representing the DefaultKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for TypeOf expression. This node is associated with the following syntax kinds: SyntaxToken representing the TypeOfKeyword. SyntaxToken representing open parenthesis. The expression to return type of. SyntaxToken representing close parenthesis. Class which represents the syntax node for SizeOf expression. This node is associated with the following syntax kinds: SyntaxToken representing the SizeOfKeyword. SyntaxToken representing open parenthesis. Argument of the primary function. SyntaxToken representing close parenthesis. Class which represents the syntax node for invocation expression. This node is associated with the following syntax kinds: ExpressionSyntax node representing the expression part of the invocation. ArgumentListSyntax node representing the list of arguments of the invocation expression. Class which represents the syntax node for element access expression. This node is associated with the following syntax kinds: ExpressionSyntax node representing the expression which is accessing the element. BracketedArgumentListSyntax node representing the list of arguments of the element access expression. Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. Class which represents the syntax node for the list of arguments. This node is associated with the following syntax kinds: SyntaxToken representing open parenthesis. SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. SyntaxToken representing close parenthesis. Class which represents the syntax node for bracketed argument list. This node is associated with the following syntax kinds: SyntaxToken representing open bracket. SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. SyntaxToken representing close bracket. This node is associated with the following syntax kinds: Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. This node is associated with the following syntax kinds: Declaration representing the variable declared in an out parameter or deconstruction. Class which represents the syntax node for cast expression. This node is associated with the following syntax kinds: SyntaxToken representing the open parenthesis. TypeSyntax node representing the type to which the expression is being cast. SyntaxToken representing the close parenthesis. ExpressionSyntax node representing the expression that is being casted. This node is associated with the following syntax kinds: Class which represents the syntax node for initializer expression. This node is associated with the following syntax kinds: SyntaxToken representing the open brace. SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. SyntaxToken representing the close brace. SyntaxToken representing the new keyword. ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. InitializerExpressionSyntax representing the initializer expression for the object being created. Class which represents the syntax node for implicit object creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the new keyword. ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. InitializerExpressionSyntax representing the initializer expression for the object being created. Class which represents the syntax node for object creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the new keyword. TypeSyntax representing the type of the object being created. ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. InitializerExpressionSyntax representing the initializer expression for the object being created. This node is associated with the following syntax kinds: InitializerExpressionSyntax representing the initializer expression for the with expression. This node is associated with the following syntax kinds: NameEqualsSyntax representing the optional name of the member being initialized. ExpressionSyntax representing the value the member is initialized with. Class which represents the syntax node for anonymous object creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the new keyword. SyntaxToken representing the open brace. SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. SyntaxToken representing the close brace. Class which represents the syntax node for array creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the new keyword. ArrayTypeSyntax node representing the type of the array. InitializerExpressionSyntax node representing the initializer of the array creation expression. Class which represents the syntax node for implicit array creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the new keyword. SyntaxToken representing the open bracket. SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. SyntaxToken representing the close bracket. InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. Class which represents the syntax node for implicit stackalloc array creation expression. This node is associated with the following syntax kinds: SyntaxToken representing the stackalloc keyword. SyntaxToken representing the open bracket. SyntaxToken representing the close bracket. InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. This node is associated with the following syntax kinds: SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Gets the identifier. Class which represents a placeholder in an array size list. This node is associated with the following syntax kinds: SyntaxToken representing the omitted array size expression. This node is associated with the following syntax kinds: The first part of an interpolated string, $" or $@" or $""" List of parts of the interpolated string, each one is either a literal part or an interpolation. The closing quote of the interpolated string. Class which represents a simple pattern-matching expression using the "is" keyword. This node is associated with the following syntax kinds: ExpressionSyntax node representing the expression on the left of the "is" operator. PatternSyntax node representing the pattern on the right of the "is" operator. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: ExpressionSyntax node representing the constant expression. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: SyntaxToken representing the operator of the relational pattern. This node is associated with the following syntax kinds: The type for the type pattern. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: The text contents of a part of the interpolated string. This node is associated with the following syntax kinds: This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: The text contents of the format specifier for an interpolation. Represents the base class for all statements syntax classes. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Gets the identifier. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Represents an else statement syntax. This node is associated with the following syntax kinds: Gets a syntax token Represents a switch section syntax of a switch statement. This node is associated with the following syntax kinds: Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. Represents a switch label within a switch statement. Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. Gets a SyntaxToken that represents the colon that terminates the switch label. Represents a case label within a switch statement. This node is associated with the following syntax kinds: Gets the case keyword token. Gets a PatternSyntax that represents the pattern that gets matched for the case label. Represents a case label within a switch statement. This node is associated with the following syntax kinds: Gets the case keyword token. Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. Represents a default label within a switch statement. This node is associated with the following syntax kinds: Gets the default keyword token. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. This node is associated with the following syntax kinds: SyntaxToken representing the extern keyword. SyntaxToken representing the alias keyword. Gets the identifier. SyntaxToken representing the semicolon token. Member declaration syntax. Gets the attribute declaration list. Gets the modifier list. This node is associated with the following syntax kinds: Class representing one or more attributes applied to a language construct. This node is associated with the following syntax kinds: Gets the open bracket token. Gets the optional construct targeted by the attribute. Gets the attribute declaration list. Gets the close bracket token. Attribute argument list syntax. This node is associated with the following syntax kinds: Gets the open paren token. Gets the arguments syntax list. Gets the close paren token. Attribute argument syntax. This node is associated with the following syntax kinds: Gets the expression. Class representing an identifier name followed by an equals token. This node is associated with the following syntax kinds: Gets the identifier name. Type parameter list syntax. This node is associated with the following syntax kinds: Gets the < token. Gets the parameter list. Gets the > token. Type parameter syntax. This node is associated with the following syntax kinds: Gets the attribute declaration list. Gets the identifier. Base class for type declaration syntax. Gets the identifier. Gets the base type list. Gets the open brace token. Gets the close brace token. Gets the optional semicolon token. Enum type declaration syntax. This node is associated with the following syntax kinds: Gets the enum keyword token. Gets the members declaration list. Gets the optional semicolon token. Base list syntax. This node is associated with the following syntax kinds: Gets the colon token. Gets the base type references. Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Type parameter constraint clause. This node is associated with the following syntax kinds: Gets the identifier. Gets the colon token. Gets the constraints list. Base type for type parameter constraint syntax. Constructor constraint syntax. This node is associated with the following syntax kinds: Gets the "new" keyword. Gets the open paren keyword. Gets the close paren keyword. Type constraint syntax. This node is associated with the following syntax kinds: Gets the type syntax. Default constraint syntax. This node is associated with the following syntax kinds: Gets the "default" keyword. The allows type parameter constraint clause. This node is associated with the following syntax kinds: Gets the constraints list. Base type for allow constraint syntax. Ref struct constraint syntax. This node is associated with the following syntax kinds: Gets the "ref" keyword. Gets the "struct" keyword. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Constructor initializer syntax. This node is associated with the following syntax kinds: Gets the colon token. Gets the "this" or "base" keyword. The syntax for the expression body of an expression-bodied member. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Base type for parameter list syntax. Gets the parameter list. Parameter list syntax with surrounding brackets. This node is associated with the following syntax kinds: Gets the open bracket token. Gets the close bracket token. Base parameter syntax. Gets the attribute declaration list. Gets the modifier list. Parameter syntax. This node is associated with the following syntax kinds: Gets the attribute declaration list. Gets the modifier list. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). For example, the M in <see cref="M" />. A symbol reference that definitely refers to a type. For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol might be a non-type member. This node is associated with the following syntax kinds: A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. For example, cref="System.String.ToString()". NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol might be a non-type member. This node is associated with the following syntax kinds: The unqualified part of a CrefSyntax. For example, "ToString()" in "object.ToString()". NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol might be a non-type member. A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, with an optional type parameter list) and an optional parameter list. For example, "M", "M<T>" or "M(int)". Also, "A::B()" or "string()". This node is associated with the following syntax kinds: A MemberCrefSyntax specified by a this keyword and an optional parameter list. For example, "this" or "this[int]". This node is associated with the following syntax kinds: A list of cref parameters with surrounding punctuation. Unlike regular parameters, cref parameters do not have names. Gets the parameter list. A parenthesized list of cref parameters. This node is associated with the following syntax kinds: Gets the open paren token. Gets the close paren token. A bracketed list of cref parameters. This node is associated with the following syntax kinds: Gets the open bracket token. Gets the close bracket token. This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: This node is associated with the following syntax kinds: Defines a set of methods to determine how Unicode characters are treated by the C# compiler. Returns true if the Unicode character is a hexadecimal digit. The Unicode character. true if the character is a hexadecimal digit 0-9, A-F, a-f. Returns true if the Unicode character is a binary (0-1) digit. The Unicode character. true if the character is a binary digit. Returns true if the Unicode character is a decimal digit. The Unicode character. true if the Unicode character is a decimal digit. Returns the value of a hexadecimal Unicode character. The Unicode character. Returns the value of a binary Unicode character. The Unicode character. Returns the value of a decimal Unicode character. The Unicode character. Returns true if the Unicode character represents a whitespace. The Unicode character. Returns true if the Unicode character is a newline character. The Unicode character. Returns true if the Unicode character can be the starting character of a C# identifier. The Unicode character. Returns true if the Unicode character can be a part of a C# identifier. The Unicode character. Check that the name is a valid identifier. Spec section 2.4.2 says that identifiers are compared without regard to leading "@" characters or unicode formatting characters. As in dev10, this is actually accomplished by dropping such characters during parsing. Unfortunately, metadata names can still contain these characters and will not be referenceable from source if they do (lookup will fail since the characters will have been dropped from the search string). See DevDiv #14432 for more. Returns true if the node is the alias of an AliasQualifiedNameSyntax Returns true if the node is the object of an invocation expression. Returns true if the node is the object of an element access expression. Returns true if the node is in a tree location that is expected to be a type Returns true if a node is in a tree location that is expected to be either a namespace or type Is the node the name of a named argument of an invocation, object creation expression, constructor initializer, or element access, but not an attribute. Is the expression the initializer in a fixed statement? Given an initializer expression infer the name of anonymous property or tuple element. Returns null if unsuccessful Checks whether the element name is reserved. For example: "Item3" is reserved (at certain positions). "Rest", "ToString" and other members of System.ValueTuple are reserved (in any position). Names that are not reserved return false. A custom equality comparer for PERF: The framework specializes EqualityComparer for enums, but only if the underlying type is System.Int32 Since SyntaxKind's underlying type is System.UInt16, ObjectEqualityComparer will be chosen instead. Some preprocessor keywords are only keywords when they appear after a hash sign (#). For these keywords, the lexer will produce tokens with Kind = SyntaxKind.IdentifierToken and ContextualKind set to the keyword SyntaxKind. This wrinkle is specifically not publicly exposed. Member declarations that can appear in global code (other than type declarations). A implementation for the CSharp language. Creates a new instance of The that should be used when parsing generated files. The generators that will run as part of this driver. An that can be used to retrieve analyzer config values by the generators in this driver. A list of s available to generators in this driver. Creates a new instance of with the specified s and default options The generators to create this driver with A new instance. Creates a new instance of with the specified s and default options The incremental generators to create this driver with A new instance. Creates a new instance of with the specified s and the provided options or default. The generators to create this driver with A list of s available to generators in this driver, or null if there are none. The that should be used when parsing generated files, or null to use An that can be used to retrieve analyzer config values by the generators in this driver, or null if there are none. A that controls the behavior of the created driver. A new instance. Displays a value in the C# style. Separate from because we want to link this functionality into the Formatter project and we don't want it to be public there. Returns a string representation of an object of primitive type. A value to display as a string. Options used to customize formatting of an object value. A string representation of an object of primitive type (or null if the type is not supported). Handles , , , , , , , , , , , , , and null. Returns true if the character should be replaced and sets to the replacement text. Returns a C# string literal with the given value. The value that the resulting string literal should have. Options used to customize formatting of an object value. A string literal with the given value. Optionally escapes non-printable characters. Returns a C# character literal with the given value. The value that the resulting character literal should have. Options used to customize formatting of an object value. A character literal with the given value. Displays a symbol in the C# style. Displays a symbol in the C# style, based on a . The symbol to be displayed. The formatting options to apply. If null is passed, will be used. A formatted string that can be displayed to the user. The return value is not expected to be syntactically valid C#. Displays a symbol in the C# style, based on a . Based on the context, qualify type and member names as little as possible without introducing ambiguities. The symbol to be displayed. Semantic information about the context in which the symbol is being displayed. A position within the or . The formatting options to apply. If null is passed, will be used. A formatted string that can be displayed to the user. The return value is not expected to be syntactically valid C#. Convert a symbol to an array of string parts, each of which has a kind. Useful for colorizing the display string. The symbol to be displayed. The formatting options to apply. If null is passed, will be used. A list of display parts. Parts are not localized until they are converted to strings. Convert a symbol to an array of string parts, each of which has a kind. Useful for colorizing the display string. The symbol to be displayed. Semantic information about the context in which the symbol is being displayed. A position within the or . The formatting options to apply. If null is passed, will be used. A list of display parts. Parts are not localized until they are converted to strings. Returns a string representation of an object of primitive type. A value to display as a string. Whether or not to quote string literals. Whether or not to display integral literals in hexadecimal. A string representation of an object of primitive type (or null if the type is not supported). Handles , , , , , , , , , , , , , and null. Returns a C# string literal with the given value. The value that the resulting string literal should have. True to put (double) quotes around the string literal. A string literal with the given value. Escapes non-printable characters. Returns a C# character literal with the given value. The value that the resulting character literal should have. True to put (single) quotes around the character literal. A character literal with the given value. Escapes non-printable characters. Returns true if tuple type syntax can be used to refer to the tuple type without loss of information. For example, it cannot be used when extension tuple is using non-default friendly names. The nullable annotations that can apply in source. The order of values here is used in the computation of , , and . If the order here is changed then those implementations may have to be revised (or simplified). Type is not annotated - string, int, T (including the case when T is unconstrained). The type is not annotated in a context where the nullable feature is not enabled. Used for interoperation with existing pre-nullable code. Type is annotated with '?' - string?, T?. Used for indexed type parameters and used locally in override/implementation checks. When substituting a type parameter with Ignored annotation into some original type parameter with some other annotation, the result is the annotation from the original symbol. T annotated + (T -> U ignored) = U annotated T oblivious + (T -> U ignored) = U oblivious T not-annotated + (T -> U ignored) = U not-annotated Join nullable annotations from the set of lower bounds for fixing a type parameter. This uses the covariant merging rules. (Annotated wins over Oblivious which wins over NotAnnotated) Meet two nullable annotations for computing the nullable annotation of a type parameter from upper bounds. This uses the contravariant merging rules. (NotAnnotated wins over Oblivious which wins over Annotated) Return the nullable annotation to use when two annotations are expected to be "compatible", which means they could be the same. These are the "invariant" merging rules. (NotAnnotated wins over Annotated which wins over Oblivious) Merges nullability. The attribute (metadata) representation of . The attribute (metadata) representation of . The attribute (metadata) representation of . The nullable state of an rvalue computed in . When in doubt we conservatively use to minimize diagnostics. Not null. Maybe null (type is nullable). Maybe null (type may be not nullable). Join nullable flow states from distinct branches during flow analysis. The result is if either operand is that. Meet two nullable flow states from distinct states for the meet (union) operation in flow analysis. The result is if either operand is that. Some error messages are particularly confusing if multiple placeholders are substituted with the same string. For example, "cannot convert from 'Goo' to 'Goo'". Usually, this occurs because there are two types in different contexts with the same qualified name. The solution is to provide additional qualification on each symbol - either a source location, an assembly path, or an assembly identity. Performs the same function as ErrArgFlags::Unique in the native compiler. Virtual dispatch based on a symbol's particular class. Additional argument type Result type Call the correct VisitXXX method in this class based on the particular type of symbol that is passed in. Return default(TResult) if symbol is null The default Visit method called when visiting any and if visiting specific symbol method VisitXXX is not overridden The visited symbol Additional argument Called when visiting an ; Override this method with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this method with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Should override this method if want to visit members of the namespace; Calling and loop over each member; calling on it Or override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting an ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting an Error symbol is created when there is compiler error; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting an ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting an ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Called when visiting a ; Override this with specific implementation; Calling default if it's not overridden The visited symbol Additional argument Returns the System.String that represents the current TypedConstant. A System.String that represents the current TypedConstant. Determine whether there is any substitution of type parameters that will make two types identical. Determine whether there is any substitution of type parameters that will make two types identical. LHS RHS Substitutions performed so far (or null for none). Keys are type parameters, values are types (possibly type parameters). Will be updated with new substitutions by the callee. Should be ignored when false is returned. True if there exists a type map such that Map(LHS) == Map(RHS). Derived from Dev10's BSYMMGR::UnifyTypes. Two types will not unify if they have different custom modifiers. Return true if the given type contains the specified type parameter. A class containing factory methods for constructing syntax nodes, tokens and trivia. Creates a new AnonymousMethodExpressionSyntax instance. Creates a new LiteralExpressionSyntax instance. Creates a new AccessorDeclarationSyntax instance. Creates a new RefTypeSyntax instance. A trivia with kind EndOfLineTrivia containing both the carriage return and line feed characters. A trivia with kind EndOfLineTrivia containing a single line feed character. A trivia with kind EndOfLineTrivia containing a single carriage return character. A trivia with kind WhitespaceTrivia containing a single space character. A trivia with kind WhitespaceTrivia containing a single tab character. An elastic trivia with kind EndOfLineTrivia containing both the carriage return and line feed characters. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. An elastic trivia with kind EndOfLineTrivia containing a single line feed character. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. An elastic trivia with kind EndOfLineTrivia containing a single carriage return character. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. An elastic trivia with kind WhitespaceTrivia containing a single space character. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. An elastic trivia with kind WhitespaceTrivia containing a single tab character. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. An elastic trivia with kind WhitespaceTrivia containing no characters. Elastic marker trivia are included automatically by factory methods when trivia is not specified. Syntax formatting will replace elastic markers with appropriate trivia. Creates a trivia with kind EndOfLineTrivia containing the specified text. The text of the end of line. Any text can be specified here, however only carriage return and line feed characters are recognized by the parser as end of line. Creates a trivia with kind EndOfLineTrivia containing the specified text. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. The text of the end of line. Any text can be specified here, however only carriage return and line feed characters are recognized by the parser as end of line. Creates a trivia with kind WhitespaceTrivia containing the specified text. The text of the whitespace. Any text can be specified here, however only specific whitespace characters are recognized by the parser. Creates a trivia with kind WhitespaceTrivia containing the specified text. Elastic trivia are used to denote trivia that was not produced by parsing source text, and are usually not preserved during formatting. The text of the whitespace. Any text can be specified here, however only specific whitespace characters are recognized by the parser. Creates a trivia with kind either SingleLineCommentTrivia or MultiLineCommentTrivia containing the specified text. The entire text of the comment including the leading '//' token for single line comments or stop or start tokens for multiline comments. Creates a trivia with kind DisabledTextTrivia. Disabled text corresponds to any text between directives that is not considered active. Creates a trivia with kind PreprocessingMessageTrivia. Trivia nodes represent parts of the program text that are not parts of the syntactic grammar, such as spaces, newlines, comments, preprocessor directives, and disabled code. A representing the specific kind of . One of , , , , , The actual text of this token. Creates a token corresponding to a syntax kind. This method can be used for token syntax kinds whose text can be inferred by the kind alone. A syntax kind value for a token. These have the suffix Token or Keyword. Creates a token corresponding to syntax kind. This method can be used for token syntax kinds whose text can be inferred by the kind alone. A list of trivia immediately preceding the token. A syntax kind value for a token. These have the suffix Token or Keyword. A list of trivia immediately following the token. Creates a token corresponding to syntax kind. This method gives control over token Text and ValueText. For example, consider the text '<see cref="operator &#43;"/>'. To create a token for the value of the operator symbol (&#43;), one would call Token(default(SyntaxTriviaList), SyntaxKind.PlusToken, "&#43;", "+", default(SyntaxTriviaList)). A list of trivia immediately preceding the token. A syntax kind value for a token. These have the suffix Token or Keyword. The text from which this token was created (e.g. lexed). How C# should interpret the text of this token. A list of trivia immediately following the token. Creates a missing token corresponding to syntax kind. A missing token is produced by the parser when an expected token is not found. A missing token has no text and normally has associated diagnostics. A syntax kind value for a token. These have the suffix Token or Keyword. Creates a missing token corresponding to syntax kind. A missing token is produced by the parser when an expected token is not found. A missing token has no text and normally has associated diagnostics. A list of trivia immediately preceding the token. A syntax kind value for a token. These have the suffix Token or Keyword. A list of trivia immediately following the token. Creates a token with kind IdentifierToken containing the specified text. The raw text of the identifier name, including any escapes or leading '@' character. Creates a token with kind IdentifierToken containing the specified text. A list of trivia immediately preceding the token. The raw text of the identifier name, including any escapes or leading '@' character. A list of trivia immediately following the token. Creates a verbatim token with kind IdentifierToken containing the specified text. A list of trivia immediately preceding the token. The identifier, not including any escapes or leading '@' character. The canonical value of the token's text. A list of trivia immediately following the token. Creates a token with kind IdentifierToken containing the specified text. A list of trivia immediately preceding the token. An alternative SyntaxKind that can be inferred for this token in special contexts. These are usually keywords. The raw text of the identifier name, including any escapes or leading '@' character. The text of the identifier name without escapes or leading '@' character. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from a 4-byte signed integer value. The 4-byte signed integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 4-byte signed integer value. The raw text of the literal. The 4-byte signed integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 4-byte signed integer value. A list of trivia immediately preceding the token. The raw text of the literal. The 4-byte signed integer value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from a 4-byte unsigned integer value. The 4-byte unsigned integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 4-byte unsigned integer value. The raw text of the literal. The 4-byte unsigned integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 4-byte unsigned integer value. A list of trivia immediately preceding the token. The raw text of the literal. The 4-byte unsigned integer value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from an 8-byte signed integer value. The 8-byte signed integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 8-byte signed integer value. The raw text of the literal. The 8-byte signed integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 8-byte signed integer value. A list of trivia immediately preceding the token. The raw text of the literal. The 8-byte signed integer value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from an 8-byte unsigned integer value. The 8-byte unsigned integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 8-byte unsigned integer value. The raw text of the literal. The 8-byte unsigned integer value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 8-byte unsigned integer value. A list of trivia immediately preceding the token. The raw text of the literal. The 8-byte unsigned integer value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from a 4-byte floating point value. The 4-byte floating point value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 4-byte floating point value. The raw text of the literal. The 4-byte floating point value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 4-byte floating point value. A list of trivia immediately preceding the token. The raw text of the literal. The 4-byte floating point value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from an 8-byte floating point value. The 8-byte floating point value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 8-byte floating point value. The raw text of the literal. The 8-byte floating point value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding 8-byte floating point value. A list of trivia immediately preceding the token. The raw text of the literal. The 8-byte floating point value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind NumericLiteralToken from a decimal value. The decimal value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding decimal value. The raw text of the literal. The decimal value to be represented by the returned token. Creates a token with kind NumericLiteralToken from the text and corresponding decimal value. A list of trivia immediately preceding the token. The raw text of the literal. The decimal value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind StringLiteralToken from a string value. The string value to be represented by the returned token. Creates a token with kind StringLiteralToken from the text and corresponding string value. The raw text of the literal, including quotes and escape sequences. The string value to be represented by the returned token. Creates a token with kind StringLiteralToken from the text and corresponding string value. A list of trivia immediately preceding the token. The raw text of the literal, including quotes and escape sequences. The string value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind CharacterLiteralToken from a character value. The character value to be represented by the returned token. Creates a token with kind CharacterLiteralToken from the text and corresponding character value. The raw text of the literal, including quotes and escape sequences. The character value to be represented by the returned token. Creates a token with kind CharacterLiteralToken from the text and corresponding character value. A list of trivia immediately preceding the token. The raw text of the literal, including quotes and escape sequences. The character value to be represented by the returned token. A list of trivia immediately following the token. Creates a token with kind BadToken. A list of trivia immediately preceding the token. The raw text of the bad token. A list of trivia immediately following the token. Creates a token with kind XmlTextLiteralToken. A list of trivia immediately preceding the token. The raw text of the literal. The xml text value. A list of trivia immediately following the token. Creates a token with kind XmlEntityLiteralToken. A list of trivia immediately preceding the token. The raw text of the literal. The xml entity value. A list of trivia immediately following the token. Creates an xml documentation comment that abstracts xml syntax creation. A list of xml node syntax that will be the content within the xml documentation comment (e.g. a summary element, a returns element, exception element and so on). Creates a summary element within an xml documentation comment. A list of xml node syntax that will be the content within the summary element. Creates a summary element within an xml documentation comment. A list of xml node syntax that will be the content within the summary element. Creates a see element within an xml documentation comment. A cref syntax node that points to the referenced item (e.g. a class, struct). Creates a seealso element within an xml documentation comment. A cref syntax node that points to the referenced item (e.g. a class, struct). Creates a seealso element within an xml documentation comment. The uri of the referenced item. A list of xml node syntax that will be used as the link text for the referenced item. Creates a threadsafety element within an xml documentation comment. Creates a threadsafety element within an xml documentation comment. Indicates whether static member of this type are safe for multi-threaded operations. Indicates whether instance members of this type are safe for multi-threaded operations. Creates a syntax node for a name attribute in a xml element within a xml documentation comment. The value of the name attribute. Creates a syntax node for a preliminary element within a xml documentation comment. Creates a syntax node for a cref attribute within a xml documentation comment. The used for the xml cref attribute syntax. Creates a syntax node for a cref attribute within a xml documentation comment. The used for the xml cref attribute syntax. The kind of the quote for the referenced item in the cref attribute. Creates a remarks element within an xml documentation comment. A list of xml node syntax that will be the content within the remarks element. Creates a remarks element within an xml documentation comment. A list of xml node syntax that will be the content within the remarks element. Creates a returns element within an xml documentation comment. A list of xml node syntax that will be the content within the returns element. Creates a returns element within an xml documentation comment. A list of xml node syntax that will be the content within the returns element. Creates the syntax representation of an xml value element (e.g. for xml documentation comments). A list of xml syntax nodes that represents the content of the value element. Creates the syntax representation of an xml value element (e.g. for xml documentation comments). A list of xml syntax nodes that represents the content of the value element. Creates the syntax representation of an exception element within xml documentation comments. Syntax representation of the reference to the exception type. A list of syntax nodes that represents the content of the exception element. Creates the syntax representation of an exception element within xml documentation comments. Syntax representation of the reference to the exception type. A list of syntax nodes that represents the content of the exception element. Creates the syntax representation of a permission element within xml documentation comments. Syntax representation of the reference to the permission type. A list of syntax nodes that represents the content of the permission element. Creates the syntax representation of a permission element within xml documentation comments. Syntax representation of the reference to the permission type. A list of syntax nodes that represents the content of the permission element. Creates the syntax representation of an example element within xml documentation comments. A list of syntax nodes that represents the content of the example element. Creates the syntax representation of an example element within xml documentation comments. A list of syntax nodes that represents the content of the example element. Creates the syntax representation of a para element within xml documentation comments. A list of syntax nodes that represents the content of the para element. Creates the syntax representation of a para element within xml documentation comments. A list of syntax nodes that represents the content of the para element. Creates the syntax representation of a param element within xml documentation comments (e.g. for documentation of method parameters). The name of the parameter. A list of syntax nodes that represents the content of the param element (e.g. the description and meaning of the parameter). Creates the syntax representation of a param element within xml documentation comments (e.g. for documentation of method parameters). The name of the parameter. A list of syntax nodes that represents the content of the param element (e.g. the description and meaning of the parameter). Creates the syntax representation of a paramref element within xml documentation comments (e.g. for referencing particular parameters of a method). The name of the referenced parameter. Creates the syntax representation of a see element within xml documentation comments, that points to the 'null' language keyword. Creates the syntax representation of a see element within xml documentation comments, that points to a language keyword. The language keyword to which the see element points to. Creates the syntax representation of a placeholder element within xml documentation comments. A list of syntax nodes that represents the content of the placeholder element. Creates the syntax representation of a placeholder element within xml documentation comments. A list of syntax nodes that represents the content of the placeholder element. Creates the syntax representation of a named empty xml element within xml documentation comments. The name of the empty xml element. Creates the syntax representation of a named xml element within xml documentation comments. The name of the empty xml element. A list of syntax nodes that represents the content of the xml element. Creates the syntax representation of a named xml element within xml documentation comments. The name of the empty xml element. A list of syntax nodes that represents the content of the xml element. Creates the syntax representation of an xml text attribute. The name of the xml text attribute. The value of the xml text attribute. Creates the syntax representation of an xml text attribute. The name of the xml text attribute. A list of tokens used for the value of the xml text attribute. Creates the syntax representation of an xml text attribute. The name of the xml text attribute. The kind of the quote token to be used to quote the value (e.g. " or '). A list of tokens used for the value of the xml text attribute. Creates the syntax representation of an xml text attribute. The name of the xml text attribute. The kind of the quote token to be used to quote the value (e.g. " or '). A list of tokens used for the value of the xml text attribute. Creates the syntax representation of an xml element that spans multiple text lines. The name of the xml element. A list of syntax nodes that represents the content of the xml multi line element. Creates the syntax representation of an xml element that spans multiple text lines. The name of the xml element. A list of syntax nodes that represents the content of the xml multi line element. Creates the syntax representation of an xml text that contains a newline token with a documentation comment exterior trivia at the end (continued documentation comment). The raw text within the new line. Creates the syntax representation of an xml newline token with a documentation comment exterior trivia at the end (continued documentation comment). The raw text within the new line. Creates a token with kind XmlTextLiteralNewLineToken. A list of trivia immediately preceding the token. The raw text of the literal. The xml text new line value. A list of trivia immediately following the token. Creates the syntax representation of an xml newline token for xml documentation comments. The raw text within the new line. If set to true, a documentation comment exterior token will be added to the trailing trivia of the new token. Generates the syntax representation of a xml text node (e.g. for xml documentation comments). The string literal used as the text of the xml text node. Generates the syntax representation of a xml text node (e.g. for xml documentation comments). A list of text tokens used as the text of the xml text node. Generates the syntax representation of an xml text literal. The text used within the xml text literal. Generates the syntax representation of an xml text literal. The raw text of the literal. The text used within the xml text literal. Helper method that replaces less-than and greater-than characters with brackets. The original token that is to be replaced. The new rewritten token. Returns the new rewritten token with replaced characters. Creates a trivia with kind DocumentationCommentExteriorTrivia. The raw text of the literal. Creates an empty list of syntax nodes. The specific type of the element nodes. Creates a singleton list of syntax nodes. The specific type of the element nodes. The single element node. Creates a list of syntax nodes. The specific type of the element nodes. A sequence of element nodes. Creates an empty list of tokens. Creates a singleton list of tokens. The single token. Creates a list of tokens. An array of tokens. Creates a list of tokens. Creates a trivia from a StructuredTriviaSyntax node. Creates an empty list of trivia. Creates a singleton list of trivia. A single trivia. Creates a list of trivia. An array of trivia. Creates a list of trivia. A sequence of trivia. Creates an empty separated list. The specific type of the element nodes. Creates a singleton separated list. The specific type of the element nodes. A single node. Creates a separated list of nodes from a sequence of nodes, synthesizing comma separators in between. The specific type of the element nodes. A sequence of syntax nodes. Creates a separated list of nodes from a sequence of nodes and a sequence of separator tokens. The specific type of the element nodes. A sequence of syntax nodes. A sequence of token to be interleaved between the nodes. The number of tokens must be one less than the number of nodes. Creates a separated list from a sequence of nodes and tokens, starting with a node and alternating between additional nodes and separator tokens. The specific type of the element nodes. A sequence of nodes or tokens, alternating between nodes and separator tokens. Creates a separated list from a , where the list elements start with a node and then alternate between additional nodes and separator tokens. The specific type of the element nodes. The list of nodes and tokens. Creates an empty . Create a from a sequence of . The sequence of nodes and tokens Create a from one or more . The nodes and tokens Creates an IdentifierNameSyntax node. The identifier name. Create a new syntax tree from a syntax node. Parse a list of trivia rules for leading trivia. Parse a list of trivia rules for leading trivia. Parse a list of trivia using the parsing rules for trailing trivia. Parse a C# language token. The text of the token including leading and trailing trivia. Optional offset into text. Parse a sequence of C# language tokens. Since this API does not create a that owns all produced tokens, the API may yield surprising results for the produced tokens and its behavior is generally unspecified. The text of all the tokens. An integer to use as the starting position of the first token. Optional offset into text. Parse options. Creates a token parser that can be used to parse tokens from a given source text. The source to parse tokens from. Parse options for the source. Parse a NameSyntax node using the grammar rule for names. Parse a TypeNameSyntax node using the grammar rule for type names. Parse a TypeNameSyntax node using the grammar rule for type names. Parse an ExpressionSyntax node using the lowest precedence grammar rule for expressions. The text of the expression. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Parse a StatementSyntaxNode using grammar rule for statements. The text of the statement. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Parse a MemberDeclarationSyntax. This includes all of the kinds of members that could occur in a type declaration. If nothing resembling a valid member declaration is found in the input, returns null. The text of the declaration. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input following a declaration should be treated as an error Parse a CompilationUnitSyntax using the grammar rule for an entire compilation unit (file). To produce a SyntaxTree instance, use CSharpSyntaxTree.ParseText instead. The text of the compilation unit. Optional offset into text. The optional parse options to use. If no options are specified default options are used. Parse a ParameterListSyntax node. The text of the parenthesized parameter list. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Parse a BracketedParameterListSyntax node. The text of the bracketed parameter list. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Parse an ArgumentListSyntax node. The text of the parenthesized argument list. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Parse a BracketedArgumentListSyntax node. The text of the bracketed argument list. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Parse an AttributeArgumentListSyntax node. The text of the attribute argument list. Optional offset into text. The optional parse options to use. If no options are specified default options are used. True if extra tokens in the input should be treated as an error Helper method for wrapping a string in a SourceText. Determines if two trees are the same, disregarding trivia differences. The original tree. The new tree. If true then the trees are equivalent if the contained nodes and tokens declaring metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies or initializer expressions, otherwise all nodes and tokens must be equivalent. Determines if two syntax nodes are the same, disregarding trivia differences. The old node. The new node. If true then the nodes are equivalent if the contained nodes and tokens declaring metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies or initializer expressions, otherwise all nodes and tokens must be equivalent. Determines if two syntax nodes are the same, disregarding trivia differences. The old node. The new node. If specified called for every child syntax node (not token) that is visited during the comparison. If it returns true the child is recursively visited, otherwise the child and its subtree is disregarded. Determines if two syntax tokens are the same, disregarding trivia differences. The old token. The new token. Determines if two lists of tokens are the same, disregarding trivia differences. The old token list. The new token list. Determines if two lists of syntax nodes are the same, disregarding trivia differences. The old list. The new list. If true then the nodes are equivalent if the contained nodes and tokens declaring metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies or initializer expressions, otherwise all nodes and tokens must be equivalent. Determines if two lists of syntax nodes are the same, disregarding trivia differences. The old list. The new list. If specified called for every child syntax node (not token) that is visited during the comparison. If it returns true the child is recursively visited, otherwise the child and its subtree is disregarded. Determines if two lists of syntax nodes are the same, disregarding trivia differences. The old list. The new list. If true then the nodes are equivalent if the contained nodes and tokens declaring metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies or initializer expressions, otherwise all nodes and tokens must be equivalent. Determines if two lists of syntax nodes are the same, disregarding trivia differences. The old list. The new list. If specified called for every child syntax node (not token) that is visited during the comparison. If it returns true the child is recursively visited, otherwise the child and its subtree is disregarded. Gets the containing expression that is actually a language expression and not just typed as an ExpressionSyntax for convenience. For example, NameSyntax nodes on the right side of qualified names and member access expressions are not language expressions, yet the containing qualified names or member access expressions are indeed expressions. Gets the containing expression that is actually a language expression (or something that GetSymbolInfo can be applied to) and not just typed as an ExpressionSyntax for convenience. For example, NameSyntax nodes on the right side of qualified names and member access expressions are not language expressions, yet the containing qualified names or member access expressions are indeed expressions. Similarly, if the input node is a cref part that is not independently meaningful, then the result will be the full cref. Besides an expression, an input that is a NameSyntax of a SubpatternSyntax, e.g. in `name: 3` may cause this method to return the enclosing SubpatternSyntax. Given a conditional binding expression, find corresponding conditional access node. Converts a generic name expression into one without the generic arguments. Determines whether the given text is considered a syntactically complete submission. Throws if the tree was not compiled as an interactive submission. Creates a new CaseSwitchLabelSyntax instance. Creates a new DefaultSwitchLabelSyntax instance. Creates a new BlockSyntax instance. Creates a new BlockSyntax instance. Creates a new instance. Creates a new OperatorDeclarationSyntax instance. Creates a new OperatorDeclarationSyntax instance. Creates a new OperatorDeclarationSyntax instance. Creates a new instance. Creates a new UsingDirectiveSyntax instance. Creates a new ClassOrStructConstraintSyntax instance. Creates a new EventDeclarationSyntax instance. Creates a new EventDeclarationSyntax instance. Creates a new SwitchStatementSyntax instance. Creates a new SwitchStatementSyntax instance. Creates a new instance. Creates a new instance. Creates a new ClassDeclarationSyntax instance. Creates a new ClassDeclarationSyntax instance. Creates a new ClassDeclarationSyntax instance. Creates a new ClassDeclarationSyntax instance. Creates a new ClassDeclarationSyntax instance. Creates a new StructDeclarationSyntax instance. Creates a new StructDeclarationSyntax instance. Creates a new StructDeclarationSyntax instance. Creates a new StructDeclarationSyntax instance. Creates a new StructDeclarationSyntax instance. Creates a new InterfaceDeclarationSyntax instance. Creates a new InterfaceDeclarationSyntax instance. Creates a new InterfaceDeclarationSyntax instance. Creates a new InterfaceDeclarationSyntax instance. Creates a new EnumDeclarationSyntax instance. Creates a new EnumDeclarationSyntax instance. Creates a new EnumDeclarationSyntax instance. Creates a new UsingDirectiveSyntax instance. Creates a new UsingDirectiveSyntax instance. Creates a new UsingDirectiveSyntax instance. Creates a new IdentifierNameSyntax instance. Creates a new QualifiedNameSyntax instance. Creates a new QualifiedNameSyntax instance. Creates a new GenericNameSyntax instance. Creates a new GenericNameSyntax instance. Creates a new GenericNameSyntax instance. Creates a new TypeArgumentListSyntax instance. Creates a new TypeArgumentListSyntax instance. Creates a new AliasQualifiedNameSyntax instance. Creates a new AliasQualifiedNameSyntax instance. Creates a new AliasQualifiedNameSyntax instance. Creates a new PredefinedTypeSyntax instance. Creates a new ArrayTypeSyntax instance. Creates a new ArrayTypeSyntax instance. Creates a new ArrayRankSpecifierSyntax instance. Creates a new ArrayRankSpecifierSyntax instance. Creates a new PointerTypeSyntax instance. Creates a new PointerTypeSyntax instance. Creates a new FunctionPointerTypeSyntax instance. Creates a new FunctionPointerTypeSyntax instance. Creates a new FunctionPointerTypeSyntax instance. Creates a new FunctionPointerParameterListSyntax instance. Creates a new FunctionPointerParameterListSyntax instance. Creates a new FunctionPointerCallingConventionSyntax instance. Creates a new FunctionPointerCallingConventionSyntax instance. Creates a new FunctionPointerUnmanagedCallingConventionListSyntax instance. Creates a new FunctionPointerUnmanagedCallingConventionListSyntax instance. Creates a new FunctionPointerUnmanagedCallingConventionSyntax instance. Creates a new NullableTypeSyntax instance. Creates a new NullableTypeSyntax instance. Creates a new TupleTypeSyntax instance. Creates a new TupleTypeSyntax instance. Creates a new TupleElementSyntax instance. Creates a new TupleElementSyntax instance. Creates a new OmittedTypeArgumentSyntax instance. Creates a new OmittedTypeArgumentSyntax instance. Creates a new RefTypeSyntax instance. Creates a new RefTypeSyntax instance. Creates a new ScopedTypeSyntax instance. Creates a new ScopedTypeSyntax instance. Creates a new ParenthesizedExpressionSyntax instance. Creates a new ParenthesizedExpressionSyntax instance. Creates a new TupleExpressionSyntax instance. Creates a new TupleExpressionSyntax instance. Creates a new PrefixUnaryExpressionSyntax instance. Creates a new PrefixUnaryExpressionSyntax instance. Creates a new AwaitExpressionSyntax instance. Creates a new AwaitExpressionSyntax instance. Creates a new PostfixUnaryExpressionSyntax instance. Creates a new PostfixUnaryExpressionSyntax instance. Creates a new MemberAccessExpressionSyntax instance. Creates a new MemberAccessExpressionSyntax instance. Creates a new ConditionalAccessExpressionSyntax instance. Creates a new ConditionalAccessExpressionSyntax instance. Creates a new MemberBindingExpressionSyntax instance. Creates a new MemberBindingExpressionSyntax instance. Creates a new ElementBindingExpressionSyntax instance. Creates a new ElementBindingExpressionSyntax instance. Creates a new RangeExpressionSyntax instance. Creates a new RangeExpressionSyntax instance. Creates a new RangeExpressionSyntax instance. Creates a new ImplicitElementAccessSyntax instance. Creates a new ImplicitElementAccessSyntax instance. Creates a new BinaryExpressionSyntax instance. Creates a new BinaryExpressionSyntax instance. Creates a new AssignmentExpressionSyntax instance. Creates a new AssignmentExpressionSyntax instance. Creates a new ConditionalExpressionSyntax instance. Creates a new ConditionalExpressionSyntax instance. Creates a new ThisExpressionSyntax instance. Creates a new ThisExpressionSyntax instance. Creates a new BaseExpressionSyntax instance. Creates a new BaseExpressionSyntax instance. Creates a new LiteralExpressionSyntax instance. Creates a new FieldExpressionSyntax instance. Creates a new FieldExpressionSyntax instance. Creates a new MakeRefExpressionSyntax instance. Creates a new MakeRefExpressionSyntax instance. Creates a new RefTypeExpressionSyntax instance. Creates a new RefTypeExpressionSyntax instance. Creates a new RefValueExpressionSyntax instance. Creates a new RefValueExpressionSyntax instance. Creates a new CheckedExpressionSyntax instance. Creates a new CheckedExpressionSyntax instance. Creates a new DefaultExpressionSyntax instance. Creates a new DefaultExpressionSyntax instance. Creates a new TypeOfExpressionSyntax instance. Creates a new TypeOfExpressionSyntax instance. Creates a new SizeOfExpressionSyntax instance. Creates a new SizeOfExpressionSyntax instance. Creates a new InvocationExpressionSyntax instance. Creates a new InvocationExpressionSyntax instance. Creates a new ElementAccessExpressionSyntax instance. Creates a new ElementAccessExpressionSyntax instance. Creates a new ArgumentListSyntax instance. Creates a new ArgumentListSyntax instance. Creates a new BracketedArgumentListSyntax instance. Creates a new BracketedArgumentListSyntax instance. Creates a new ArgumentSyntax instance. Creates a new ArgumentSyntax instance. Creates a new ExpressionColonSyntax instance. Creates a new NameColonSyntax instance. Creates a new DeclarationExpressionSyntax instance. Creates a new CastExpressionSyntax instance. Creates a new CastExpressionSyntax instance. Creates a new AnonymousMethodExpressionSyntax instance. Creates a new SimpleLambdaExpressionSyntax instance. Creates a new SimpleLambdaExpressionSyntax instance. Creates a new SimpleLambdaExpressionSyntax instance. Creates a new RefExpressionSyntax instance. Creates a new RefExpressionSyntax instance. Creates a new ParenthesizedLambdaExpressionSyntax instance. Creates a new ParenthesizedLambdaExpressionSyntax instance. Creates a new ParenthesizedLambdaExpressionSyntax instance. Creates a new InitializerExpressionSyntax instance. Creates a new InitializerExpressionSyntax instance. Creates a new ImplicitObjectCreationExpressionSyntax instance. Creates a new ImplicitObjectCreationExpressionSyntax instance. Creates a new ImplicitObjectCreationExpressionSyntax instance. Creates a new ObjectCreationExpressionSyntax instance. Creates a new ObjectCreationExpressionSyntax instance. Creates a new ObjectCreationExpressionSyntax instance. Creates a new WithExpressionSyntax instance. Creates a new WithExpressionSyntax instance. Creates a new AnonymousObjectMemberDeclaratorSyntax instance. Creates a new AnonymousObjectMemberDeclaratorSyntax instance. Creates a new AnonymousObjectCreationExpressionSyntax instance. Creates a new AnonymousObjectCreationExpressionSyntax instance. Creates a new ArrayCreationExpressionSyntax instance. Creates a new ArrayCreationExpressionSyntax instance. Creates a new ArrayCreationExpressionSyntax instance. Creates a new ImplicitArrayCreationExpressionSyntax instance. Creates a new ImplicitArrayCreationExpressionSyntax instance. Creates a new ImplicitArrayCreationExpressionSyntax instance. Creates a new StackAllocArrayCreationExpressionSyntax instance. Creates a new StackAllocArrayCreationExpressionSyntax instance. Creates a new StackAllocArrayCreationExpressionSyntax instance. Creates a new ImplicitStackAllocArrayCreationExpressionSyntax instance. Creates a new ImplicitStackAllocArrayCreationExpressionSyntax instance. Creates a new CollectionExpressionSyntax instance. Creates a new CollectionExpressionSyntax instance. Creates a new ExpressionElementSyntax instance. Creates a new SpreadElementSyntax instance. Creates a new SpreadElementSyntax instance. Creates a new QueryExpressionSyntax instance. Creates a new QueryBodySyntax instance. Creates a new QueryBodySyntax instance. Creates a new FromClauseSyntax instance. Creates a new FromClauseSyntax instance. Creates a new FromClauseSyntax instance. Creates a new FromClauseSyntax instance. Creates a new LetClauseSyntax instance. Creates a new LetClauseSyntax instance. Creates a new LetClauseSyntax instance. Creates a new JoinClauseSyntax instance. Creates a new JoinClauseSyntax instance. Creates a new JoinClauseSyntax instance. Creates a new JoinClauseSyntax instance. Creates a new JoinIntoClauseSyntax instance. Creates a new JoinIntoClauseSyntax instance. Creates a new JoinIntoClauseSyntax instance. Creates a new WhereClauseSyntax instance. Creates a new WhereClauseSyntax instance. Creates a new OrderByClauseSyntax instance. Creates a new OrderByClauseSyntax instance. Creates a new OrderingSyntax instance. Creates a new OrderingSyntax instance. Creates a new SelectClauseSyntax instance. Creates a new SelectClauseSyntax instance. Creates a new GroupClauseSyntax instance. Creates a new GroupClauseSyntax instance. Creates a new QueryContinuationSyntax instance. Creates a new QueryContinuationSyntax instance. Creates a new QueryContinuationSyntax instance. Creates a new OmittedArraySizeExpressionSyntax instance. Creates a new OmittedArraySizeExpressionSyntax instance. Creates a new InterpolatedStringExpressionSyntax instance. Creates a new InterpolatedStringExpressionSyntax instance. Creates a new IsPatternExpressionSyntax instance. Creates a new IsPatternExpressionSyntax instance. Creates a new ThrowExpressionSyntax instance. Creates a new ThrowExpressionSyntax instance. Creates a new WhenClauseSyntax instance. Creates a new WhenClauseSyntax instance. Creates a new DiscardPatternSyntax instance. Creates a new DiscardPatternSyntax instance. Creates a new DeclarationPatternSyntax instance. Creates a new VarPatternSyntax instance. Creates a new VarPatternSyntax instance. Creates a new RecursivePatternSyntax instance. Creates a new RecursivePatternSyntax instance. Creates a new PositionalPatternClauseSyntax instance. Creates a new PositionalPatternClauseSyntax instance. Creates a new PropertyPatternClauseSyntax instance. Creates a new PropertyPatternClauseSyntax instance. Creates a new SubpatternSyntax instance. Creates a new SubpatternSyntax instance. Creates a new ConstantPatternSyntax instance. Creates a new ParenthesizedPatternSyntax instance. Creates a new ParenthesizedPatternSyntax instance. Creates a new RelationalPatternSyntax instance. Creates a new TypePatternSyntax instance. Creates a new BinaryPatternSyntax instance. Creates a new BinaryPatternSyntax instance. Creates a new UnaryPatternSyntax instance. Creates a new UnaryPatternSyntax instance. Creates a new ListPatternSyntax instance. Creates a new ListPatternSyntax instance. Creates a new ListPatternSyntax instance. Creates a new SlicePatternSyntax instance. Creates a new SlicePatternSyntax instance. Creates a new InterpolatedStringTextSyntax instance. Creates a new InterpolatedStringTextSyntax instance. Creates a new InterpolationSyntax instance. Creates a new InterpolationSyntax instance. Creates a new InterpolationSyntax instance. Creates a new InterpolationAlignmentClauseSyntax instance. Creates a new InterpolationFormatClauseSyntax instance. Creates a new InterpolationFormatClauseSyntax instance. Creates a new GlobalStatementSyntax instance. Creates a new GlobalStatementSyntax instance. Creates a new BlockSyntax instance. Creates a new BlockSyntax instance. Creates a new BlockSyntax instance. Creates a new LocalFunctionStatementSyntax instance. Creates a new LocalFunctionStatementSyntax instance. Creates a new LocalFunctionStatementSyntax instance. Creates a new LocalFunctionStatementSyntax instance. Creates a new LocalDeclarationStatementSyntax instance. Creates a new LocalDeclarationStatementSyntax instance. Creates a new LocalDeclarationStatementSyntax instance. Creates a new VariableDeclarationSyntax instance. Creates a new VariableDeclarationSyntax instance. Creates a new VariableDeclaratorSyntax instance. Creates a new VariableDeclaratorSyntax instance. Creates a new VariableDeclaratorSyntax instance. Creates a new EqualsValueClauseSyntax instance. Creates a new EqualsValueClauseSyntax instance. Creates a new SingleVariableDesignationSyntax instance. Creates a new DiscardDesignationSyntax instance. Creates a new DiscardDesignationSyntax instance. Creates a new ParenthesizedVariableDesignationSyntax instance. Creates a new ParenthesizedVariableDesignationSyntax instance. Creates a new ExpressionStatementSyntax instance. Creates a new ExpressionStatementSyntax instance. Creates a new ExpressionStatementSyntax instance. Creates a new EmptyStatementSyntax instance. Creates a new EmptyStatementSyntax instance. Creates a new EmptyStatementSyntax instance. Creates a new LabeledStatementSyntax instance. Creates a new LabeledStatementSyntax instance. Creates a new LabeledStatementSyntax instance. Creates a new LabeledStatementSyntax instance. Creates a new GotoStatementSyntax instance. Creates a new GotoStatementSyntax instance. Creates a new GotoStatementSyntax instance. Creates a new BreakStatementSyntax instance. Creates a new BreakStatementSyntax instance. Creates a new BreakStatementSyntax instance. Creates a new ContinueStatementSyntax instance. Creates a new ContinueStatementSyntax instance. Creates a new ContinueStatementSyntax instance. Creates a new ReturnStatementSyntax instance. Creates a new ReturnStatementSyntax instance. Creates a new ReturnStatementSyntax instance. Creates a new ThrowStatementSyntax instance. Creates a new ThrowStatementSyntax instance. Creates a new ThrowStatementSyntax instance. Creates a new YieldStatementSyntax instance. Creates a new YieldStatementSyntax instance. Creates a new YieldStatementSyntax instance. Creates a new WhileStatementSyntax instance. Creates a new WhileStatementSyntax instance. Creates a new WhileStatementSyntax instance. Creates a new DoStatementSyntax instance. Creates a new DoStatementSyntax instance. Creates a new DoStatementSyntax instance. Creates a new ForStatementSyntax instance. Creates a new ForStatementSyntax instance. Creates a new ForStatementSyntax instance. Creates a new ForEachStatementSyntax instance. Creates a new ForEachStatementSyntax instance. Creates a new ForEachStatementSyntax instance. Creates a new ForEachStatementSyntax instance. Creates a new ForEachVariableStatementSyntax instance. Creates a new ForEachVariableStatementSyntax instance. Creates a new ForEachVariableStatementSyntax instance. Creates a new UsingStatementSyntax instance. Creates a new UsingStatementSyntax instance. Creates a new UsingStatementSyntax instance. Creates a new FixedStatementSyntax instance. Creates a new FixedStatementSyntax instance. Creates a new FixedStatementSyntax instance. Creates a new CheckedStatementSyntax instance. Creates a new CheckedStatementSyntax instance. Creates a new CheckedStatementSyntax instance. Creates a new UnsafeStatementSyntax instance. Creates a new UnsafeStatementSyntax instance. Creates a new UnsafeStatementSyntax instance. Creates a new LockStatementSyntax instance. Creates a new LockStatementSyntax instance. Creates a new LockStatementSyntax instance. Creates a new IfStatementSyntax instance. Creates a new IfStatementSyntax instance. Creates a new IfStatementSyntax instance. Creates a new ElseClauseSyntax instance. Creates a new ElseClauseSyntax instance. Creates a new SwitchStatementSyntax instance. Creates a new SwitchSectionSyntax instance. Creates a new SwitchSectionSyntax instance. Creates a new CasePatternSwitchLabelSyntax instance. Creates a new CasePatternSwitchLabelSyntax instance. Creates a new CasePatternSwitchLabelSyntax instance. Creates a new CaseSwitchLabelSyntax instance. Creates a new CaseSwitchLabelSyntax instance. Creates a new DefaultSwitchLabelSyntax instance. Creates a new DefaultSwitchLabelSyntax instance. Creates a new SwitchExpressionSyntax instance. Creates a new SwitchExpressionSyntax instance. Creates a new SwitchExpressionSyntax instance. Creates a new SwitchExpressionArmSyntax instance. Creates a new SwitchExpressionArmSyntax instance. Creates a new SwitchExpressionArmSyntax instance. Creates a new TryStatementSyntax instance. Creates a new TryStatementSyntax instance. Creates a new TryStatementSyntax instance. Creates a new CatchClauseSyntax instance. Creates a new CatchClauseSyntax instance. Creates a new CatchClauseSyntax instance. Creates a new CatchDeclarationSyntax instance. Creates a new CatchDeclarationSyntax instance. Creates a new CatchDeclarationSyntax instance. Creates a new CatchFilterClauseSyntax instance. Creates a new CatchFilterClauseSyntax instance. Creates a new FinallyClauseSyntax instance. Creates a new FinallyClauseSyntax instance. Creates a new CompilationUnitSyntax instance. Creates a new CompilationUnitSyntax instance. Creates a new CompilationUnitSyntax instance. Creates a new ExternAliasDirectiveSyntax instance. Creates a new ExternAliasDirectiveSyntax instance. Creates a new ExternAliasDirectiveSyntax instance. Creates a new UsingDirectiveSyntax instance. Creates a new UsingDirectiveSyntax instance. Creates a new UsingDirectiveSyntax instance. Creates a new NamespaceDeclarationSyntax instance. Creates a new NamespaceDeclarationSyntax instance. Creates a new NamespaceDeclarationSyntax instance. Creates a new FileScopedNamespaceDeclarationSyntax instance. Creates a new FileScopedNamespaceDeclarationSyntax instance. Creates a new FileScopedNamespaceDeclarationSyntax instance. Creates a new AttributeListSyntax instance. Creates a new AttributeListSyntax instance. Creates a new AttributeListSyntax instance. Creates a new AttributeTargetSpecifierSyntax instance. Creates a new AttributeTargetSpecifierSyntax instance. Creates a new AttributeSyntax instance. Creates a new AttributeSyntax instance. Creates a new AttributeArgumentListSyntax instance. Creates a new AttributeArgumentListSyntax instance. Creates a new AttributeArgumentSyntax instance. Creates a new AttributeArgumentSyntax instance. Creates a new NameEqualsSyntax instance. Creates a new NameEqualsSyntax instance. Creates a new NameEqualsSyntax instance. Creates a new TypeParameterListSyntax instance. Creates a new TypeParameterListSyntax instance. Creates a new TypeParameterSyntax instance. Creates a new TypeParameterSyntax instance. Creates a new TypeParameterSyntax instance. Creates a new ClassDeclarationSyntax instance. Creates a new StructDeclarationSyntax instance. Creates a new InterfaceDeclarationSyntax instance. Creates a new RecordDeclarationSyntax instance. Creates a new RecordDeclarationSyntax instance. Creates a new RecordDeclarationSyntax instance. Creates a new RecordDeclarationSyntax instance. Creates a new EnumDeclarationSyntax instance. Creates a new DelegateDeclarationSyntax instance. Creates a new DelegateDeclarationSyntax instance. Creates a new DelegateDeclarationSyntax instance. Creates a new DelegateDeclarationSyntax instance. Creates a new EnumMemberDeclarationSyntax instance. Creates a new EnumMemberDeclarationSyntax instance. Creates a new EnumMemberDeclarationSyntax instance. Creates a new BaseListSyntax instance. Creates a new BaseListSyntax instance. Creates a new SimpleBaseTypeSyntax instance. Creates a new PrimaryConstructorBaseTypeSyntax instance. Creates a new PrimaryConstructorBaseTypeSyntax instance. Creates a new TypeParameterConstraintClauseSyntax instance. Creates a new TypeParameterConstraintClauseSyntax instance. Creates a new TypeParameterConstraintClauseSyntax instance. Creates a new TypeParameterConstraintClauseSyntax instance. Creates a new ConstructorConstraintSyntax instance. Creates a new ConstructorConstraintSyntax instance. Creates a new ClassOrStructConstraintSyntax instance. Creates a new ClassOrStructConstraintSyntax instance. Creates a new TypeConstraintSyntax instance. Creates a new DefaultConstraintSyntax instance. Creates a new DefaultConstraintSyntax instance. Creates a new AllowsConstraintClauseSyntax instance. Creates a new AllowsConstraintClauseSyntax instance. Creates a new RefStructConstraintSyntax instance. Creates a new RefStructConstraintSyntax instance. Creates a new FieldDeclarationSyntax instance. Creates a new FieldDeclarationSyntax instance. Creates a new FieldDeclarationSyntax instance. Creates a new EventFieldDeclarationSyntax instance. Creates a new EventFieldDeclarationSyntax instance. Creates a new EventFieldDeclarationSyntax instance. Creates a new ExplicitInterfaceSpecifierSyntax instance. Creates a new ExplicitInterfaceSpecifierSyntax instance. Creates a new MethodDeclarationSyntax instance. Creates a new MethodDeclarationSyntax instance. Creates a new MethodDeclarationSyntax instance. Creates a new MethodDeclarationSyntax instance. Creates a new OperatorDeclarationSyntax instance. Creates a new OperatorDeclarationSyntax instance. Creates a new OperatorDeclarationSyntax instance. Creates a new ConversionOperatorDeclarationSyntax instance. Creates a new ConversionOperatorDeclarationSyntax instance. Creates a new ConversionOperatorDeclarationSyntax instance. Creates a new ConstructorDeclarationSyntax instance. Creates a new ConstructorDeclarationSyntax instance. Creates a new ConstructorDeclarationSyntax instance. Creates a new ConstructorDeclarationSyntax instance. Creates a new ConstructorInitializerSyntax instance. Creates a new ConstructorInitializerSyntax instance. Creates a new DestructorDeclarationSyntax instance. Creates a new DestructorDeclarationSyntax instance. Creates a new DestructorDeclarationSyntax instance. Creates a new DestructorDeclarationSyntax instance. Creates a new PropertyDeclarationSyntax instance. Creates a new PropertyDeclarationSyntax instance. Creates a new PropertyDeclarationSyntax instance. Creates a new PropertyDeclarationSyntax instance. Creates a new ArrowExpressionClauseSyntax instance. Creates a new ArrowExpressionClauseSyntax instance. Creates a new EventDeclarationSyntax instance. Creates a new EventDeclarationSyntax instance. Creates a new EventDeclarationSyntax instance. Creates a new EventDeclarationSyntax instance. Creates a new IndexerDeclarationSyntax instance. Creates a new IndexerDeclarationSyntax instance. Creates a new IndexerDeclarationSyntax instance. Creates a new AccessorListSyntax instance. Creates a new AccessorListSyntax instance. Creates a new AccessorDeclarationSyntax instance. Creates a new AccessorDeclarationSyntax instance. Creates a new AccessorDeclarationSyntax instance. Creates a new ParameterListSyntax instance. Creates a new ParameterListSyntax instance. Creates a new BracketedParameterListSyntax instance. Creates a new BracketedParameterListSyntax instance. Creates a new ParameterSyntax instance. Creates a new ParameterSyntax instance. Creates a new FunctionPointerParameterSyntax instance. Creates a new FunctionPointerParameterSyntax instance. Creates a new IncompleteMemberSyntax instance. Creates a new IncompleteMemberSyntax instance. Creates a new SkippedTokensTriviaSyntax instance. Creates a new SkippedTokensTriviaSyntax instance. Creates a new DocumentationCommentTriviaSyntax instance. Creates a new DocumentationCommentTriviaSyntax instance. Creates a new TypeCrefSyntax instance. Creates a new QualifiedCrefSyntax instance. Creates a new QualifiedCrefSyntax instance. Creates a new NameMemberCrefSyntax instance. Creates a new NameMemberCrefSyntax instance. Creates a new IndexerMemberCrefSyntax instance. Creates a new IndexerMemberCrefSyntax instance. Creates a new OperatorMemberCrefSyntax instance. Creates a new OperatorMemberCrefSyntax instance. Creates a new OperatorMemberCrefSyntax instance. Creates a new ConversionOperatorMemberCrefSyntax instance. Creates a new ConversionOperatorMemberCrefSyntax instance. Creates a new ConversionOperatorMemberCrefSyntax instance. Creates a new CrefParameterListSyntax instance. Creates a new CrefParameterListSyntax instance. Creates a new CrefBracketedParameterListSyntax instance. Creates a new CrefBracketedParameterListSyntax instance. Creates a new CrefParameterSyntax instance. Creates a new CrefParameterSyntax instance. Creates a new CrefParameterSyntax instance. Creates a new XmlElementSyntax instance. Creates a new XmlElementSyntax instance. Creates a new XmlElementStartTagSyntax instance. Creates a new XmlElementStartTagSyntax instance. Creates a new XmlElementStartTagSyntax instance. Creates a new XmlElementEndTagSyntax instance. Creates a new XmlElementEndTagSyntax instance. Creates a new XmlEmptyElementSyntax instance. Creates a new XmlEmptyElementSyntax instance. Creates a new XmlEmptyElementSyntax instance. Creates a new XmlNameSyntax instance. Creates a new XmlNameSyntax instance. Creates a new XmlNameSyntax instance. Creates a new XmlPrefixSyntax instance. Creates a new XmlPrefixSyntax instance. Creates a new XmlPrefixSyntax instance. Creates a new XmlTextAttributeSyntax instance. Creates a new XmlTextAttributeSyntax instance. Creates a new XmlTextAttributeSyntax instance. Creates a new XmlCrefAttributeSyntax instance. Creates a new XmlCrefAttributeSyntax instance. Creates a new XmlNameAttributeSyntax instance. Creates a new XmlNameAttributeSyntax instance. Creates a new XmlNameAttributeSyntax instance. Creates a new XmlTextSyntax instance. Creates a new XmlTextSyntax instance. Creates a new XmlCDataSectionSyntax instance. Creates a new XmlCDataSectionSyntax instance. Creates a new XmlProcessingInstructionSyntax instance. Creates a new XmlProcessingInstructionSyntax instance. Creates a new XmlProcessingInstructionSyntax instance. Creates a new XmlCommentSyntax instance. Creates a new XmlCommentSyntax instance. Creates a new IfDirectiveTriviaSyntax instance. Creates a new IfDirectiveTriviaSyntax instance. Creates a new ElifDirectiveTriviaSyntax instance. Creates a new ElifDirectiveTriviaSyntax instance. Creates a new ElseDirectiveTriviaSyntax instance. Creates a new ElseDirectiveTriviaSyntax instance. Creates a new EndIfDirectiveTriviaSyntax instance. Creates a new EndIfDirectiveTriviaSyntax instance. Creates a new RegionDirectiveTriviaSyntax instance. Creates a new RegionDirectiveTriviaSyntax instance. Creates a new EndRegionDirectiveTriviaSyntax instance. Creates a new EndRegionDirectiveTriviaSyntax instance. Creates a new ErrorDirectiveTriviaSyntax instance. Creates a new ErrorDirectiveTriviaSyntax instance. Creates a new WarningDirectiveTriviaSyntax instance. Creates a new WarningDirectiveTriviaSyntax instance. Creates a new BadDirectiveTriviaSyntax instance. Creates a new BadDirectiveTriviaSyntax instance. Creates a new DefineDirectiveTriviaSyntax instance. Creates a new DefineDirectiveTriviaSyntax instance. Creates a new DefineDirectiveTriviaSyntax instance. Creates a new UndefDirectiveTriviaSyntax instance. Creates a new UndefDirectiveTriviaSyntax instance. Creates a new UndefDirectiveTriviaSyntax instance. Creates a new LineDirectiveTriviaSyntax instance. Creates a new LineDirectiveTriviaSyntax instance. Creates a new LineDirectiveTriviaSyntax instance. Creates a new LineDirectivePositionSyntax instance. Creates a new LineDirectivePositionSyntax instance. Creates a new LineSpanDirectiveTriviaSyntax instance. Creates a new LineSpanDirectiveTriviaSyntax instance. Creates a new LineSpanDirectiveTriviaSyntax instance. Creates a new PragmaWarningDirectiveTriviaSyntax instance. Creates a new PragmaWarningDirectiveTriviaSyntax instance. Creates a new PragmaWarningDirectiveTriviaSyntax instance. Creates a new PragmaChecksumDirectiveTriviaSyntax instance. Creates a new PragmaChecksumDirectiveTriviaSyntax instance. Creates a new ReferenceDirectiveTriviaSyntax instance. Creates a new ReferenceDirectiveTriviaSyntax instance. Creates a new LoadDirectiveTriviaSyntax instance. Creates a new LoadDirectiveTriviaSyntax instance. Creates a new ShebangDirectiveTriviaSyntax instance. Creates a new ShebangDirectiveTriviaSyntax instance. Creates a new NullableDirectiveTriviaSyntax instance. Creates a new NullableDirectiveTriviaSyntax instance. Creates a new NullableDirectiveTriviaSyntax instance. Represents a non-terminal node in the syntax tree. Used by structured trivia which has "parent == null", and therefore must know its SyntaxTree explicitly when created. Returns a non-null that owns this node. If this node was created with an explicit non-null , returns that tree. Otherwise, if this node has a non-null parent, then returns the parent's . Otherwise, returns a newly created rooted at this node, preserving this node's reference identity. The node that contains this node in its Children collection. Returns the of the node. The language name that this node is syntax of. The list of trivia that appears before this node in the source code. The list of trivia that appears after this node in the source code. Deserialize a syntax node from the byte stream. Gets a for this node. Gets a SyntaxReference for this syntax node. SyntaxReferences can be used to regain access to a syntax node without keeping the entire tree and source text in memory. Gets a list of all the diagnostics in the sub tree that has this node as its root. This method does not filter diagnostics based on #pragmas and compiler options like nowarn, warnaserror etc. Gets the first directive of the tree rooted by this node. Gets the last directive of the tree rooted by this node. Gets the first token of the tree rooted by this node. True if zero width tokens should be included, false by default. True if skipped tokens should be included, false by default. True if directives should be included, false by default. True if documentation comments should be included, false by default. Gets the first token of the tree rooted by this node. Only tokens for which this predicate returns true are included. Pass null to include all tokens. Steps into trivia if this is not null. Only trivia for which this delegate returns true are included. Gets the last non-zero-width token of the tree rooted by this node. True if zero width tokens should be included, false by default. True if skipped tokens should be included, false by default. True if directives should be included, false by default. True if documentation comments should be included, false by default. Finds a token according to the following rules: 1) If position matches the End of the node/s FullSpan and the node is CompilationUnit, then EoF is returned. 2) If node.FullSpan.Contains(position) then the token that contains given position is returned. 3) Otherwise an ArgumentOutOfRangeException is thrown Finds a token according to the following rules: 1) If position matches the End of the node/s FullSpan and the node is CompilationUnit, then EoF is returned. 2) If node.FullSpan.Contains(position) then the token that contains given position is returned. 3) Otherwise an ArgumentOutOfRangeException is thrown Finds a descendant trivia of this node at the specified position, where the position is within the span of the node. The character position of the trivia relative to the beginning of the file. Specifies a function that determines per trivia node, whether to descend into structured trivia of that node. Finds a descendant trivia of this node whose span includes the supplied position. The character position of the trivia relative to the beginning of the file. Whether to search inside structured trivia. Determine if this node is structurally equivalent to another. This is ONLY used for debugging purpose Represents a which descends an entire graph and may replace or remove visited SyntaxNodes in depth-first order. The parsed representation of a C# source document. Stores positions where preprocessor state changes. Sorted by position. The updated state can be found in array at the same index. Preprocessor states corresponding to positions in . The options used by the parser to produce the syntax tree. Produces a clone of a which will have current syntax tree as its parent. Caller must guarantee that if the same instance of makes multiple calls to this function, only one result is observable. Type of the syntax node. The original syntax node. A clone of the original syntax node that has current as its parent. Gets the root node of the syntax tree. Gets the root node of the syntax tree if it is already available. Gets the root node of the syntax tree asynchronously. By default, the work associated with this method will be executed immediately on the current thread. Implementations that wish to schedule this work differently should override . Gets the root of the syntax tree statically typed as . Ensure that is true for this tree prior to invoking this method. Throws this exception if is false. Determines if two trees are the same, disregarding trivia differences. The tree to compare against. If true then the trees are equivalent if the contained nodes and tokens declaring metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies or initializer expressions, otherwise all nodes and tokens must be equivalent. Creates a new syntax tree from a syntax node. Creates a new syntax tree from a syntax node. An obsolete parameter. Diagnostic options should now be passed with An obsolete parameter. It is unused. Creates a new syntax tree from a syntax node with text that should correspond to the syntax node. This is used by the ExpressionEvaluator. Internal helper for class to create a new syntax tree rooted at the given root node. This method does not create a clone of the given root, but instead preserves it's reference identity. NOTE: This method is only intended to be used from property. NOTE: Do not use this method elsewhere, instead use method for creating a syntax tree. Produces a syntax tree by parsing the source text lazily. The syntax tree is realized when is called. Produces a syntax tree by parsing the source text. Produces a syntax tree by parsing the source text. An obsolete parameter. Diagnostic options should now be passed with An obsolete parameter. It is unused. Produces a syntax tree by parsing the source text. Produces a syntax tree by parsing the source text. An obsolete parameter. Diagnostic options should now be passed with An obsolete parameter. It is unused. Creates a new syntax based off this tree using a new source text. If the new source text is a minor change from the current source text an incremental parse will occur reusing most of the current syntax tree internal data. Otherwise, a full parse will occur using the new source text. Produces a pessimistic list of spans that denote the regions of text in this tree that are changed from the text of the old tree. The old tree. Cannot be null. The list is pessimistic because it may claim more or larger regions than actually changed. Gets a list of text changes that when applied to the old tree produce this tree. The old tree. Cannot be null. The list of changes may be different than the original changes that produced this tree. Gets the location in terms of path, line and column for a given span. Span within the tree. Cancellation token. that contains path, line and column information. The values are not affected by line mapping directives (#line). Gets the location in terms of path, line and column after applying source line mapping directives (#line). Span within the tree. Cancellation token. A valid that contains path, line and column information. If the location path is mapped the resulting path is the path specified in the corresponding #line, otherwise it's . A location path is considered mapped if the first #line directive that precedes it and that either specifies an explicit file path or is #line default exists and specifies an explicit path. Gets a for a . FileLinePositionSpans are used primarily for diagnostics and source locations. The source to convert. When the method returns, contains a boolean value indicating whether this span is considered hidden or not. A resulting . Gets a boolean value indicating whether there are any hidden regions in the tree. True if there is at least one hidden region. Given the error code and the source location, get the warning state based on #pragma warning directives. Error code. Source location. Gets a for the specified text . Gets a list of all the diagnostics in the sub tree that has the specified node as its root. This method does not filter diagnostics based on #pragmas and compiler options like /nowarn, /warnaserror etc. Gets a list of all the diagnostics associated with the token and any related trivia. This method does not filter diagnostics based on #pragmas and compiler options like /nowarn, /warnaserror etc. Gets a list of all the diagnostics associated with the trivia. This method does not filter diagnostics based on #pragmas and compiler options like /nowarn, /warnaserror etc. Gets a list of all the diagnostics in either the sub tree that has the specified node as its root or associated with the token and its related trivia. This method does not filter diagnostics based on #pragmas and compiler options like /nowarn, /warnaserror etc. Gets a list of all the diagnostics in the syntax tree. This method does not filter diagnostics based on #pragmas and compiler options like /nowarn, /warnaserror etc. This is ONLY used for debugging purpose Use by Expression Evaluator. Represents a visitor that visits only the single CSharpSyntaxNode passed into its Visit method and produces a value of the type specified by the parameter. The type of the return value this visitor's Visit method. Called when the visitor visits a IdentifierNameSyntax node. Called when the visitor visits a QualifiedNameSyntax node. Called when the visitor visits a GenericNameSyntax node. Called when the visitor visits a TypeArgumentListSyntax node. Called when the visitor visits a AliasQualifiedNameSyntax node. Called when the visitor visits a PredefinedTypeSyntax node. Called when the visitor visits a ArrayTypeSyntax node. Called when the visitor visits a ArrayRankSpecifierSyntax node. Called when the visitor visits a PointerTypeSyntax node. Called when the visitor visits a FunctionPointerTypeSyntax node. Called when the visitor visits a FunctionPointerParameterListSyntax node. Called when the visitor visits a FunctionPointerCallingConventionSyntax node. Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node. Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node. Called when the visitor visits a NullableTypeSyntax node. Called when the visitor visits a TupleTypeSyntax node. Called when the visitor visits a TupleElementSyntax node. Called when the visitor visits a OmittedTypeArgumentSyntax node. Called when the visitor visits a RefTypeSyntax node. Called when the visitor visits a ScopedTypeSyntax node. Called when the visitor visits a ParenthesizedExpressionSyntax node. Called when the visitor visits a TupleExpressionSyntax node. Called when the visitor visits a PrefixUnaryExpressionSyntax node. Called when the visitor visits a AwaitExpressionSyntax node. Called when the visitor visits a PostfixUnaryExpressionSyntax node. Called when the visitor visits a MemberAccessExpressionSyntax node. Called when the visitor visits a ConditionalAccessExpressionSyntax node. Called when the visitor visits a MemberBindingExpressionSyntax node. Called when the visitor visits a ElementBindingExpressionSyntax node. Called when the visitor visits a RangeExpressionSyntax node. Called when the visitor visits a ImplicitElementAccessSyntax node. Called when the visitor visits a BinaryExpressionSyntax node. Called when the visitor visits a AssignmentExpressionSyntax node. Called when the visitor visits a ConditionalExpressionSyntax node. Called when the visitor visits a ThisExpressionSyntax node. Called when the visitor visits a BaseExpressionSyntax node. Called when the visitor visits a LiteralExpressionSyntax node. Called when the visitor visits a FieldExpressionSyntax node. Called when the visitor visits a MakeRefExpressionSyntax node. Called when the visitor visits a RefTypeExpressionSyntax node. Called when the visitor visits a RefValueExpressionSyntax node. Called when the visitor visits a CheckedExpressionSyntax node. Called when the visitor visits a DefaultExpressionSyntax node. Called when the visitor visits a TypeOfExpressionSyntax node. Called when the visitor visits a SizeOfExpressionSyntax node. Called when the visitor visits a InvocationExpressionSyntax node. Called when the visitor visits a ElementAccessExpressionSyntax node. Called when the visitor visits a ArgumentListSyntax node. Called when the visitor visits a BracketedArgumentListSyntax node. Called when the visitor visits a ArgumentSyntax node. Called when the visitor visits a ExpressionColonSyntax node. Called when the visitor visits a NameColonSyntax node. Called when the visitor visits a DeclarationExpressionSyntax node. Called when the visitor visits a CastExpressionSyntax node. Called when the visitor visits a AnonymousMethodExpressionSyntax node. Called when the visitor visits a SimpleLambdaExpressionSyntax node. Called when the visitor visits a RefExpressionSyntax node. Called when the visitor visits a ParenthesizedLambdaExpressionSyntax node. Called when the visitor visits a InitializerExpressionSyntax node. Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node. Called when the visitor visits a ObjectCreationExpressionSyntax node. Called when the visitor visits a WithExpressionSyntax node. Called when the visitor visits a AnonymousObjectMemberDeclaratorSyntax node. Called when the visitor visits a AnonymousObjectCreationExpressionSyntax node. Called when the visitor visits a ArrayCreationExpressionSyntax node. Called when the visitor visits a ImplicitArrayCreationExpressionSyntax node. Called when the visitor visits a StackAllocArrayCreationExpressionSyntax node. Called when the visitor visits a ImplicitStackAllocArrayCreationExpressionSyntax node. Called when the visitor visits a CollectionExpressionSyntax node. Called when the visitor visits a ExpressionElementSyntax node. Called when the visitor visits a SpreadElementSyntax node. Called when the visitor visits a QueryExpressionSyntax node. Called when the visitor visits a QueryBodySyntax node. Called when the visitor visits a FromClauseSyntax node. Called when the visitor visits a LetClauseSyntax node. Called when the visitor visits a JoinClauseSyntax node. Called when the visitor visits a JoinIntoClauseSyntax node. Called when the visitor visits a WhereClauseSyntax node. Called when the visitor visits a OrderByClauseSyntax node. Called when the visitor visits a OrderingSyntax node. Called when the visitor visits a SelectClauseSyntax node. Called when the visitor visits a GroupClauseSyntax node. Called when the visitor visits a QueryContinuationSyntax node. Called when the visitor visits a OmittedArraySizeExpressionSyntax node. Called when the visitor visits a InterpolatedStringExpressionSyntax node. Called when the visitor visits a IsPatternExpressionSyntax node. Called when the visitor visits a ThrowExpressionSyntax node. Called when the visitor visits a WhenClauseSyntax node. Called when the visitor visits a DiscardPatternSyntax node. Called when the visitor visits a DeclarationPatternSyntax node. Called when the visitor visits a VarPatternSyntax node. Called when the visitor visits a RecursivePatternSyntax node. Called when the visitor visits a PositionalPatternClauseSyntax node. Called when the visitor visits a PropertyPatternClauseSyntax node. Called when the visitor visits a SubpatternSyntax node. Called when the visitor visits a ConstantPatternSyntax node. Called when the visitor visits a ParenthesizedPatternSyntax node. Called when the visitor visits a RelationalPatternSyntax node. Called when the visitor visits a TypePatternSyntax node. Called when the visitor visits a BinaryPatternSyntax node. Called when the visitor visits a UnaryPatternSyntax node. Called when the visitor visits a ListPatternSyntax node. Called when the visitor visits a SlicePatternSyntax node. Called when the visitor visits a InterpolatedStringTextSyntax node. Called when the visitor visits a InterpolationSyntax node. Called when the visitor visits a InterpolationAlignmentClauseSyntax node. Called when the visitor visits a InterpolationFormatClauseSyntax node. Called when the visitor visits a GlobalStatementSyntax node. Called when the visitor visits a BlockSyntax node. Called when the visitor visits a LocalFunctionStatementSyntax node. Called when the visitor visits a LocalDeclarationStatementSyntax node. Called when the visitor visits a VariableDeclarationSyntax node. Called when the visitor visits a VariableDeclaratorSyntax node. Called when the visitor visits a EqualsValueClauseSyntax node. Called when the visitor visits a SingleVariableDesignationSyntax node. Called when the visitor visits a DiscardDesignationSyntax node. Called when the visitor visits a ParenthesizedVariableDesignationSyntax node. Called when the visitor visits a ExpressionStatementSyntax node. Called when the visitor visits a EmptyStatementSyntax node. Called when the visitor visits a LabeledStatementSyntax node. Called when the visitor visits a GotoStatementSyntax node. Called when the visitor visits a BreakStatementSyntax node. Called when the visitor visits a ContinueStatementSyntax node. Called when the visitor visits a ReturnStatementSyntax node. Called when the visitor visits a ThrowStatementSyntax node. Called when the visitor visits a YieldStatementSyntax node. Called when the visitor visits a WhileStatementSyntax node. Called when the visitor visits a DoStatementSyntax node. Called when the visitor visits a ForStatementSyntax node. Called when the visitor visits a ForEachStatementSyntax node. Called when the visitor visits a ForEachVariableStatementSyntax node. Called when the visitor visits a UsingStatementSyntax node. Called when the visitor visits a FixedStatementSyntax node. Called when the visitor visits a CheckedStatementSyntax node. Called when the visitor visits a UnsafeStatementSyntax node. Called when the visitor visits a LockStatementSyntax node. Called when the visitor visits a IfStatementSyntax node. Called when the visitor visits a ElseClauseSyntax node. Called when the visitor visits a SwitchStatementSyntax node. Called when the visitor visits a SwitchSectionSyntax node. Called when the visitor visits a CasePatternSwitchLabelSyntax node. Called when the visitor visits a CaseSwitchLabelSyntax node. Called when the visitor visits a DefaultSwitchLabelSyntax node. Called when the visitor visits a SwitchExpressionSyntax node. Called when the visitor visits a SwitchExpressionArmSyntax node. Called when the visitor visits a TryStatementSyntax node. Called when the visitor visits a CatchClauseSyntax node. Called when the visitor visits a CatchDeclarationSyntax node. Called when the visitor visits a CatchFilterClauseSyntax node. Called when the visitor visits a FinallyClauseSyntax node. Called when the visitor visits a CompilationUnitSyntax node. Called when the visitor visits a ExternAliasDirectiveSyntax node. Called when the visitor visits a UsingDirectiveSyntax node. Called when the visitor visits a NamespaceDeclarationSyntax node. Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node. Called when the visitor visits a AttributeListSyntax node. Called when the visitor visits a AttributeTargetSpecifierSyntax node. Called when the visitor visits a AttributeSyntax node. Called when the visitor visits a AttributeArgumentListSyntax node. Called when the visitor visits a AttributeArgumentSyntax node. Called when the visitor visits a NameEqualsSyntax node. Called when the visitor visits a TypeParameterListSyntax node. Called when the visitor visits a TypeParameterSyntax node. Called when the visitor visits a ClassDeclarationSyntax node. Called when the visitor visits a StructDeclarationSyntax node. Called when the visitor visits a InterfaceDeclarationSyntax node. Called when the visitor visits a RecordDeclarationSyntax node. Called when the visitor visits a EnumDeclarationSyntax node. Called when the visitor visits a DelegateDeclarationSyntax node. Called when the visitor visits a EnumMemberDeclarationSyntax node. Called when the visitor visits a BaseListSyntax node. Called when the visitor visits a SimpleBaseTypeSyntax node. Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node. Called when the visitor visits a TypeParameterConstraintClauseSyntax node. Called when the visitor visits a ConstructorConstraintSyntax node. Called when the visitor visits a ClassOrStructConstraintSyntax node. Called when the visitor visits a TypeConstraintSyntax node. Called when the visitor visits a DefaultConstraintSyntax node. Called when the visitor visits a AllowsConstraintClauseSyntax node. Called when the visitor visits a RefStructConstraintSyntax node. Called when the visitor visits a FieldDeclarationSyntax node. Called when the visitor visits a EventFieldDeclarationSyntax node. Called when the visitor visits a ExplicitInterfaceSpecifierSyntax node. Called when the visitor visits a MethodDeclarationSyntax node. Called when the visitor visits a OperatorDeclarationSyntax node. Called when the visitor visits a ConversionOperatorDeclarationSyntax node. Called when the visitor visits a ConstructorDeclarationSyntax node. Called when the visitor visits a ConstructorInitializerSyntax node. Called when the visitor visits a DestructorDeclarationSyntax node. Called when the visitor visits a PropertyDeclarationSyntax node. Called when the visitor visits a ArrowExpressionClauseSyntax node. Called when the visitor visits a EventDeclarationSyntax node. Called when the visitor visits a IndexerDeclarationSyntax node. Called when the visitor visits a AccessorListSyntax node. Called when the visitor visits a AccessorDeclarationSyntax node. Called when the visitor visits a ParameterListSyntax node. Called when the visitor visits a BracketedParameterListSyntax node. Called when the visitor visits a ParameterSyntax node. Called when the visitor visits a FunctionPointerParameterSyntax node. Called when the visitor visits a IncompleteMemberSyntax node. Called when the visitor visits a SkippedTokensTriviaSyntax node. Called when the visitor visits a DocumentationCommentTriviaSyntax node. Called when the visitor visits a TypeCrefSyntax node. Called when the visitor visits a QualifiedCrefSyntax node. Called when the visitor visits a NameMemberCrefSyntax node. Called when the visitor visits a IndexerMemberCrefSyntax node. Called when the visitor visits a OperatorMemberCrefSyntax node. Called when the visitor visits a ConversionOperatorMemberCrefSyntax node. Called when the visitor visits a CrefParameterListSyntax node. Called when the visitor visits a CrefBracketedParameterListSyntax node. Called when the visitor visits a CrefParameterSyntax node. Called when the visitor visits a XmlElementSyntax node. Called when the visitor visits a XmlElementStartTagSyntax node. Called when the visitor visits a XmlElementEndTagSyntax node. Called when the visitor visits a XmlEmptyElementSyntax node. Called when the visitor visits a XmlNameSyntax node. Called when the visitor visits a XmlPrefixSyntax node. Called when the visitor visits a XmlTextAttributeSyntax node. Called when the visitor visits a XmlCrefAttributeSyntax node. Called when the visitor visits a XmlNameAttributeSyntax node. Called when the visitor visits a XmlTextSyntax node. Called when the visitor visits a XmlCDataSectionSyntax node. Called when the visitor visits a XmlProcessingInstructionSyntax node. Called when the visitor visits a XmlCommentSyntax node. Called when the visitor visits a IfDirectiveTriviaSyntax node. Called when the visitor visits a ElifDirectiveTriviaSyntax node. Called when the visitor visits a ElseDirectiveTriviaSyntax node. Called when the visitor visits a EndIfDirectiveTriviaSyntax node. Called when the visitor visits a RegionDirectiveTriviaSyntax node. Called when the visitor visits a EndRegionDirectiveTriviaSyntax node. Called when the visitor visits a ErrorDirectiveTriviaSyntax node. Called when the visitor visits a WarningDirectiveTriviaSyntax node. Called when the visitor visits a BadDirectiveTriviaSyntax node. Called when the visitor visits a DefineDirectiveTriviaSyntax node. Called when the visitor visits a UndefDirectiveTriviaSyntax node. Called when the visitor visits a LineDirectiveTriviaSyntax node. Called when the visitor visits a LineDirectivePositionSyntax node. Called when the visitor visits a LineSpanDirectiveTriviaSyntax node. Called when the visitor visits a PragmaWarningDirectiveTriviaSyntax node. Called when the visitor visits a PragmaChecksumDirectiveTriviaSyntax node. Called when the visitor visits a ReferenceDirectiveTriviaSyntax node. Called when the visitor visits a LoadDirectiveTriviaSyntax node. Called when the visitor visits a ShebangDirectiveTriviaSyntax node. Called when the visitor visits a NullableDirectiveTriviaSyntax node. Represents a visitor that visits only the single CSharpSyntaxNode passed into its Visit method. Called when the visitor visits a IdentifierNameSyntax node. Called when the visitor visits a QualifiedNameSyntax node. Called when the visitor visits a GenericNameSyntax node. Called when the visitor visits a TypeArgumentListSyntax node. Called when the visitor visits a AliasQualifiedNameSyntax node. Called when the visitor visits a PredefinedTypeSyntax node. Called when the visitor visits a ArrayTypeSyntax node. Called when the visitor visits a ArrayRankSpecifierSyntax node. Called when the visitor visits a PointerTypeSyntax node. Called when the visitor visits a FunctionPointerTypeSyntax node. Called when the visitor visits a FunctionPointerParameterListSyntax node. Called when the visitor visits a FunctionPointerCallingConventionSyntax node. Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node. Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node. Called when the visitor visits a NullableTypeSyntax node. Called when the visitor visits a TupleTypeSyntax node. Called when the visitor visits a TupleElementSyntax node. Called when the visitor visits a OmittedTypeArgumentSyntax node. Called when the visitor visits a RefTypeSyntax node. Called when the visitor visits a ScopedTypeSyntax node. Called when the visitor visits a ParenthesizedExpressionSyntax node. Called when the visitor visits a TupleExpressionSyntax node. Called when the visitor visits a PrefixUnaryExpressionSyntax node. Called when the visitor visits a AwaitExpressionSyntax node. Called when the visitor visits a PostfixUnaryExpressionSyntax node. Called when the visitor visits a MemberAccessExpressionSyntax node. Called when the visitor visits a ConditionalAccessExpressionSyntax node. Called when the visitor visits a MemberBindingExpressionSyntax node. Called when the visitor visits a ElementBindingExpressionSyntax node. Called when the visitor visits a RangeExpressionSyntax node. Called when the visitor visits a ImplicitElementAccessSyntax node. Called when the visitor visits a BinaryExpressionSyntax node. Called when the visitor visits a AssignmentExpressionSyntax node. Called when the visitor visits a ConditionalExpressionSyntax node. Called when the visitor visits a ThisExpressionSyntax node. Called when the visitor visits a BaseExpressionSyntax node. Called when the visitor visits a LiteralExpressionSyntax node. Called when the visitor visits a FieldExpressionSyntax node. Called when the visitor visits a MakeRefExpressionSyntax node. Called when the visitor visits a RefTypeExpressionSyntax node. Called when the visitor visits a RefValueExpressionSyntax node. Called when the visitor visits a CheckedExpressionSyntax node. Called when the visitor visits a DefaultExpressionSyntax node. Called when the visitor visits a TypeOfExpressionSyntax node. Called when the visitor visits a SizeOfExpressionSyntax node. Called when the visitor visits a InvocationExpressionSyntax node. Called when the visitor visits a ElementAccessExpressionSyntax node. Called when the visitor visits a ArgumentListSyntax node. Called when the visitor visits a BracketedArgumentListSyntax node. Called when the visitor visits a ArgumentSyntax node. Called when the visitor visits a ExpressionColonSyntax node. Called when the visitor visits a NameColonSyntax node. Called when the visitor visits a DeclarationExpressionSyntax node. Called when the visitor visits a CastExpressionSyntax node. Called when the visitor visits a AnonymousMethodExpressionSyntax node. Called when the visitor visits a SimpleLambdaExpressionSyntax node. Called when the visitor visits a RefExpressionSyntax node. Called when the visitor visits a ParenthesizedLambdaExpressionSyntax node. Called when the visitor visits a InitializerExpressionSyntax node. Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node. Called when the visitor visits a ObjectCreationExpressionSyntax node. Called when the visitor visits a WithExpressionSyntax node. Called when the visitor visits a AnonymousObjectMemberDeclaratorSyntax node. Called when the visitor visits a AnonymousObjectCreationExpressionSyntax node. Called when the visitor visits a ArrayCreationExpressionSyntax node. Called when the visitor visits a ImplicitArrayCreationExpressionSyntax node. Called when the visitor visits a StackAllocArrayCreationExpressionSyntax node. Called when the visitor visits a ImplicitStackAllocArrayCreationExpressionSyntax node. Called when the visitor visits a CollectionExpressionSyntax node. Called when the visitor visits a ExpressionElementSyntax node. Called when the visitor visits a SpreadElementSyntax node. Called when the visitor visits a QueryExpressionSyntax node. Called when the visitor visits a QueryBodySyntax node. Called when the visitor visits a FromClauseSyntax node. Called when the visitor visits a LetClauseSyntax node. Called when the visitor visits a JoinClauseSyntax node. Called when the visitor visits a JoinIntoClauseSyntax node. Called when the visitor visits a WhereClauseSyntax node. Called when the visitor visits a OrderByClauseSyntax node. Called when the visitor visits a OrderingSyntax node. Called when the visitor visits a SelectClauseSyntax node. Called when the visitor visits a GroupClauseSyntax node. Called when the visitor visits a QueryContinuationSyntax node. Called when the visitor visits a OmittedArraySizeExpressionSyntax node. Called when the visitor visits a InterpolatedStringExpressionSyntax node. Called when the visitor visits a IsPatternExpressionSyntax node. Called when the visitor visits a ThrowExpressionSyntax node. Called when the visitor visits a WhenClauseSyntax node. Called when the visitor visits a DiscardPatternSyntax node. Called when the visitor visits a DeclarationPatternSyntax node. Called when the visitor visits a VarPatternSyntax node. Called when the visitor visits a RecursivePatternSyntax node. Called when the visitor visits a PositionalPatternClauseSyntax node. Called when the visitor visits a PropertyPatternClauseSyntax node. Called when the visitor visits a SubpatternSyntax node. Called when the visitor visits a ConstantPatternSyntax node. Called when the visitor visits a ParenthesizedPatternSyntax node. Called when the visitor visits a RelationalPatternSyntax node. Called when the visitor visits a TypePatternSyntax node. Called when the visitor visits a BinaryPatternSyntax node. Called when the visitor visits a UnaryPatternSyntax node. Called when the visitor visits a ListPatternSyntax node. Called when the visitor visits a SlicePatternSyntax node. Called when the visitor visits a InterpolatedStringTextSyntax node. Called when the visitor visits a InterpolationSyntax node. Called when the visitor visits a InterpolationAlignmentClauseSyntax node. Called when the visitor visits a InterpolationFormatClauseSyntax node. Called when the visitor visits a GlobalStatementSyntax node. Called when the visitor visits a BlockSyntax node. Called when the visitor visits a LocalFunctionStatementSyntax node. Called when the visitor visits a LocalDeclarationStatementSyntax node. Called when the visitor visits a VariableDeclarationSyntax node. Called when the visitor visits a VariableDeclaratorSyntax node. Called when the visitor visits a EqualsValueClauseSyntax node. Called when the visitor visits a SingleVariableDesignationSyntax node. Called when the visitor visits a DiscardDesignationSyntax node. Called when the visitor visits a ParenthesizedVariableDesignationSyntax node. Called when the visitor visits a ExpressionStatementSyntax node. Called when the visitor visits a EmptyStatementSyntax node. Called when the visitor visits a LabeledStatementSyntax node. Called when the visitor visits a GotoStatementSyntax node. Called when the visitor visits a BreakStatementSyntax node. Called when the visitor visits a ContinueStatementSyntax node. Called when the visitor visits a ReturnStatementSyntax node. Called when the visitor visits a ThrowStatementSyntax node. Called when the visitor visits a YieldStatementSyntax node. Called when the visitor visits a WhileStatementSyntax node. Called when the visitor visits a DoStatementSyntax node. Called when the visitor visits a ForStatementSyntax node. Called when the visitor visits a ForEachStatementSyntax node. Called when the visitor visits a ForEachVariableStatementSyntax node. Called when the visitor visits a UsingStatementSyntax node. Called when the visitor visits a FixedStatementSyntax node. Called when the visitor visits a CheckedStatementSyntax node. Called when the visitor visits a UnsafeStatementSyntax node. Called when the visitor visits a LockStatementSyntax node. Called when the visitor visits a IfStatementSyntax node. Called when the visitor visits a ElseClauseSyntax node. Called when the visitor visits a SwitchStatementSyntax node. Called when the visitor visits a SwitchSectionSyntax node. Called when the visitor visits a CasePatternSwitchLabelSyntax node. Called when the visitor visits a CaseSwitchLabelSyntax node. Called when the visitor visits a DefaultSwitchLabelSyntax node. Called when the visitor visits a SwitchExpressionSyntax node. Called when the visitor visits a SwitchExpressionArmSyntax node. Called when the visitor visits a TryStatementSyntax node. Called when the visitor visits a CatchClauseSyntax node. Called when the visitor visits a CatchDeclarationSyntax node. Called when the visitor visits a CatchFilterClauseSyntax node. Called when the visitor visits a FinallyClauseSyntax node. Called when the visitor visits a CompilationUnitSyntax node. Called when the visitor visits a ExternAliasDirectiveSyntax node. Called when the visitor visits a UsingDirectiveSyntax node. Called when the visitor visits a NamespaceDeclarationSyntax node. Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node. Called when the visitor visits a AttributeListSyntax node. Called when the visitor visits a AttributeTargetSpecifierSyntax node. Called when the visitor visits a AttributeSyntax node. Called when the visitor visits a AttributeArgumentListSyntax node. Called when the visitor visits a AttributeArgumentSyntax node. Called when the visitor visits a NameEqualsSyntax node. Called when the visitor visits a TypeParameterListSyntax node. Called when the visitor visits a TypeParameterSyntax node. Called when the visitor visits a ClassDeclarationSyntax node. Called when the visitor visits a StructDeclarationSyntax node. Called when the visitor visits a InterfaceDeclarationSyntax node. Called when the visitor visits a RecordDeclarationSyntax node. Called when the visitor visits a EnumDeclarationSyntax node. Called when the visitor visits a DelegateDeclarationSyntax node. Called when the visitor visits a EnumMemberDeclarationSyntax node. Called when the visitor visits a BaseListSyntax node. Called when the visitor visits a SimpleBaseTypeSyntax node. Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node. Called when the visitor visits a TypeParameterConstraintClauseSyntax node. Called when the visitor visits a ConstructorConstraintSyntax node. Called when the visitor visits a ClassOrStructConstraintSyntax node. Called when the visitor visits a TypeConstraintSyntax node. Called when the visitor visits a DefaultConstraintSyntax node. Called when the visitor visits a AllowsConstraintClauseSyntax node. Called when the visitor visits a RefStructConstraintSyntax node. Called when the visitor visits a FieldDeclarationSyntax node. Called when the visitor visits a EventFieldDeclarationSyntax node. Called when the visitor visits a ExplicitInterfaceSpecifierSyntax node. Called when the visitor visits a MethodDeclarationSyntax node. Called when the visitor visits a OperatorDeclarationSyntax node. Called when the visitor visits a ConversionOperatorDeclarationSyntax node. Called when the visitor visits a ConstructorDeclarationSyntax node. Called when the visitor visits a ConstructorInitializerSyntax node. Called when the visitor visits a DestructorDeclarationSyntax node. Called when the visitor visits a PropertyDeclarationSyntax node. Called when the visitor visits a ArrowExpressionClauseSyntax node. Called when the visitor visits a EventDeclarationSyntax node. Called when the visitor visits a IndexerDeclarationSyntax node. Called when the visitor visits a AccessorListSyntax node. Called when the visitor visits a AccessorDeclarationSyntax node. Called when the visitor visits a ParameterListSyntax node. Called when the visitor visits a BracketedParameterListSyntax node. Called when the visitor visits a ParameterSyntax node. Called when the visitor visits a FunctionPointerParameterSyntax node. Called when the visitor visits a IncompleteMemberSyntax node. Called when the visitor visits a SkippedTokensTriviaSyntax node. Called when the visitor visits a DocumentationCommentTriviaSyntax node. Called when the visitor visits a TypeCrefSyntax node. Called when the visitor visits a QualifiedCrefSyntax node. Called when the visitor visits a NameMemberCrefSyntax node. Called when the visitor visits a IndexerMemberCrefSyntax node. Called when the visitor visits a OperatorMemberCrefSyntax node. Called when the visitor visits a ConversionOperatorMemberCrefSyntax node. Called when the visitor visits a CrefParameterListSyntax node. Called when the visitor visits a CrefBracketedParameterListSyntax node. Called when the visitor visits a CrefParameterSyntax node. Called when the visitor visits a XmlElementSyntax node. Called when the visitor visits a XmlElementStartTagSyntax node. Called when the visitor visits a XmlElementEndTagSyntax node. Called when the visitor visits a XmlEmptyElementSyntax node. Called when the visitor visits a XmlNameSyntax node. Called when the visitor visits a XmlPrefixSyntax node. Called when the visitor visits a XmlTextAttributeSyntax node. Called when the visitor visits a XmlCrefAttributeSyntax node. Called when the visitor visits a XmlNameAttributeSyntax node. Called when the visitor visits a XmlTextSyntax node. Called when the visitor visits a XmlCDataSectionSyntax node. Called when the visitor visits a XmlProcessingInstructionSyntax node. Called when the visitor visits a XmlCommentSyntax node. Called when the visitor visits a IfDirectiveTriviaSyntax node. Called when the visitor visits a ElifDirectiveTriviaSyntax node. Called when the visitor visits a ElseDirectiveTriviaSyntax node. Called when the visitor visits a EndIfDirectiveTriviaSyntax node. Called when the visitor visits a RegionDirectiveTriviaSyntax node. Called when the visitor visits a EndRegionDirectiveTriviaSyntax node. Called when the visitor visits a ErrorDirectiveTriviaSyntax node. Called when the visitor visits a WarningDirectiveTriviaSyntax node. Called when the visitor visits a BadDirectiveTriviaSyntax node. Called when the visitor visits a DefineDirectiveTriviaSyntax node. Called when the visitor visits a UndefDirectiveTriviaSyntax node. Called when the visitor visits a LineDirectiveTriviaSyntax node. Called when the visitor visits a LineDirectivePositionSyntax node. Called when the visitor visits a LineSpanDirectiveTriviaSyntax node. Called when the visitor visits a PragmaWarningDirectiveTriviaSyntax node. Called when the visitor visits a PragmaChecksumDirectiveTriviaSyntax node. Called when the visitor visits a ReferenceDirectiveTriviaSyntax node. Called when the visitor visits a LoadDirectiveTriviaSyntax node. Called when the visitor visits a ShebangDirectiveTriviaSyntax node. Called when the visitor visits a NullableDirectiveTriviaSyntax node. Represents a that descends an entire graph visiting each CSharpSyntaxNode and its child SyntaxNodes and s in depth-first order. Returns true if the specified node represents a lambda. Given a node that represents a lambda body returns a node that represents the lambda. See SyntaxNode.GetCorrespondingLambdaBody. Returns true if the specified represents a body of a lambda. When queries are translated into expressions select and group-by expressions such that 1) select/group-by expression is the same identifier as the "source" identifier and 2) at least one Where or OrderBy clause but no other clause is present in the contained query body or the expression in question is a group-by expression and the body has no clause do not translate into lambdas. By "source" identifier we mean the identifier specified in the from clause that initiates the query or the query continuation that includes the body. The above condition can be derived from the language specification (chapter 7.16.2) as follows: - In order for 7.16.2.5 "Select clauses" to be applicable the following conditions must hold: - There has to be at least one clause in the body, otherwise the query is reduced into a final form by 7.16.2.3 "Degenerate query expressions". - Only where and order-by clauses may be present in the query body, otherwise a transformation in 7.16.2.4 "From, let, where, join and orderby clauses" produces pattern that doesn't match the requirements of 7.16.2.5. - In order for 7.16.2.6 "Groupby clauses" to be applicable the following conditions must hold: - Only where and order-by clauses may be present in the query body, otherwise a transformation in 7.16.2.4 "From, let, where, join and orderby clauses" produces pattern that doesn't match the requirements of 7.16.2.5. In C# lambda bodies are expressions or block statements. In both cases it's a single node. In VB a lambda body might be a sequence of nodes (statements). We define this function to minimize differences between C# and VB implementation. If the specified node represents a lambda returns a node (or nodes) that represent its body (bodies). Compares content of two nodes ignoring lambda bodies and trivia. "Pair lambda" is a synthesized lambda that creates an instance of an anonymous type representing a pair of values. Returns true if the specified node is of a kind that could represent a closure scope -- that is, a scope of a captured variable. Doesn't check whether or not the node actually declares any captured variable. Given a node that represents a variable declaration, lambda or a closure scope return the position to be used to calculate the node's syntax offset with respect to its containing member. A SyntaxReference implementation that lazily translates the result (CSharpSyntaxNode) of the original syntax reference to a syntax reference for its NamespaceDeclarationSyntax. this is a basic do-nothing implementation of a syntax reference Gets the expression-body syntax from an expression-bodied member. The given syntax must be for a member which could contain an expression-body. Creates a new syntax token with all whitespace and end of line trivia replaced with regularly formatted trivia. The token to normalize. A sequence of whitespace characters that defines a single level of indentation. If true the replaced trivia is elastic trivia. Return the identifier of an out declaration argument expression. Creates a new syntax token with all whitespace and end of line trivia replaced with regularly formatted trivia. The token to normalize. An optional sequence of whitespace characters that defines a single level of indentation. An optional sequence of whitespace characters used for end of line. If true the replaced trivia is elastic trivia. Creates a new syntax trivia list with all whitespace and end of line trivia replaced with regularly formatted trivia. The trivia list to normalize. A sequence of whitespace characters that defines a single level of indentation. If true the replaced trivia is elastic trivia. Creates a new syntax trivia list with all whitespace and end of line trivia replaced with regularly formatted trivia. The trivia list to normalize. An optional sequence of whitespace characters that defines a single level of indentation. An optional sequence of whitespace characters used for end of line. If true the replaced trivia is elastic trivia. Updates the given SimpleNameSyntax node with the given identifier token. This function is a wrapper that calls WithIdentifier on derived syntax nodes. The given simple name updated with the given identifier. Returns true if the expression on the left-hand-side of an assignment causes the assignment to be a deconstruction. If this declaration or identifier is part of a deconstruction, find the deconstruction. If found, returns either an assignment expression or a foreach variable statement. Returns null otherwise. Visits all the ArrayRankSpecifiers of a typeSyntax, invoking an action on each one in turn. The argument that is passed to the action whenever it is invoked Represents ~ token. Represents ! token. Represents $ token. This is a debugger special punctuation and not related to string interpolation. Represents % token. Represents ^ token. Represents & token. Represents * token. Represents ( token. Represents ) token. Represents - token. Represents + token. Represents = token. Represents { token. Represents } token. Represents [ token. Represents ] token. Represents | token. Represents \ token. Represents : token. Represents ; token. Represents " token. Represents ' token. Represents < token. Represents , token. Represents > token. Represents . token. Represents ? token. Represents # token. Represents / token. Represents .. token. Represents /> token. Represents </ token. Represents <!-- token. Represents --> token. Represents <![CDATA[ token. Represents ]]> token. Represents <? token. Represents ?> token. Represents || token. Represents && token. Represents -- token. Represents ++ token. Represents :: token. Represents ?? token. Represents -> token. Represents != token. Represents == token. Represents => token. Represents <= token. Represents << token. Represents <<= token. Represents >= token. Represents >> token. Represents >>= token. Represents /= token. Represents *= token. Represents |= token. Represents &= token. Represents += token. Represents -= token. Represents ^= token. Represents %= token. Represents ??= token. Represents >>> token. Represents >>>= token. Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents . Represents $" token. Represents " token that is closing $". Represents $@ or @$ token. Represents . Represents . Represents . Represents . Represents . Represents . Represents _ token. Represents that nothing was specified as a type argument. For example Dictionary<,> which has as a child of before and after the . Represents that nothing was specified as an array size. For example int[,] which has as a child of before and after the . Represents a token that comes after the end of a directive such as #endif. Represents the end of a triple-slash documentation comment. Represents the end of a file. Token for a whole interpolated string $""" ... { expr } ...""". This only exists in transient form during parsing. This method is used to keep the code that generates binders in sync with the code that searches for binders. We don't want the searcher to skip over any nodes that could have associated binders, especially if changes are made later. "Local binder" is a term that refers to binders that are created by LocalBinderFactory. Because the instruction cannot have any values on the stack before CLR execution we limited it to assignments and conditional expressions in C# 7. See https://github.com/dotnet/roslyn/issues/22046. In C# 8 we relaxed that by rewriting the code to move it to the statement level where the stack is empty. Given an initializer expression infer the name of anonymous property or tuple element. Returns default if unsuccessful For callers that just want to unwrap a and don't care if ref/readonly was there. As these callers don't care about 'ref', they are in scenarios where 'ref' is not legal, and existing code will error out for them. Callers that do want to know what the ref-kind is should use or depending on which language feature they are asking for. See if the expression is an invocation of a method named 'var', I.e. something like "var(x, y)" or "var(x, (y, z))" or "var(1)". We report an error when such an invocation is used in a certain syntactic contexts that will require an lvalue because we may elect to support deconstruction in the future. We need to ensure that we do not successfully interpret this as an invocation of a ref-returning method named var. A token parser that can be used to parse tokens continuously from a source. This parser parses continuously; every call to will return the next token in the source text, starting from position 0. can be used to skip forward in the file to a specific position, and can be used to reset the parser to a previously-lexed position. This type is safe to double dispose, but it is not safe to use after it has been disposed. Behavior in such scenarios is undefined. This type is not thread safe. Parse the next token from the input at the current position. This will advance the internal position of the token parser to the end of the returned token, including any trailing trivia. The returned token will have a parent of . Since this API does not create a that owns all produced tokens, the API may yield surprising results for the produced tokens and its behavior is generally unspecified. Parse the leading trivia of the next token from the input at the current position. This will advance the internal position of the token parser to the end of the leading trivia of the next token. The returned result will have a token with of , set to , and a parent of . The parsed trivia will be set as the of the token. Parse syntax trivia from the current position, according to the rules of trailing syntax trivia. This will advance the internal position of the token parser to the end of the trailing trivia from the current location. The returned result will have a token with of , set to , and a parent of . The parsed trivia will be set as the of the token. Skip forward in the input to the specified position. Current directive state is preserved during the skip. The absolute location in the original text to move to. If the given position is less than the current position of the lexer. Resets the token parser to an earlier position in the input. The parser is reset to the start of the token that was previously parsed, before any leading trivia, with the directive state that existed at the start of the token. The result of a call to . This is also a context object that can be used to reset the parser to before the token it represents was parsed. This type is not default safe. Attempts to use default(Result) will result in undefined behavior. The token that was parsed. If the parsed token is potentially a contextual keyword, this will return the contextual kind of the token. Otherwise, it will return . An enumerator for diagnostic lists. Moves the enumerator to the next diagnostic instance in the diagnostic list. Returns true if enumerator moved to the next diagnostic, false if the enumerator was at the end of the diagnostic list. The current diagnostic that the enumerator is pointing at. The version of the location encoding. Used as an argument to 'InterceptsLocationAttribute'. Opaque data which references a call when used as an argument to 'InterceptsLocationAttribute'. The value does not require escaping, i.e. it is valid in a string literal when wrapped in " (double-quote) characters. Gets a human-readable representation of the location, suitable for including in comments in generated code. Version 1 of the InterceptableLocation encoding. An interface representing a set of values of a specific type. During construction of the state machine for pattern-matching, we track the set of values of each intermediate result that can reach each state. That permits us to determine when tests can be eliminated either because they are impossible (and can be replaced by an always-false test) or always true with the set of values that can reach that state (and can be replaced by an always-true test). Return the intersection of this value set with another. Both must have been created with the same . Return this union of this value set with another. Both must have been created with the same . Return the complement of this value set. Test if the value set contains any values that satisfy the given relation with the given value. Supported values for are for all supported types, and for numeric types we also support , , , and . Test if all of the value in the set satisfy the given relation with the given value. Note that the empty set trivially satisfies this. Because of that all four combinations of results from and are possible: both true when the set is nonempty and all values satisfy the relation; both false when the set is nonempty and none of the values satisfy the relation; all but not any when the set is empty; any but not all when the set is nonempty and some values satisfy the relation and some do not. Does this value set contain no values? Produce a sample value contained in the set. Throws if the set is empty. If the set contains values but we cannot produce a particular value (e.g. for the set `nint > int.MaxValue`), returns null. An interface representing a set of values of a specific type. Like but strongly typed to . Return the intersection of this value set with another. Both must have been created with the same . Return this union of this value set with another. Both must have been created with the same . Return the complement of this value set. Test if the value set contains any values that satisfy the given relation with the given value. Test if all of the value in the set satisfy the given relation with the given value. Note that the empty set trivially satisfies this. Because of that all four combinations of results from and are possible: both true when the set is nonempty and all values satisfy the relation; both false when the set is nonempty and none of the values satisfy the relation; all but not any when the set is empty; any but not all when the set is nonempty and some values satisfy the relation and some do not. A value set factory, which can be used to create a value set instance. A given instance of supports only one type for the value sets it can produce. Returns a value set that includes any values that satisfy the given relation when compared to the given value. Returns true iff the values are related according to the given relation. Produce a random value set with the given expected size for testing. Produce a random value for testing. The set containing all values of the type. The empty set of values. A value set factory, which can be used to create a value set instance. Like but strongly typed to . Returns a value set that includes any values that satisfy the given relation when compared to the given value. A collection of value set factory instances for built-in types. A value set factory for boolean values. The implementation of Next depends critically on the internal representation of an IEEE floating-point number. Every bit sequence between the representation of 0 and MaxValue represents a distinct value, and the integer representations are ordered by value the same as the floating-point numbers they represent. Produce a string for testing purposes that is likely to be the same independent of platform and locale. A value set that only supports equality and works by including or excluding specific values. This is used for value set of because the language defines no relational operators for it; such a set can be formed only by including explicitly mentioned members (or the inverse, excluding them, by complementing the set). In , then members are listed by inclusion. Otherwise all members are assumed to be contained in the set unless excluded. A value set factory that only supports equality and works by including or excluding specific values. A type class providing primitive operations needed to support a value set for a floating-point type. A "not a number" value for the floating-point type . All NaN values are treated as equivalent. A value set implementation for and . A floating-point type. A type class for values (of type ) that can be directly compared for equality using . Get the constant value of type from a . This method is shared among all typeclasses for value sets. Translate a numeric value of type into a . Generate random values of type . If the domain of is infinite (for example, a string type), the parameter is used to identify the size of a restricted domain. If the domain is finite (for example the numeric types), then is ignored. A type class providing the primitive operations needed to support a value set. the underlying primitive numeric type Get the constant value of type from a . This method is shared among all typeclasses for value sets. Translate a numeric value of type into a . Compute the value of the binary relational operator on the given operands. The smallest value of . The largest value of . The successor (next larger) value to a given value. The result is not defined when is . The predecessor (previous larger) value to a given value. The result is not defined when is . Produce a randomly-selected value for testing purposes. Produce the zero value for the type. A formatter for values of type . This is needed for testing because the default ToString output for float and double changed between desktop and .net core, and also because we want the string representation to be locale-independent. A value of type nint may, in a 64-bit runtime, take on values less than . A value set representing values of type nint groups them all together, so that it is not possible to distinguish one such value from another. The flag is true when the set is considered to contain all values less than (if any). A value of type nint may, in a 64-bit runtime, take on values greater than . A value set representing values of type nint groups them all together, so that it is not possible to distinguish one such value from another. The flag is true when the set is considered to contain all values greater than (if any). A value of type nuint may, in a 64-bit runtime, take on values greater than . A value set representing values of type nuint groups them all together, so that it is not possible to distinguish one such value from another. The flag is true when the set is considered to contain all values greater than (if any). The implementation of a value set for an numeric type . Add an interval to the end of the builder. Produce a random value set for testing purposes. A string representation for testing purposes. The implementation of a value set factory of any numeric type , parameterized by a type class that provides the primitives for that type. The implementation of Next depends critically on the internal representation of an IEEE floating-point number. Every bit sequence between the representation of 0 and MaxValue represents a distinct value, and the integer representations are ordered by value the same as the floating-point numbers they represent. Produce a string for testing purposes that is likely to be the same independent of platform and locale. Gets the expression-body syntax from an expression-bodied member. The given syntax must be for a member which could contain an expression-body. <null> <throw expression> <switch expression> local function attributes extern local functions (Location of symbol related to previous error) (Location of symbol related to previous warning) <!-- Badly formed XML comment ignored for member "{0}" --> Badly formed XML file "{0}" cannot be included Failed to insert some or all of included XML Include tag is invalid No matching elements were found for the following include tag Missing file attribute Missing path attribute <missing> <global namespace> generics anonymous methods module as an attribute target specifier namespace alias qualifier fixed size buffers #pragma static classes readonly structs partial types async function switch on boolean type method group anonymous method lambda expression collection disposable access modifiers on properties extern alias iterators default operator async streams unmanaged constructed types readonly members default literal private protected tuple equality nullable types pattern matching expression body property accessor expression body constructor and destructor throw expression implicitly typed array implicitly typed local variable anonymous types automatically implemented properties readonly automatically implemented properties object initializer collection initializer query expression extension method partial method method type namespace field property element variable label event type parameter array pointer function pointer dynamic using alias extern alias constructor foreach iteration variable fixed variable using variable contravariant contravariantly covariant covariantly invariantly dynamic named argument optional parameter exception filter type variance parameter return The character(s) '{0}' cannot be used at this location. Incorrect syntax was used in a comment. An invalid character was found inside an entity reference. Expected '>' or '/>' to close tag '{0}'. An identifier was expected. Invalid unicode character. Whitespace is not allowed at this location. The character '<' cannot be used in an attribute value. Missing equals sign between attribute and attribute value. Reference to undefined entity '{0}'. A string literal was expected, but no opening quotation mark was found. Missing closing quotation mark for string literal. Non-ASCII quotations marks may not be used around string literals. End tag was not expected at this location. End tag '{0}' does not match the start tag '{1}'. Expected an end tag for element '{0}'. Required white space was missing. Unexpected character at this location. The literal string ']]>' is not allowed in element content. Duplicate '{0}' attribute Metadata file '{0}' could not be found Metadata references are not supported. Metadata file '{0}' could not be opened -- {1} The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'. The type '{0}' is defined in a module that has not been added. You must add the module '{1}'. Could not write to output file '{0}' -- '{1}' Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. Operator '{0}' cannot be applied to operands of type '{1}' and '{2}' Operator '{0}' cannot be applied to 'default' and operand of type '{1}' because it is a type parameter that is not known to be a reference type Division by constant zero Cannot apply indexing with [] to an expression of type '{0}' Wrong number of indices inside []; expected {0} Operator '{0}' cannot be applied to operand of type '{1}' Operator '{0}' cannot be applied to operand '{1}' Keyword 'this' is not valid in a static property, static method, or static field initializer Keyword 'this' is not available in the current context Omitting the type argument is not allowed in the current context '{0}' has the wrong signature to be an entry point Method has the wrong signature to be an entry point Cannot implicitly convert type '{0}' to '{1}' Cannot convert type '{0}' to '{1}' Constant value '{0}' cannot be converted to a '{1}' Operator '{0}' is ambiguous on operands of type '{1}' and '{2}' Operator '{0}' is ambiguous on operands '{1}' and '{2}' Operator '{0}' is ambiguous on an operand of type '{1}' An out parameter cannot have the In attribute Cannot convert null to '{0}' because it is a non-nullable value type Cannot convert type '{0}' to '{1}' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Unexpected error writing debug information -- '{0}' Inconsistent accessibility: return type '{1}' is less accessible than method '{0}' Inconsistent accessibility: parameter type '{1}' is less accessible than method '{0}' Inconsistent accessibility: field type '{1}' is less accessible than field '{0}' Inconsistent accessibility: property type '{1}' is less accessible than property '{0}' Inconsistent accessibility: indexer return type '{1}' is less accessible than indexer '{0}' Inconsistent accessibility: parameter type '{1}' is less accessible than indexer '{0}' Inconsistent accessibility: return type '{1}' is less accessible than operator '{0}' Inconsistent accessibility: parameter type '{1}' is less accessible than operator '{0}' Inconsistent accessibility: return type '{1}' is less accessible than delegate '{0}' Inconsistent accessibility: parameter type '{1}' is less accessible than delegate '{0}' Inconsistent accessibility: base class '{1}' is less accessible than class '{0}' Inconsistent accessibility: base interface '{1}' is less accessible than interface '{0}' '{0}': event property must have both add and remove accessors '{0}': abstract event cannot use event accessor syntax '{0}': event must be of a delegate type The event '{0}' is never used Event is never used '{0}': instance event in interface cannot have initializer The event '{0}' can only appear on the left hand side of += or -= (except when used from within the type '{1}') An explicit interface implementation of an event must use event accessor syntax '{0}': cannot override; '{1}' is not an event An add or remove accessor must have a body '{0}': abstract event cannot have initializer The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session The enumerator name '{0}' is reserved and cannot be used The as operator must be used with a reference type or nullable type ('{0}' is a non-nullable value type) The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity The 'l' suffix is easily confused with the digit '1' The event '{0}' can only appear on the left hand side of += or -= Constraints are not allowed on non-generic declarations Type parameter declaration must be an identifier not a type Type '{1}' already reserves a member called '{0}' with the same parameter types The parameter name '{0}' is a duplicate The namespace '{1}' already contains a definition for '{0}' The type '{0}' already contains a definition for '{1}' The name '{0}' does not exist in the current context The name '{0}' does not exist in the current context (are you missing a reference to assembly '{1}'?) '{0}' is an ambiguous reference between '{1}' and '{2}' The using directive for '{0}' appeared previously in this namespace Using directive appeared previously in this namespace The modifier '{0}' is not valid for this item The 'init' accessor is not valid on static members More than one protection modifier '{0}' hides inherited member '{1}'. Use the new keyword if hiding was intended. Member hides inherited member; missing new keyword A variable was declared with the same name as a variable in a base type. However, the new keyword was not used. This warning informs you that you should use new; the variable is declared as if new had been used in the declaration. The member '{0}' does not hide an accessible member. The new keyword is not required. Member does not hide an inherited member; new keyword is not required The evaluation of the constant value for '{0}' involves a circular definition Type '{1}' already defines a member called '{0}' with the same parameter types A static member cannot be marked as '{0}' A member '{0}' marked as override cannot be marked as new or virtual '{0}' hides inherited member '{1}'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. Member hides inherited member; missing override keyword '{0}': no suitable method found to override A namespace cannot directly contain members such as fields, methods or statements '{0}' does not contain a definition for '{1}' '{0}' is a {1} but is used like a {2} '{0}' is a {1}, which is not valid in the given context An object reference is required for the non-static field, method, or property '{0}' The call is ambiguous between the following methods or properties: '{0}' and '{1}' '{0}' is inaccessible due to its protection level No overload for '{0}' matches delegate '{1}' An object of a type convertible to '{0}' is required Since '{0}' returns void, a return keyword must not be followed by an object expression A local variable or function named '{0}' is already defined in this scope The left-hand side of an assignment must be a variable, property or indexer '{0}': a static constructor must be parameterless The expression being assigned to '{0}' must be constant '{0}' is of type '{1}'. A const field of a reference type other than string can only be initialized with null. A local or parameter named '{0}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter A 'using namespace' directive can only be applied to namespaces; '{0}' is a type not a namespace. Consider a 'using static' directive instead A 'using static' directive can only be applied to types; '{0}' is a namespace not a type. Consider a 'using namespace' directive instead A 'using static' directive cannot be used to declare an alias No enclosing loop out of which to break or continue The label '{0}' is a duplicate The type '{0}' has no constructors defined Cannot create an instance of the abstract type or interface '{0}' A const field requires a value to be provided Circular base type dependency involving '{0}' and '{1}' The delegate '{0}' does not have a valid constructor Method name expected A constant value is expected A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type in C# 6 and earlier. A value of an integral type expected The switch statement contains multiple cases with the label value '{0}' A goto case is only valid inside a switch statement The property or indexer '{0}' cannot be used in this context because it lacks the get accessor The type caught or thrown must be derived from System.Exception A throw statement with no arguments is not allowed outside of a catch clause Control cannot leave the body of a finally clause The label '{0}' shadows another label by the same name in a contained scope No such label '{0}' within the scope of the goto statement A previous catch clause already catches all exceptions of this or of a super type ('{0}') Filter expression is a constant 'true', consider removing the filter Filter expression is a constant 'true' '{0}': not all code paths return a value Unreachable code detected Unreachable code detected Control cannot fall through from one case label ('{0}') to another This label has not been referenced This label has not been referenced Use of unassigned local variable '{0}' Use of unassigned local variable '{0}' Use of unassigned local variable The variable '{0}' is declared but never used Variable is declared but never used The field '{0}' is never used Field is never used Use of possibly unassigned field '{0}' Use of possibly unassigned field '{0}' Use of possibly unassigned field Use of possibly unassigned auto-implemented property '{0}' Use of possibly unassigned auto-implemented property '{0}' Use of possibly unassigned auto-implemented property Field '{0}' must be fully assigned before control is returned to the caller. Consider updating to language version '{1}' to auto-default the field. Field '{0}' must be fully assigned before control is returned to the caller. Consider updating to language version '{1}' to auto-default the field. Fields of a struct must be fully assigned in a constructor before control is returned to the caller. Consider updating the language version to auto-default the field. Type of conditional expression cannot be determined because '{0}' and '{1}' implicitly convert to one another Type of conditional expression cannot be determined because there is no implicit conversion between '{0}' and '{1}' A base class is required for a 'base' reference Use of keyword 'base' is not valid in this context Member '{0}' cannot be accessed with an instance reference; qualify it with a type name instead The out parameter '{0}' must be assigned to before control leaves the current method The out parameter '{0}' must be assigned to before control leaves the current method An out parameter must be assigned to before control leaves the method Invalid rank specifier: expected ',' or ']' '{0}' cannot be extern and declare a body '{0}' cannot be extern and have a constructor initializer '{0}' cannot be both extern and abstract Attribute constructor parameter '{0}' has type '{1}', which is not a valid attribute parameter type An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type Attribute constructor parameter '{0}' is optional, but no default parameter value was specified. The given expression is always of the provided ('{0}') type 'is' expression's given expression is always of the provided type The given expression is never of the provided ('{0}') type 'is' expression's given expression is never of the provided type '{0}' is not a reference type as required by the lock statement Use of null is not valid in this context Use of default literal is not valid in this context The 'this' object cannot be used before all of its fields have been assigned. Consider updating to language version '{0}' to auto-default the unassigned fields. The 'this' object cannot be used before all of its fields have been assigned. Consider updating to language version '{0}' to auto-default the unassigned fields. The 'this' object cannot be used in a constructor before all of its fields have been assigned. Consider updating the language version to auto-default the unassigned fields. The __arglist construct is valid only within a variable argument method The * or -> operator must be applied to a pointer A pointer must be indexed by only one value Using '{0}' as a ref or out value or taking its address may cause a runtime exception because it is a field of a marshal-by-reference class Using a field of a marshal-by-reference class as a ref or out value or taking its address may cause a runtime exception A static readonly field cannot be assigned to (except in a static constructor or a variable initializer) A static readonly field cannot be used as a ref or out value (except in a static constructor) Property or indexer '{0}' cannot be assigned to -- it is read only Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement foreach requires that the return type '{0}' of '{1}' must have a suitable public 'MoveNext' method and public 'Current' property Asynchronous foreach requires that the return type '{0}' of '{1}' must have a suitable public 'MoveNextAsync' method and public 'Current' property Only 65534 locals, including those generated by the compiler, are allowed Cannot call an abstract base member: '{0}' A non ref-returning property or indexer may not be used as an out or ref value Cannot take the address of, get the size of, or declare a pointer to a managed type ('{0}') This takes the address of, gets the size of, or declares a pointer to a managed type ('{0}') This takes the address of, gets the size of, or declares a pointer to a managed type The type of a local declared in a fixed statement must be a pointer type You must provide an initializer in a fixed or using statement declaration Cannot take the address of the given expression You can only take the address of an unfixed expression inside of a fixed statement initializer You cannot use the fixed statement to take the address of an already fixed expression The given expression cannot be used in a fixed statement Pointers and fixed size buffers may only be used in an unsafe context The return type of operator True or False must be bool The operator '{0}' requires a matching operator '{1}' to also be defined In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type and parameter types In order for '{0}' to be applicable as a short circuit operator, its declaring type '{1}' must define operator true and operator false The variable '{0}' is assigned but its value is never used Variable is assigned but its value is never used The operation overflows at compile time in checked mode Constant value '{0}' cannot be converted to a '{1}' (use 'unchecked' syntax to override) A method with vararg cannot be generic, be in a generic type, or have a params parameter The params parameter must have a valid collection type An __arglist expression may only appear inside of a call or new expression Unsafe code may only appear if compiling with /unsafe Ambiguity between '{0}' and '{1}' Type and identifier are both required in a foreach statement A params parameter must be the last parameter in a parameter list '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context The type or namespace name '{0}' does not exist in the namespace '{1}' (are you missing an assembly reference?) A field initializer cannot reference the non-static field, method, or property '{0}' '{0}' cannot be sealed because it is not an override '{0}': cannot override inherited member '{1}' because it is sealed The operation in question is undefined on void pointers The Conditional attribute is not valid on '{0}' because it is an override method Local function '{0}' must be 'static' in order to use the Conditional attribute Neither 'is' nor 'as' is valid on pointer types Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. The type or namespace name '{0}' could not be found (are you missing a using directive or an assembly reference?) Cannot use a negative size with stackalloc Cannot create an array with a negative size Do not override object.Finalize. Instead, provide a destructor. Do not directly call your base type Finalize method. It is called automatically from your destructor. Indexing an array with a negative index (array indices always start at zero) Indexing an array with a negative index Possible unintended reference comparison; to get a value comparison, cast the left hand side to type '{0}' Possible unintended reference comparison; left hand side needs cast Possible unintended reference comparison; to get a value comparison, cast the right hand side to type '{0}' Possible unintended reference comparison; right hand side needs cast The right hand side of a fixed statement assignment may not be a cast expression stackalloc may not be used in a catch or finally block An __arglist parameter must be the last parameter in a parameter list Missing partial modifier on declaration of type '{0}'; another partial declaration of this type exists Partial declarations of '{0}' must be all classes, all record classes, all structs, all record structs, or all interfaces Partial declarations of '{0}' have conflicting accessibility modifiers Partial declarations of '{0}' must not specify different base classes Partial declarations of '{0}' must have the same type parameter names in the same order Partial declarations of '{0}' have inconsistent constraints for type parameter '{1}' Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) The 'partial' modifier can only appear immediately before 'class', 'record', 'struct', 'interface', or a method or property return type. Imported type '{0}' is invalid. It contains a circular base type dependency. Use of unassigned out parameter '{0}' Use of unassigned out parameter '{0}' Use of unassigned out parameter Array size cannot be specified in a variable declaration (try initializing with a 'new' expression) The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible The accessibility modifier of the '{0}' accessor must be more restrictive than the property or indexer '{1}' Cannot specify accessibility modifiers for both accessors of the property or indexer '{0}' '{0}': accessibility modifiers on accessors may only be used if the property or indexer has both a get and a set accessor '{0}' does not implement interface member '{1}'. '{2}' is not public. '{0}' does not implement the '{1}' pattern. '{2}' is ambiguous with '{3}'. Type does not implement the collection pattern; members are ambiguous '{0}' does not implement the '{1}' pattern. '{2}' is not a public instance or extension method. Type does not implement the collection pattern; member is is not a public instance or extension method. '{0}' does not implement the '{1}' pattern. '{2}' has the wrong signature. Type does not implement the collection pattern; member has the wrong signature Friend access was granted by '{0}', but the public key of the output assembly ('{1}') does not match that specified by the InternalsVisibleTo attribute in the granting assembly. Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly. There is no defined ordering between fields in multiple declarations of partial struct '{0}'. To specify an ordering, all instance fields must be in the same declaration. There is no defined ordering between fields in multiple declarations of partial struct The type '{0}' cannot be declared const Cannot create an instance of the variable type '{0}' because it does not have the new() constraint Using the generic {1} '{0}' requires {2} type arguments The type '{0}' may not be used as a type argument The {1} '{0}' cannot be used with type arguments The non-generic {1} '{0}' cannot be used with type arguments '{2}' must be a non-abstract type with a public parameterless constructor in order to use it as parameter '{1}' in the generic type or method '{0}' The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no implicit reference conversion from '{3}' to '{1}'. The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. The parameter name '{0}' conflicts with an automatically-generated parameter name The type or namespace name '{0}' could not be found in the global namespace (are you missing an assembly reference?) The new() constraint must be the last restrictive constraint specified '{0}': an entry point cannot be generic or in a generic type An entry point cannot be generic or in a generic type Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. Duplicate constraint '{0}' for type parameter '{1}' The class type constraint '{0}' must come before any other constraints '{1} {0}' has the wrong return type Ref mismatch between '{0}' and delegate '{1}' A constraint clause has already been specified for type parameter '{0}'. All of the constraints for a type parameter must be specified in a single where clause. The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. '{0}': a parameter, local variable, or local function cannot have the same name as a method type parameter The type parameter '{0}' cannot be used with the 'as' operator because it does not have a class type constraint nor a 'class' constraint The field '{0}' is assigned but its value is never used Field is assigned but its value is never used The '{0}' attribute is valid only on an indexer that is not an explicit interface member declaration '{0}': an attribute argument cannot use type parameters '{0}': an attribute type argument cannot use type parameters Type '{0}' cannot be used in this context because it cannot be represented in metadata. Type cannot be used in this context because it cannot be represented in metadata. Type '{0}' cannot be used in this context because it cannot be represented in metadata. '{0}': cannot provide arguments when creating an instance of a variable type '{0}': an abstract type cannot be sealed or static Ambiguous reference in cref attribute: '{0}'. Assuming '{1}', but could have also matched other overloads including '{2}'. Ambiguous reference in cref attribute '{0}': a reference to a volatile field will not be treated as volatile A reference to a volatile field will not be treated as volatile A volatile field should not normally be used as a ref or out value, since it will not be treated as volatile. There are exceptions to this, such as when calling an interlocked API. Since '{1}' has the ComImport attribute, '{0}' must be extern or abstract '{0}': a class with the ComImport attribute cannot specify a base class The constraints for type parameter '{0}' of method '{1}' must match the constraints for type parameter '{2}' of interface method '{3}'. Consider using an explicit interface implementation instead. The tuple element names in the signature of method '{0}' must match the tuple element names of interface method '{1}' (including on the return type). The type name '{0}' does not exist in the type '{1}' Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? Converting method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? Converting method group to non-delegate type The extern alias '{0}' was not specified in a /reference option Cannot use alias '{0}' with '::' since the alias references a type. Use '.' instead. Alias '{0}' not found The type '{1}' exists in both '{0}' and '{2}' The namespace '{1}' in '{0}' conflicts with the type '{3}' in '{2}' The namespace '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the namespace defined in '{0}'. Namespace conflicts with imported type The type '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the type defined in '{0}'. Type conflicts with imported type The type '{1}' in '{0}' conflicts with the imported namespace '{3}' in '{2}'. Using the type defined in '{0}'. Type conflicts with imported namespace The type '{1}' in '{0}' conflicts with the namespace '{3}' in '{2}' An extern alias declaration must precede all other elements defined in the namespace Defining an alias named 'global' is ill-advised since 'global::' always references the global namespace and not an alias Defining an alias named 'global' is ill-advised '{0}': a type cannot be both static and sealed '{0}': abstract properties cannot have private accessors Syntax error; value expected Cannot modify the result of an unboxing conversion Foreach cannot operate on a '{0}'. Did you intend to invoke the '{0}'? The return type for ++ or -- operator must match the parameter type or be derived from the parameter type The 'class', 'struct', 'unmanaged', 'notnull', and 'default' constraints cannot be combined or duplicated, and must be specified first in the constraints list. '{0}': cannot specify both a constraint class and the 'class' or 'struct' constraint '{0}': cannot specify both a constraint class and the 'unmanaged' constraint The 'new()' constraint cannot be used with the 'struct' constraint The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' The type '{2}' must be a non-nullable value type in order to use it as parameter '{1}' in the generic type or method '{0}' Circular constraint dependency involving '{0}' and '{1}' Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}' Type parameter '{1}' has the 'struct' constraint so '{1}' cannot be used as a constraint for '{0}' Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' The result of the expression is always 'null' of type '{0}' The result of the expression is always 'null' Cannot return 'this' by reference. Cannot use attribute constructor '{0}' because it has 'in' or 'ref readonly' parameters. Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly, except for either a 'class', or a 'struct' constraint. The inherited members '{0}' and '{1}' have the same signature in type '{2}', so they cannot be overridden Evaluation of the decimal constant expression failed Comparing with null of type '{0}' always produces 'false' Comparing with null of struct type always produces 'false' Introducing a 'Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor? Introducing a 'Finalize' method can interfere with destructor invocation This warning occurs when you create a class with a method whose signature is public virtual void Finalize. If such a class is used as a base class and if the deriving class defines a destructor, the destructor will override the base class Finalize method, ... '{0}' should not have a params parameter since '{1}' does not The 'goto case' value is not implicitly convertible to type '{0}' The 'goto case' value is not implicitly convertible to the switch type Method '{0}' cannot implement interface accessor '{1}' for type '{2}'. Use an explicit interface implementation. The result of the expression is always '{0}' since a value of type '{1}' is never equal to 'null' of type '{2}' The result of the expression is always the same since a value of this type is never equal to 'null' The result of the expression is always '{0}' since a value of type '{1}' is never equal to 'null' of type '{2}' The result of the expression is always the same since a value of this type is never equal to 'null' Explicit interface implementation '{0}' matches more than one interface member. Which interface member is actually chosen is implementation-dependent. Consider using a non-explicit implementation instead. Explicit interface implementation matches more than one interface member '{0}' cannot declare a body because it is marked abstract '{0}' must declare a body because it is not marked abstract, extern, or partial '{0}' cannot be both abstract and sealed The abstract {0} '{1}' cannot be marked virtual The constant '{0}' cannot be marked static '{0}': cannot override because '{1}' is not a function '{0}': cannot override inherited member '{1}' because it is not marked virtual, abstract, or override '{0}': cannot change access modifiers when overriding '{1}' inherited member '{2}' '{0}': cannot change tuple element names when overriding inherited member '{1}' '{0}': return type must be '{2}' to match overridden member '{1}' '{0}': cannot derive from sealed type '{1}' '{0}' is abstract but it is contained in non-abstract type '{1}' '{0}': static constructor cannot have an explicit 'this' or 'base' constructor call '{0}': access modifiers are not allowed on static constructors Constructor '{0}' cannot call itself Constructor '{0}' cannot call itself through another constructor '{0}' has no base class and cannot call a base constructor Predefined type '{0}' is not defined or imported Predefined type '{0}' is not defined or imported Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}' '{0}': structs cannot call base class constructors Struct member '{0}' of type '{1}' causes a cycle in the struct layout Interfaces cannot contain instance fields Interfaces cannot contain instance constructors Type '{0}' in interface list is not an interface '{0}' is already listed in interface list '{0}' is already listed in the interface list on type '{2}' with different tuple element names, as '{1}'. '{0}' is already listed in the interface list on type '{2}' as '{1}'. Inherited interface '{1}' causes a cycle in the interface hierarchy of '{0}' '{0}' hides inherited abstract member '{1}' '{0}' does not implement inherited abstract member '{1}' '{0}' does not implement interface member '{1}' The class System.Object cannot have a base class or implement an interface '{0}' in explicit interface declaration is not an interface '{0}' in explicit interface declaration is not found among members of the interface that can be implemented '{0}': containing type does not implement interface '{1}' '{0}': explicit interface declaration can only be declared in a class, record, struct or interface '{0}': member names cannot be the same as their enclosing type '{0}': the enumerator value is too large to fit in its type '{0}': cannot override because '{1}' is not a property '{0}': cannot override because '{1}' does not have an overridable get accessor '{0}': cannot override because '{1}' does not have an overridable set accessor '{0}': property or indexer cannot have void type '{0}': property or indexer must have at least one accessor __arglist cannot have an argument of void type '{0}' is a new virtual member in sealed type '{1}' '{0}' adds an accessor not found in interface member '{1}' Accessors '{0}' and '{1}' should both be init-only or neither Explicit interface implementation '{0}' is missing accessor '{1}' '{0}': user-defined conversions to or from an interface are not allowed '{0}': user-defined conversions to or from a base type are not allowed '{0}': user-defined conversions to or from a derived type are not allowed User-defined operator cannot convert a type to itself User-defined conversion must convert to or from the enclosing type Duplicate user-defined conversion in type '{0}' User-defined operator '{0}' must be declared static and public The parameter type for ++ or -- operator must be the containing type The parameter of a unary operator must be the containing type One of the parameters of a binary operator must be the containing type The first operand of an overloaded shift operator must have the same type as the containing type Conversion, equality, or inequality operators declared in interfaces must be abstract or virtual Enums cannot contain explicit parameterless constructors '{0}': cannot override '{1}' because it is not supported by the language '{0}' is not supported by the language '{0}': cannot explicitly call operator or accessor '{0}': cannot reference a type through an expression; try '{1}' instead Name of destructor must match name of type Only class types can contain destructors Namespace '{1}' contains a definition conflicting with alias '{0}' Alias '{0}' conflicts with {1} definition The Conditional attribute is not valid on '{0}' because it is a constructor, destructor, operator, lambda expression, or explicit interface implementation The Conditional attribute is not valid on '{0}' because its return type is not void Duplicate '{0}' attribute Duplicate '{0}' attribute in '{1}' The Conditional attribute is not valid on interface members User-defined operators cannot return void '{0}': user-defined conversions to or from the dynamic type are not allowed Invalid value for argument to '{0}' attribute Parameter not valid for the specified unmanaged type. Attribute parameter '{0}' must be specified. Attribute parameter '{0}' or '{1}' must be specified. Unmanaged type '{0}' not valid for fields. Unmanaged type '{0}' is only valid for fields. Attribute '{0}' is not valid on this declaration type. It is only valid on '{1}' declarations. Floating-point constant is outside the range of type '{0}' The Guid attribute must be specified with the ComImport attribute Invalid value for named attribute argument '{0}' The DllImport attribute must be specified on a method marked 'static' and 'extern' Cannot update '{0}'; attribute '{1}' is missing. The DllImport attribute cannot be applied to a method that is generic or contained in a generic method or type. Field or property cannot be of type '{0}' Field or auto-implemented property cannot be of type '{0}' unless it is an instance member of a ref struct. Array elements cannot be of type '{0}' '{0}' is obsolete Type or member is obsolete '{0}' is not an attribute class '{0}' is not a valid named attribute argument. Named attribute arguments must be fields which are not readonly, static, or const, or read-write properties which are public and not static. '{0}' is obsolete: '{1}' Type or member is obsolete '{0}' is obsolete: '{1}' Indexers cannot have void type '{0}': virtual or abstract members cannot be private Can only use array initializer expressions to assign to array types. Try using a new expression instead. Array initializers can only be used in a variable or field initializer. Try using a new expression instead. '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute Method, operator, or accessor '{0}' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation. Method, operator, or accessor is marked external and has no attributes on it '{0}': new protected member declared in sealed type New protected member declared in sealed type Conditional member '{0}' cannot implement interface member '{1}' in type '{2}' '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter ref and out are not valid in this context The argument to the '{0}' attribute must be a valid identifier The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit) The FieldOffset attribute is not allowed on static or const fields Attribute '{0}' is only valid on classes derived from System.Attribute Possible mistaken empty statement Possible mistaken empty statement '{0}' duplicate named attribute argument '{0}' cannot derive from special class '{1}' Cannot specify the DefaultMember attribute on a type containing an indexer '{0}' is a type not supported by the language Field '{0}' is never assigned to, and will always have its default value {1} Field is never assigned to, and will always have its default value Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type. Comparison to integral constant is useless; the constant is outside the range of type '{0}' Comparison to integral constant is useless; the constant is outside the range of the type Cannot apply attribute class '{0}' because it is abstract '{0}' is not a valid named attribute argument because it is not a valid attribute parameter type Missing compiler required member '{0}.{1}' '{0}' is not a valid attribute location for this declaration. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored. Not a valid attribute location for this declaration '{0}' is not a recognized attribute location. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored. Not a recognized attribute location '{0}' overrides Object.Equals(object o) but does not override Object.GetHashCode() Type overrides Object.Equals(object o) but does not override Object.GetHashCode() '{0}' defines operator == or operator != but does not override Object.Equals(object o) Type defines operator == or operator != but does not override Object.Equals(object o) '{0}' defines operator == or operator != but does not override Object.GetHashCode() Type defines operator == or operator != but does not override Object.GetHashCode() Cannot specify the Out attribute on a ref parameter without also specifying the In attribute. '{0}' cannot define an overloaded {1} that differs only on parameter modifiers '{2}' and '{3}' Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type Assignment in conditional expression is always constant; did you mean to use == instead of = ? Assignment in conditional expression is always constant '{0}': new protected member declared in struct Two indexers have different names; the IndexerName attribute must be used with the same name on every indexer within a type A class with the ComImport attribute cannot have a user-defined constructor Field cannot have void type Member '{0}' overrides obsolete member '{1}'. Add the Obsolete attribute to '{0}'. Member overrides obsolete member System.Void cannot be used from C# -- use typeof(void) to get the void type object Do not use 'System.ParamArrayAttribute'/'System.Runtime.CompilerServices.ParamCollectionAttribute'. Use the 'params' keyword instead. Bitwise-or operator used on a sign-extended operand; consider casting to a smaller unsigned type first Bitwise-or operator used on a sign-extended operand The compiler implicitly widened and sign-extended a variable, and then used the resulting value in a bitwise OR operation. This can result in unexpected behavior. '{0}': a volatile field cannot be of the type '{1}' '{0}': a field cannot be both volatile and readonly The modifier 'abstract' is not valid on fields. Try using a property instead. '{0}' cannot implement '{1}' because it is not supported by the language '{0}' explicit method implementation cannot implement '{1}' because it is an accessor '{0}' interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute' Interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute' Conditional member '{0}' cannot have an out parameter Accessor '{0}' cannot implement interface member '{1}' for type '{2}'. Use an explicit interface implementation. The namespace alias qualifier '::' always resolves to a type or namespace so is illegal here. Consider using '.' instead. Cannot derive from '{0}' because it is a type parameter Duplicate type parameter '{0}' Type parameter '{0}' has the same name as the type parameter from outer type '{1}' Type parameter has the same name as the type parameter from outer type Type parameter '{0}' has the same name as the type parameter from outer method '{1}' Type parameter has the same type as the type parameter from outer method. Type parameter '{0}' has the same name as the containing type, or method '{0}' cannot implement both '{1}' and '{2}' because they may unify for some type parameter substitutions '{1}' does not define type parameter '{0}' '{0}' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter. Constraint cannot be special class '{0}' Inconsistent accessibility: constraint type '{1}' is less accessible than '{0}' Cannot do non-virtual member lookup in '{0}' because it is a type parameter Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter. '{0}': cannot declare instance members in a static class '{1}': cannot derive from static class '{0}' Static classes cannot have instance constructors Static classes cannot contain destructors Cannot create an instance of the static class '{0}' Static class '{0}' cannot derive from type '{1}'. Static classes must derive from object. '{0}': static classes cannot implement interfaces '{0}': static classes cannot contain user-defined operators Cannot convert to static type '{0}' '{0}': static classes cannot be used as constraints '{0}': static types cannot be used as type arguments '{0}': array elements cannot be of static type '{0}': cannot declare indexers in a static class '{0}': static types cannot be used as parameters '{0}': static types cannot be used as parameters Static types cannot be used as parameters '{0}': static types cannot be used as return types '{0}': static types cannot be used as return types Static types cannot be used as return types Cannot declare a variable of static type '{0}' A throw statement with no arguments is not allowed in a finally clause that is nested inside the nearest enclosing catch clause '{0}' is not a valid format specifier Possibly incorrect assignment to local '{0}' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the original value of the local. Possibly incorrect assignment to local which is the argument to a using or lock statement Type '{0}' is defined in this assembly, but a type forwarder is specified for it Cannot forward type '{0}' because it is a nested type of '{1}' The type forwarder for type '{0}' in assembly '{1}' causes a cycle The /moduleassemblyname option may only be specified when building a target type of 'module' Assembly reference '{0}' is invalid and cannot be resolved Invalid type specified as an argument for TypeForwardedTo attribute '{0}' does not implement instance interface member '{1}'. '{2}' cannot implement the interface member because it is static. '{0}' does not implement interface member '{1}'. '{2}' cannot implement an interface member because it is not public. '{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}' because it does not have the matching return type of '{3}'. '{0}' duplicate TypeForwardedToAttribute A query body must end with a select clause or a group clause Expected contextual keyword 'on' Expected contextual keyword 'equals' Expected contextual keyword 'by' Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access. Invalid initializer member declarator Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit A partial member cannot have the 'abstract' modifier A partial member must be declared within a partial type A partial member may not explicitly implement an interface member Both partial method declarations must be extension methods or neither may be an extension method A partial method may not have multiple defining declarations A partial method may not have multiple implementing declarations Both partial member declarations must use a params parameter or neither may use a params parameter No defining declaration found for implementing declaration of partial method '{0}' Both partial member declarations, '{0}' and '{1}', must use the same tuple element names. Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}' Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration Both partial member declarations must be static or neither may be static Both partial member declarations must be unsafe or neither may be unsafe Partial methods with only a defining declaration or removed conditional methods cannot be used in expression trees Obsolete member '{0}' overrides non-obsolete member '{1}' Obsolete member overrides non-obsolete member The fully qualified name for '{0}' is too long for debug information. Compile without '/debug' option. Fully qualified name is too long for debug information Cannot assign {0} to an implicitly-typed variable Implicitly-typed variables must be initialized Implicitly-typed variables cannot have multiple declarators Cannot initialize an implicitly-typed variable with an array initializer Implicitly-typed local variables cannot be fixed Implicitly-typed variables cannot be constant Constructor '{0}' is marked external Constructor is marked external The contextual keyword 'var' may only appear within a local variable declaration or in script code No best type found for implicitly-typed array Cannot assign '{0}' to anonymous type property An expression tree may not contain a base access An expression tree may not contain a tuple == or != operator An expression tree may not contain an assignment operator An anonymous type cannot have multiple properties with the same name A lambda expression with a statement body cannot be converted to an expression tree Cannot convert lambda to an expression tree whose type argument '{0}' is not a delegate type Cannot use anonymous type in a constant expression The first operand of an 'is' or 'as' operator may not be a lambda expression, anonymous method, or method group. The first operand of an 'as' operator may not be a tuple literal without a natural type. An expression tree may not contain a multidimensional array initializer Argument missing Cannot use local variable '{0}' before it is declared Type of '{0}' cannot be inferred since its initializer directly or indirectly refers to the definition. Auto-implemented property '{0}' must be fully assigned before control is returned to the caller. Consider updating to language version '{1}' to auto-default the property. Auto-implemented property '{0}' must be fully assigned before control is returned to the caller. Consider updating to language version '{1}' to auto-default the property. An auto-implemented property must be fully assigned before control is returned to the caller. Consider updating the language version to auto-default the property. Cannot use local variable '{0}' before it is declared. The declaration of the local variable hides the field '{1}'. An expression tree lambda may not contain a coalescing operator with a null or default literal left-hand side Identifier expected ; expected Syntax error, '{0}' expected Duplicate '{0}' modifier Property accessor already defined Type byte, sbyte, short, ushort, int, uint, long, or ulong expected Unrecognized escape sequence Newline in constant Empty character literal Too many characters in character literal Invalid number A get or set accessor expected An object, string, or class type expected Named attribute argument expected Catch clauses cannot follow the general catch clause of a try statement Keyword 'this' or 'base' expected Overloadable unary operator expected Overloadable binary operator expected Integral constant is too large Type or namespace definition, or end-of-file expected Member definition, statement, or end-of-file expected Embedded statement cannot be a declaration or labeled statement Preprocessor directive expected Single-line comment or end-of-line expected ) expected #endif directive expected Unexpected preprocessor directive #error: '{0}' #warning: '{0}' #warning directive Type expected Cannot define/undefine preprocessor symbols after first token in file Cannot use #r after first token in file End-of-file found, '*/' expected Merge conflict marker encountered Do not use refout when using refonly. Cannot compile net modules when using /refout or /refonly. Overloadable operator expected #endregion directive expected Unterminated string literal Preprocessor directives must appear as the first non-whitespace character on a line Identifier expected; '{1}' is a keyword { or ; expected Cannot use more than one type in a for, using, fixed, or declaration statement An add or remove accessor expected Unexpected character '{0}' Unexpected token '{0}' '{0}': static classes cannot contain protected members A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException. A previous catch clause already catches all exceptions This warning is caused when a catch() block has no specified exception type after a catch (System.Exception e) block. The warning advises that the catch() block will not catch any exceptions. A catch() block after a catch (System.Exception e) block can ca ... The operand of an increment or decrement operator must be a variable, property or indexer '{0}' does not contain a definition for '{1}' and no accessible extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive for '{2}'?) Method '{0}' has a parameter modifier 'this' which is not on the first parameter The parameter modifier '{0}' cannot be used with '{1}' The first parameter of an extension method cannot be of type '{0}' A parameter array cannot be used with 'this' modifier on an extension method Extension method must be static Extension method must be defined in a non-generic static class A parameter can only have one '{0}' modifier Extension methods must be defined in a top level static class; {0} is a nested class Cannot define a new extension method because the compiler required type '{0}' cannot be found. Are you missing a reference to System.Core.dll? Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use the 'this' keyword instead. Do not use 'System.Runtime.CompilerServices.DynamicAttribute'. Use the 'dynamic' keyword instead. The constructor call needs to be dynamically dispatched, but cannot be because it is part of a constructor initializer. Consider casting the dynamic arguments. Extension method '{0}' defined on value type '{1}' cannot be used to create delegates No overload for method '{0}' takes {1} arguments Argument {0}: cannot convert from '{1}' to '{2}' Source file '{0}' could not be opened -- {1} Cannot link resource files when building a module Resource identifier '{0}' has already been used in this assembly Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly The referenced file '{0}' is not an assembly A ref or out value must be an assignable variable Keyword 'base' is not available in a static method Keyword 'base' is not available in the current context } expected { expected 'in' expected Invalid preprocessor expression Invalid token '{0}' in class, record, struct, or interface member declaration Method must have a return type Invalid base type Empty switch block Empty switch block Expected catch or finally Invalid expression term '{0}' A new expression requires an argument list or (), [], or {} after type Elements defined in a namespace cannot be explicitly declared as private, protected, protected internal, or private protected Expected ; or = (cannot specify constructor arguments in declaration) A using clause must precede all other elements defined in the namespace except extern alias declarations Overloaded binary operator '{0}' takes two parameters Overloaded unary operator '{0}' takes one parameter Invalid parameter type 'void' The using alias '{0}' appeared previously in this namespace Cannot access protected member '{0}' via a qualifier of type '{1}'; the qualifier must be of type '{2}' (or derived from it) '{0}' cannot be added to this assembly because it already is an assembly Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor methods '{1}' or '{2}' Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor method '{1}' Keyword 'void' cannot be used in this context Indexers must have at least one parameter Array type specifier, [], must appear before parameter name Declaration is not valid; use '{0} operator <dest-type> (...' instead Could not find '{0}' specified for Main method '{0}' specified for Main method must be a non-generic class, record, struct, or interface '{0}' does not have a suitable static 'Main' method Cannot use '{0}' for Main method because it is imported Outputs without source must have the /out option specified Output directory could not be determined Conflicting options specified: Win32 resource file; Win32 manifest Conflicting options specified: Win32 resource file; Win32 icon Error reading resource '{0}' -- '{1}' Error writing to XML documentation file: {0} XML comment has badly formed XML -- '{0}' XML comment has badly formed XML XML comment has a duplicate param tag for '{0}' XML comment has a duplicate param tag XML comment has a param tag for '{0}', but there is no parameter by that name XML comment has a param tag, but there is no parameter by that name XML comment on '{1}' has a paramref tag for '{0}', but there is no parameter by that name XML comment has a paramref tag, but there is no parameter by that name Parameter '{0}' has no matching param tag in the XML comment for '{1}' (but other parameters do) Parameter has no matching param tag in the XML comment (but other parameters do) XML comment has cref attribute '{0}' that could not be resolved XML comment has cref attribute that could not be resolved A stackalloc expression requires [] after type The line number specified for #line directive is missing or invalid Quoted file name, single-line comment or end-of-line expected Quoted file name expected #r is only allowed in scripts foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}' Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance or extension definition for '{1}' foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'. Did you mean 'await foreach' rather than 'foreach'? Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'. Did you mean 'foreach' rather than 'await foreach'? Spread operator '..' cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}' The body of an async-iterator method must contain a 'yield' statement. The body of an async-iterator method must contain a 'yield' statement. Consider removing 'async' from the method declaration or adding a 'yield' statement. A static local function cannot contain a reference to '{0}'. A static local function cannot contain a reference to 'this' or 'base'. Invalid type for parameter {0} in XML comment cref attribute: '{1}' Invalid type for parameter in XML comment cref attribute Invalid return type in XML comment cref attribute Invalid return type in XML comment cref attribute Error reading Win32 resources -- {0} XML comment has syntactically incorrect cref attribute '{0}' XML comment has syntactically incorrect cref attribute Member modifier '{0}' must precede the member type and name Array creation must have array size or array initializer XML comment is not placed on a valid language element XML comment is not placed on a valid language element Unable to include XML fragment '{1}' of file '{0}' -- {2} Unable to include XML fragment Invalid XML include element -- {0} Invalid XML include element Missing XML comment for publicly visible type or member '{0}' Missing XML comment for publicly visible type or member The /doc compiler option was specified, but one or more constructs did not have comments. Badly formed XML in included comments file -- '{0}' Badly formed XML in included comments file Delegate '{0}' does not take {1} arguments Semicolon after method or accessor block is not valid The return type of a method, delegate, or function pointer cannot be '{0}' Compilation cancelled by user Cannot make reference to variable of type '{0}' Cannot assign to '{0}' because it is read-only Cannot use '{0}' as a ref or out value because it is read-only The RequiredAttribute attribute is not permitted on C# types Modifiers cannot be placed on event accessor declarations The params parameter cannot be declared as {0} Cannot modify the return value of '{0}' because it is not a variable The managed coclass wrapper class '{0}' for interface '{1}' cannot be found (are you missing an assembly reference?) '{0}' is ambiguous between '{1}' and '{2}'. Either use '@{0}' or explicitly include the 'Attribute' suffix. Argument {0} may not be passed with the '{1}' keyword Argument {0} may not be passed with the 'ref' keyword in language version {1}. To pass 'ref' arguments to 'in' parameters, upgrade to language version {2} or greater. Option '{0}' overrides attribute '{1}' given in a source file or added module Option overrides attribute given in a source file or added module This warning occurs if the assembly attributes AssemblyKeyFileAttribute or AssemblyKeyNameAttribute found in source conflict with the /keyfile or /keycontainer command line option or key file name or key container specified in the Project Properties. Invalid option '{0}' for /langversion. Use '/langversion:?' to list supported values. Cannot create delegate with '{0}' because it or a method it overrides has a Conditional attribute Cannot create temporary file -- {0} Argument {0} must be passed with the '{1}' keyword The 'ref' modifier for argument {0} corresponding to 'in' parameter is equivalent to 'in'. Consider using 'in' instead. The 'ref' modifier for an argument corresponding to 'in' parameter is equivalent to 'in'. Consider using 'in' instead. Argument {0} should be passed with 'ref' or 'in' keyword Argument should be passed with 'ref' or 'in' keyword Argument {0} should be passed with the 'in' keyword Argument should be passed with the 'in' keyword Argument {0} should be a variable because it is passed to a 'ref readonly' parameter Argument should be a variable because it is passed to a 'ref readonly' parameter The yield statement cannot be used inside an anonymous method or lambda expression Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration. Iterators cannot have ref, in or out parameters The body of '{0}' cannot be an iterator block because '{1}' is not an iterator interface type Cannot yield in the body of a finally clause Method '{0}' with an iterator block must be 'async' to return '{1}' Cannot yield a value in the body of a try block with a catch clause Expression expected after yield return Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function Cannot yield a value in the body of a catch clause Control cannot leave the body of an anonymous method or lambda expression The suppression operator is not allowed in this context Unrecognized #pragma directive Unrecognized #pragma directive Expected 'disable' or 'restore' Expected 'disable' or 'restore' after #pragma warning Cannot restore warning 'CS{0}' because it was disabled globally Cannot restore warning because it was disabled globally __arglist is not allowed in the parameter list of iterators Iterators cannot have pointer type parameters The managed coclass wrapper class signature '{0}' for interface '{1}' is not a valid class name signature foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation Asynchronous foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation A fixed size buffer field must have the array size specifier after the field name Fixed size buffer fields may only be members of structs Not all code paths return a value in {0} of type '{1}' Feature '{0}' is not part of the standardized ISO C# language specification, and may not be accepted by other compilers Feature is not part of the standardized ISO C# language specification, and may not be accepted by other compilers Keyword, identifier, or string expected after verbatim specifier: @ A readonly field cannot be used as a ref or out value (except in a constructor) Members of readonly field '{0}' cannot be used as a ref or out value (except in a constructor) A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer) Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) Cannot use {0} '{1}' as a ref or out value because it is a readonly variable Members of {0} '{1}' cannot be used as a ref or out value because it is a readonly variable Cannot assign to {0} '{1}' or use it as the right hand side of a ref assignment because it is a readonly variable Cannot assign to a member of {0} '{1}' or use it as the right hand side of a ref assignment because it is a readonly variable Cannot return {0} '{1}' by writable reference because it is a readonly variable Members of {0} '{1}' cannot be returned by writable reference because it is a readonly variable Fields of static readonly field '{0}' cannot be assigned to (except in a static constructor or a variable initializer) Fields of static readonly field '{0}' cannot be used as a ref or out value (except in a static constructor) Cannot modify members of '{0}' because it is a '{1}' Cannot use fields of '{0}' as a ref or out value because it is a '{1}' Cannot assign to '{0}' because it is a '{1}' Cannot use '{0}' as a ref or out value because it is a '{1}' {0}. See also error CS{1}. Warning is overriding an error The compiler emits this warning when it overrides an error with a warning. For information about the problem, search for the error code mentioned. Cannot convert {0} to type '{1}' because it is not a delegate type Cannot convert {0} to type '{1}' because the parameter types do not match the delegate parameter types Cannot convert {0} to type '{1}' because the return type does not match the delegate return type Cannot convert {0} to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type Since this is an async method, the return expression must be of type '{0}' rather than '{1}' Cannot convert async {0} to delegate type '{1}'. An async {0} may return void, Task or Task<T>, none of which are convertible to '{1}'. Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double Fixed size buffer of length {0} and type '{1}' is too big Fixed size buffers must have a length greater than zero You cannot use fixed size buffers contained in unfixed expressions. Try using the fixed statement. Attribute '{0}' is not valid on property or event accessors. It is only valid on '{1}' declarations. Invalid search path '{0}' specified in '{1}' -- '{2}' Invalid search path specified __arglist is not valid in this context params is not valid in this context A namespace declaration cannot have modifiers or attributes Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 Anonymous methods, lambda expressions, query expressions, and local functions inside structs cannot access instance members of 'this'. Consider copying 'this' to a local variable outside the anonymous method, lambda expression, query expression, or local f ... '{0}': type used in a using statement must implement 'System.IDisposable'. '{0}': type used in a using statement must implement 'System.IDisposable'. Did you mean 'await using' rather than 'using'? '{0}': type used in an asynchronous using statement must implement 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method. '{0}': type used in an asynchronous using statement must implement 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method. Did you mean 'using' rather than 'await using'? Parameter {0} must be declared with the '{1}' keyword Parameter {0} should not be declared with the '{1}' keyword Parameter {0} is declared as type '{1}{2}' but should be '{3}{4}' Invalid extern alias for '/reference'; '{0}' is not a valid identifier Invalid reference alias option: '{0}=' -- missing filename You cannot redefine the global extern alias Reference to type '{0}' claims it is defined in this assembly, but it is not defined in source or any added modules Reference to type '{0}' claims it is defined in '{1}', but it could not be found The predefined type '{0}' is defined in multiple assemblies in the global alias; using definition from '{1}' Predefined type is defined in multiple assemblies in the global alias This error occurs when a predefined system type such as System.Int32 is found in two assemblies. One way this can happen is if you are referencing mscorlib or System.Runtime.dll from two different places, such as trying to run two versions of the .NET Fram ... Local '{0}' or its members cannot have their address taken and be used inside an anonymous method or lambda expression Source file has exceeded the limit of 16,707,565 lines representable in the PDB; debug information will be incorrect Source file has exceeded the limit of 16,707,565 lines representable in the PDB; debug information will be incorrect Cannot convert anonymous method block without a parameter list to delegate type '{0}' because it has one or more out parameters Attribute '{0}' is only valid on methods or attribute classes Accessing a member on '{0}' may cause a runtime exception because it is a field of a marshal-by-reference class Accessing a member on a field of a marshal-by-reference class may cause a runtime exception This warning occurs when you try to call a method, property, or indexer on a member of a class that derives from MarshalByRefObject, and the member is a value type. Objects that inherit from MarshalByRefObject are typically intended to be marshaled by refe ... '{0}' is not a valid warning number Not a valid warning number A number that was passed to the #pragma warning preprocessor directive was not a valid warning number. Verify that the number represents a warning, not an error. Invalid number Invalid number Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename. Invalid filename specified for preprocessor directive Invalid #pragma checksum syntax; should be #pragma checksum "filename" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..." Invalid #pragma checksum syntax Single-line comment or end-of-line expected Single-line comment or end-of-line expected after #pragma directive Different checksum values given for '{0}' Different #pragma checksum values given Assembly reference '{0}' is invalid and cannot be resolved Assembly reference is invalid and cannot be resolved This warning indicates that an attribute, such as InternalsVisibleToAttribute, was not specified correctly. Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy Assuming assembly reference matches identity The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly. Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy Assuming assembly reference matches identity The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly. Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references. An assembly with the same simple name '{0}' has already been imported. Try removing one of the references (e.g. '{1}') or sign them to enable side-by-side. Assembly '{0}' with identity '{1}' uses '{2}' which has a higher version than referenced assembly '{3}' with identity '{4}' Fixed size buffers can only be accessed through locals or fields XML comment has a duplicate typeparam tag for '{0}' XML comment has a duplicate typeparam tag XML comment has a typeparam tag for '{0}', but there is no type parameter by that name XML comment has a typeparam tag, but there is no type parameter by that name XML comment on '{1}' has a typeparamref tag for '{0}', but there is no type parameter by that name XML comment has a typeparamref tag, but there is no type parameter by that name Type parameter '{0}' has no matching typeparam tag in the XML comment on '{1}' (but other type parameters do) Type parameter has no matching typeparam tag in the XML comment (but other type parameters do) '{0}': type must be '{2}' to match overridden member '{1}' Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property Assignment made to same variable; did you mean to assign something else? Assignment made to same variable Comparison made to same variable; did you mean to compare something else? Comparison made to same variable Error opening Win32 resource file '{0}' -- '{1}' Expression will always cause a System.NullReferenceException because the default value of '{0}' is null Expression will always cause a System.NullReferenceException because the type's default value is null Class '{0}' cannot have multiple base classes: '{1}' and '{2}' Base class '{0}' must come before any interfaces XML comment has cref attribute '{0}' that refers to a type parameter XML comment has cref attribute that refers to a type parameter Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified. Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations. Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' '{0}' does not contain a constructor that takes {1} arguments Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations Expected expression Invalid version {0} for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise Embedded interop method '{0}' contains a body. Warning level must be zero or greater Invalid option '{0}' for /debug; must be 'portable', 'embedded', 'full' or 'pdbonly' Invalid option '{0}'; Resource visibility must be either 'public' or 'private' The type of the argument to the DefaultParameterValue attribute must match the parameter type Argument of type '{0}' is not applicable for the DefaultParameterValue attribute Duplicate initialization of member '{0}' Member '{0}' cannot be initialized. It is not a field or property. Static field or property '{0}' cannot be assigned in an object initializer Members of readonly field '{0}' of type '{1}' cannot be assigned with an object initializer because it is of a value type Members of property '{0}' of type '{1}' cannot be assigned with an object initializer because it is of a value type Unsafe type '{0}' cannot be used in object creation Element initializer cannot be empty The best overloaded method match for '{0}' has wrong signature for the initializer element. The initializable Add must be an accessible instance method. Cannot initialize type '{0}' with a collection initializer because it does not implement 'System.Collections.IEnumerable' Error reading Win32 manifest file '{0}' -- '{1}' Ignoring /win32manifest for module because it only applies to assemblies Ignoring /win32manifest for module because it only applies to assemblies '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' requires a receiver of type '{3}' The range variable '{0}' has already been declared The range variable '{0}' conflicts with a previous declaration of '{0}' Cannot assign {0} to a range variable Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Consider explicitly specifying the type of the range variable '{2}'. Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Are you missing required assembly references or a using directive for 'System.Linq'? Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. The name '{0}' is not in scope on the left side of 'equals'. Consider swapping the expressions on either side of 'equals'. The name '{0}' is not in scope on the right side of 'equals'. Consider swapping the expressions on either side of 'equals'. Cannot pass the range variable '{0}' as an out or ref parameter Multiple implementations of the query pattern were found for source type '{0}'. Ambiguous call to '{1}'. The type of one of the expressions in the {0} clause is incorrect. Type inference failed in the call to '{1}'. The type of the expression in the {0} clause is incorrect. Type inference failed in the call to '{1}'. An expression of type '{0}' is not allowed in a subsequent from clause in a query expression with source type '{1}'. Type inference failed in the call to '{2}'. An expression tree may not contain an unsafe pointer operation An expression tree may not contain an anonymous method expression An anonymous method expression cannot be converted to an expression tree Range variable '{0}' cannot be assigned to -- it is read only The range variable '{0}' cannot have the same name as a method type parameter The contextual keyword 'var' cannot be used in a range variable declaration The best overloaded Add method '{0}' for the collection initializer has some invalid arguments An expression tree lambda may not contain a ref, in or out parameter An expression tree lambda may not contain a method with variable arguments An expression tree lambda may not contain a method group The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. Non-invocable member '{0}' cannot be used like a method. Member '{0}' implements interface member '{1}' in type '{2}'. There are multiple matches for the interface member at run-time. It is implementation dependent which method will be called. Member implements interface member with multiple matches at run-time This warning can be generated when two interface methods are differentiated only by whether a particular parameter is marked with ref or with out. It is best to change your code to avoid this warning because it is not obvious or guaranteed which method is ... Member '{1}' overrides '{0}'. There are multiple override candidates at run-time. It is implementation dependent which method will be called. Please use a newer runtime. Member overrides base member with multiple override candidates at run-time Object and collection initializer expressions may not be applied to a delegate creation expression '{0}' is of type '{1}'. The type specified in a constant declaration must be sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, an enum-type, or a reference-type. Source file '{0}' could not be found. Source file '{0}' specified multiple times Source file specified multiple times Missing file specification for '{0}' option Command-line syntax error: Missing '{0}' for '{1}' option Unrecognized option: '{0}' No source files specified. No source files specified Expected a script (.csx file) but none specified Error opening response file '{0}' Cannot open '{0}' for writing -- '{1}' Invalid image base number '{0}' '{0}' is a binary file instead of a text file Code page '{0}' is invalid or not installed Algorithm '{0}' is not supported Cannot specify /main if building a module or library Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module' File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long Ignoring /noconfig option because it was specified in a response file Ignoring /noconfig option because it was specified in a response file Invalid file section alignment '{0}' Invalid output name: {0} Invalid debug information format: {0} 'id#' syntax is no longer supported. Use '$id' instead. Invalid name for a preprocessing symbol; '{0}' is not a valid identifier Invalid name for a preprocessing symbol; not a valid identifier Cannot create short filename '{0}' when a long filename with the same short filename already exists A /reference option that declares an extern alias can only have one filename. To specify multiple aliases or filenames, use multiple /reference options. Command-line syntax error: Missing ':<number>' for '{0}' option The /pdb option requires that the /debug option also be used An expression tree lambda may not contain a COM call with ref omitted on arguments Command-line syntax error: Invalid Guid format '{0}' for option '{1}' Command-line syntax error: Missing Guid for option '{1}' Methods with variable arguments are not CLS-compliant Methods with variable arguments are not CLS-compliant Argument type '{0}' is not CLS-compliant Argument type is not CLS-compliant Return type of '{0}' is not CLS-compliant Return type is not CLS-compliant Type of '{0}' is not CLS-compliant Type is not CLS-compliant A public, protected, or protected internal variable must be of a type that is compliant with the Common Language Specification (CLS). Identifier '{0}' differing only in case is not CLS-compliant Identifier differing only in case is not CLS-compliant Overloaded method '{0}' differing only in ref or out, or in array rank, is not CLS-compliant Overloaded method differing only in ref or out, or in array rank, is not CLS-compliant Overloaded method '{0}' differing only by unnamed array types is not CLS-compliant Overloaded method differing only by unnamed array types is not CLS-compliant This error occurs if you have an overloaded method that takes a jagged array and the only difference between the method signatures is the element type of the array. To avoid this error, consider using a rectangular array rather than a jagged array; use an ... Identifier '{0}' is not CLS-compliant Identifier is not CLS-compliant '{0}': base type '{1}' is not CLS-compliant Base type is not CLS-compliant A base type was marked as not having to be compliant with the Common Language Specification (CLS) in an assembly that was marked as being CLS compliant. Either remove the attribute that specifies the assembly is CLS compliant or remove the attribute that i ... '{0}': CLS-compliant interfaces must have only CLS-compliant members CLS-compliant interfaces must have only CLS-compliant members '{0}': only CLS-compliant members can be abstract Only CLS-compliant members can be abstract You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking Added modules must be marked with the CLSCompliant attribute to match the assembly Added modules must be marked with the CLSCompliant attribute to match the assembly '{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute Type or member cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute '{0}' has no accessible constructors which use only CLS-compliant types Type has no accessible constructors which use only CLS-compliant types Arrays as attribute arguments is not CLS-compliant Arrays as attribute arguments is not CLS-compliant You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly '{0}' cannot be marked as CLS-compliant because it is a member of non-CLS-compliant type '{1}' Type cannot be marked as CLS-compliant because it is a member of non-CLS-compliant type CLS compliance checking will not be performed on '{0}' because it is not visible from outside this assembly CLS compliance checking will not be performed because it is not visible from outside this assembly '{0}' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute Type or member does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute CLSCompliant attribute has no meaning when applied to parameters. Try putting it on the method instead. CLSCompliant attribute has no meaning when applied to parameters CLSCompliant attribute has no meaning when applied to return types. Try putting it on the method instead. CLSCompliant attribute has no meaning when applied to return types Constraint type '{0}' is not CLS-compliant Constraint type is not CLS-compliant CLS-compliant field '{0}' cannot be volatile CLS-compliant field cannot be volatile '{0}' is not CLS-compliant because base interface '{1}' is not CLS-compliant Type is not CLS-compliant because base interface is not CLS-compliant 'await' requires that the type {0} have a suitable 'GetAwaiter' method Cannot await '{0}' 'await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable 'IsCompleted', 'OnCompleted', and 'GetResult' members, and implement 'INotifyCompletion' or 'ICriticalNotifyCompletion' 'await' requires that the type '{0}' have a suitable 'GetAwaiter' method. Are you missing a using directive for 'System'? Cannot await 'void' 'await' cannot be used as an identifier within an async method or lambda expression '{0}' does not implement '{1}' Since '{0}' is an async method that returns '{1}', a return keyword must not be followed by an object expression The return type of an async method must be void, Task, Task<T>, a task-like type, IAsyncEnumerable<T>, or IAsyncEnumerator<T> A generic task-like return type was expected, but the type '{0}' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic. Cannot return an expression of type 'void' __arglist is not allowed in the parameter list of async methods Instance of type '{0}' cannot be preserved across 'await' or 'yield' boundary. Async methods cannot have pointer type parameters Async methods cannot have ref, in or out parameters The 'await' operator can only be used when contained within a method or lambda expression marked with the 'async' modifier The 'await' operator can only be used within an async {0}. Consider marking this {0} with the 'async' modifier. The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task<{0}>'. The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. Cannot await in the body of a finally clause Cannot await in a catch clause Cannot await in the filter expression of a catch clause Cannot await in the body of a lock statement The 'await' operator cannot be used in a static script variable initializer. Cannot await in an unsafe context The 'async' modifier can only be used in methods that have a body. Parameters of type '{0}' cannot be declared in async methods or async lambda expressions. Security attribute '{0}' cannot be applied to an Async method. Async methods are not allowed in an Interface, Class, or Structure which has the 'SecurityCritical' or 'SecuritySafeCritical' attribute. The 'await' operator may only be used in a query expression within the first collection expression of the initial 'from' clause or within the collection expression of a 'join' clause This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. Async method lacks 'await' operators and will run synchronously Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. Because this call is not awaited, execution of the current method continues before the call is completed The current method calls an async method that returns a Task or a Task<TResult> and doesn't apply the await operator to the result. The call to the async method starts an asynchronous task. However, because no await operator is applied, the program continu ... 'MethodImplOptions.Synchronized' cannot be applied to an async method CallerLineNumberAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}' CallerFilePathAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}' CallerMemberNameAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}' The CallerLineNumberAttribute may only be applied to parameters with default values The CallerFilePathAttribute may only be applied to parameters with default values The CallerMemberNameAttribute may only be applied to parameters with default values The CallerLineNumberAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerLineNumberAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerFilePathAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerFilePathAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerMemberNameAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerMemberNameAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments Program does not contain a static 'Main' method suitable for an entry point An array initializer of length '{0}' is expected A nested array initializer is expected Invalid variance modifier. Only interface and delegate type parameters can be specified as variant. Unexpected use of an aliased name Unexpected use of a generic name Unexpected use of an unbound generic name Expressions and statements can only occur in a method body An array access may not have a named argument specifier This language feature ('{0}') is not yet implemented. Default values are not valid in this context. Error opening icon file {0} -- {1} Error opening Win32 manifest file {0} -- {1} Error building Win32 resources -- {0} Optional parameters must appear after all required parameters Cannot inherit interface '{0}' with the specified type parameters because it causes method '{1}' to contain overloads which differ only on ref and out Partial declarations of '{0}' must have the same type parameter names and variance modifiers in the same order Invalid variance: The type parameter '{1}' must be {3} valid on '{0}'. '{1}' is {2}. Invalid variance: The type parameter '{1}' must be {3} valid on '{0}' unless language version '{4}' or greater is used. '{1}' is {2}. '{0}': cannot derive from the dynamic type '{0}': cannot implement a dynamic interface '{1}' Constraint cannot be the dynamic type Constraint cannot be a dynamic type '{0}' One or more types required to compile a dynamic expression cannot be found. Are you missing a reference? Name '{0}' exceeds the maximum length allowed in metadata. Attributes are not valid in this context. Attributes on lambda expressions require a parenthesized parameter list. 'extern alias' is not valid in this context Using '{0}' to test compatibility with '{1}' is essentially identical to testing compatibility with '{2}' and will succeed for all non-null values Using 'is' to test compatibility with 'dynamic' is essentially identical to testing compatibility with 'Object' Cannot use 'yield' in top-level script code Cannot declare namespace in script code Assembly and module attributes are not allowed in this context Delegate '{0}' has no invoke method or an invoke method with a return type or parameter types that are not supported. The entry point of the program is global code; ignoring '{0}' entry point. The entry point of the program is global code; ignoring entry point The second operand of an 'is' or 'as' operator may not be static type '{0}' The second operand of an 'is' or 'as' operator may not be a static type Inconsistent accessibility: event type '{1}' is less accessible than event '{0}' Named argument specifications must appear after all fixed arguments have been specified. Please use language version {0} or greater to allow non-trailing named arguments. Named argument specifications must appear after all fixed arguments have been specified in a dynamic invocation. The best overload for '{0}' does not have a parameter named '{1}' The delegate '{0}' does not have a parameter named '{1}' Named argument '{0}' cannot be specified multiple times Named argument '{0}' specifies a parameter for which a positional argument has already been given Named argument '{0}' is used out-of-position but is followed by an unnamed argument Cannot specify default parameter value in conjunction with DefaultParameterAttribute or OptionalAttribute Default parameter value for '{0}' must be a compile-time constant A ref or out parameter cannot have a default value Cannot specify a default value for the 'this' parameter Cannot specify a default value for a parameter collection A value of type '{0}' cannot be used as a default parameter because there are no standard conversions to type '{1}' A value of type '{0}' cannot be used as default parameter for nullable parameter '{1}' because '{0}' is not a simple type '{0}' is of type '{1}'. A default parameter value of a reference type other than string can only be initialized with null The default value specified for parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The default value specified will have no effect because it applies to a member that is used in contexts that do not allow optional arguments A default value is specified for 'ref readonly' parameter '{0}', but 'ref readonly' should be used only for references. Consider declaring the parameter as 'in'. A default value is specified for 'ref readonly' parameter, but 'ref readonly' should be used only for references. Consider declaring the parameter as 'in'. Error signing output with public key from file '{0}' -- {1} Error signing output with public key from container '{0}' -- {1} The typeof operator cannot be used on the dynamic type The typeof operator cannot be used on a nullable reference type An expression tree may not contain a dynamic operation Async lambda expressions cannot be converted to expression trees Cannot define a class or member that utilizes 'dynamic' because the compiler required type '{0}' cannot be found. Are you missing a reference? Cannot pass null for friend assembly name Key file '{0}' is missing the private key needed for signing Public signing was specified and requires a public key, but no public key was specified. Public signing is not supported for netmodules. Delay signing was specified and requires a public key, but no public key was specified Delay signing was specified and requires a public key, but no public key was specified The specified version string '{0}' does not conform to the required format - major[.minor[.build[.revision]]] The specified version string '{0}' contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation The specified version string '{0}' does not conform to the required format - major.minor.build.revision (without wildcards) The specified version string '{0}' does not conform to the recommended format - major.minor.build.revision The specified version string does not conform to the recommended format - major.minor.build.revision Executables cannot be satellite assemblies; culture should always be empty There is no argument given that corresponds to the required parameter '{0}' of '{1}' The command line switch '{0}' is not yet implemented and was ignored. Command line switch is not yet implemented Failed to emit module '{0}': {1} Cannot use fixed local '{0}' inside an anonymous method, lambda expression, or query expression An expression tree may not contain a named argument specification An expression tree may not contain a call or invocation that uses optional arguments An expression tree may not contain an indexed property Indexed property '{0}' has non-optional arguments which must be provided Indexed property '{0}' must have all arguments optional Instance of type '{0}' cannot be used inside a nested function, query expression, iterator block or async method First argument to a security attribute must be a valid SecurityAction Security attribute '{0}' has an invalid SecurityAction value '{1}' SecurityAction value '{0}' is invalid for security attributes applied to an assembly SecurityAction value '{0}' is invalid for security attributes applied to a type or a method SecurityAction value '{0}' is invalid for PrincipalPermission attribute An expression tree may not contain '{0}' Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}' The type name '{0}' could not be found in the global namespace. This type has been forwarded to assembly '{1}' Consider adding a reference to that assembly. The type name '{0}' could not be found in the namespace '{1}'. This type has been forwarded to assembly '{2}' Consider adding a reference to that assembly. The type name '{0}' could not be found. This type has been forwarded to assembly '{1}'. Consider adding a reference to that assembly. Assemblies '{0}' and '{1}' refer to the same metadata but only one is a linked reference (specified using /link option); consider removing one of the references. The best overloaded Add method '{0}' for the collection initializer element is obsolete. The best overloaded Add method for the collection initializer element is obsolete The best overloaded Add method '{0}' for the collection initializer element is obsolete. {1} The best overloaded Add method for the collection initializer element is obsolete The best overloaded Add method '{0}' for the collection initializer element is obsolete. {1} Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations. Cannot use an expression of type '{0}' as an argument to a dynamically dispatched operation. Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type. Cannot use a method group as an argument to a dynamically dispatched operation. Did you intend to invoke the method? The call to method '{0}' needs to be dynamically dispatched, but cannot be because it is part of a base access expression. Consider casting the dynamic arguments or eliminating the base access. Query expressions over source type 'dynamic' or with a join sequence of type 'dynamic' are not allowed The indexer access needs to be dynamically dispatched, but cannot be because it is part of a base access expression. Consider casting the dynamic arguments or eliminating the base access. The dynamically dispatched call to method '{0}' may fail at runtime because one or more applicable overloads are conditional methods. Dynamically dispatched call may fail at runtime because one or more applicable overloads are conditional methods '{0}' has no applicable method named '{1}' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax. The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. The CallerMemberNameAttribute will have no effect; it is overridden by the CallerFilePathAttribute The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute. The CallerMemberNameAttribute will have no effect; it is overridden by the CallerLineNumberAttribute The CallerFilePathAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute. The CallerFilePathAttribute will have no effect; it is overridden by the CallerLineNumberAttribute Expression must be implicitly convertible to Boolean or its type '{0}' must define operator '{1}'. '{0}' cannot implement '{1}' because '{2}' is a Windows Runtime event and '{3}' is a regular .NET event. Call System.IDisposable.Dispose() on allocated instance of {0} before all references to it are out of scope. Call System.IDisposable.Dispose() on allocated instance before all references to it are out of scope Allocated instance of {0} is not disposed along all exception paths. Call System.IDisposable.Dispose() before all references to it are out of scope. Allocated instance is not disposed along all exception paths Object '{0}' can be disposed more than once. Object can be disposed more than once Interop type '{0}' cannot be embedded. Use the applicable interface instead. Type '{0}' cannot be embedded because it is a nested type. Consider setting the 'Embed Interop Types' property to false. Type '{0}' cannot be embedded because it has a generic argument. Consider setting the 'Embed Interop Types' property to false. Embedded interop struct '{0}' can contain only public instance fields. A Windows Runtime event may not be passed as an out or ref parameter. Source interface '{0}' is missing method '{1}' which is required to embed event '{2}'. Interface '{0}' has an invalid source interface which is required to embed event '{1}'. Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute. Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute. Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute. Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider setting the 'Embed Interop Types' property to false. Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider setting the 'Embed Interop Types' property to false. A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly created by assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly. A reference was created to embedded interop assembly because of an indirect assembly reference You have added a reference to an assembly using /link (Embed Interop Types property set to True). This instructs the compiler to embed interop type information from that assembly. However, the compiler cannot embed interop type information from that assemb ... Type '{0}' from assembly '{1}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type. Cannot find the interop type that matches the embedded interop type '{0}'. Are you missing an assembly reference? Module name '{0}' stored in '{1}' must match its filename. Invalid module name: {0} Invalid '{0}' value: '{1}'. AppConfigPath must be absolute. Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source Attribute will be ignored in favor of the instance appearing in source Attribute '{0}' given in a source file conflicts with option '{1}'. A fixed buffer may only have one dimension. Referenced assembly '{0}' does not have a strong name. Referenced assembly does not have a strong name Invalid signature public key specified in AssemblySignatureKeyAttribute. Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly. Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'. Forwarded type '{0}' conflicts with type declared in primary module of this assembly. Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'. Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'. Referenced assembly '{0}' has different culture setting of '{1}'. Referenced assembly has different culture setting Agnostic assembly cannot have a processor specific module '{0}'. Assembly and module '{0}' cannot target different processors. Referenced assembly '{0}' targets a different processor. Referenced assembly targets a different processor Cryptographic failure while creating hashes. Reference to '{0}' netmodule missing. Module '{0}' is already defined in this assembly. Each module must have a unique filename. Cannot read config file '{0}' -- '{1}' Cannot continue since the edit includes a reference to an embedded type: '{0}'. Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'. Compilation options '{0}' and '{1}' can't both be specified at the same time. Linked netmodule metadata must provide a full PE image: '{0}'. /platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe <path list> <text> null propagating operator expression-bodied method expression-bodied property expression-bodied indexer auto property initializer <namespace> byref locals and returns readonly references ref structs ref conditional expression ref reassignment ref for-loop variables ref foreach iteration variables extensible fixed statement Compilation (C#): Syntax node is not within syntax tree Location must be provided in order to provide minimal type qualification. SyntaxTreeSemanticModel must be provided in order to provide minimal type qualification. Can't reference compilation of type '{0}' from {1} compilation. Syntax tree already present Submission can only include script code. Submission can have at most one syntax tree. SyntaxTree is not part of the compilation, so it cannot be removed tree must have a root node with SyntaxKind.CompilationUnit Type argument cannot be null Wrong number of type arguments Name conflict for name {0} LookupOptions has an invalid combination of options items: must be non-empty Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier or Microsoft.CodeAnalysis.CSharp.SyntaxFactory.VerbatimIdentifier to create identifier tokens. Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal to create character literal tokens. Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal to create numeric literal tokens. This method can only be used to create tokens - {0} is not a token kind. Generic parameter is definition when expected to be reference {0} Called GetDeclarationName for a declaration node that can possibly contain multiple variable declarators. Position is not within syntax tree with full span {0} The language name '{0}' is invalid. The language name is invalid Transparent identifier member access failed for field '{0}' of '{1}'. Does the data being queried implement the query pattern? The parameter has multiple distinct default values. The field has multiple distinct constant values. Within cref attributes, nested types of generic types should be qualified. Within cref attributes, nested types of generic types should be qualified Not a C# symbol. Unnecessary using directive. Unused extern alias. Elements cannot be null. LIB environment variable /LIB option /REFERENCEPATH option directory does not exist path is too long or invalid No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. No value for RuntimeMetadataVersion found Expected a {0} SemanticModel. lambda expression Feature '{0}' is not available in C# 1. Please use language version {1} or greater. Feature '{0}' is not available in C# 2. Please use language version {1} or greater. Feature '{0}' is not available in C# 3. Please use language version {1} or greater. Feature '{0}' is not available in C# 4. Please use language version {1} or greater. Feature '{0}' is not available in C# 5. Please use language version {1} or greater. Feature '{0}' is not available in C# 6. Please use language version {1} or greater. Feature '{0}' is not available in C# 7.0. Please use language version {1} or greater. Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable. 'experimental' Position must be within span of the syntax tree. Syntax node to be speculated cannot belong to a syntax tree from the current compilation. Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel. Microsoft (R) Visual C# Compiler {0} version {1} Copyright (C) Microsoft Corporation. All rights reserved. Supported language versions: Visual C# Compiler Options - OUTPUT FILES - -out:<file> Specify output file name (default: base name of file with main class or first file) -target:exe Build a consol ... '{0}': a class with the ComImport attribute cannot specify field initializers. Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug. Local name is too long for PDB Anonymous function converted to a void returning delegate cannot return a value Async lambda expression converted to a '{0}' returning delegate cannot return a value An instance of analyzer {0} cannot be created from {1} : {2}. An analyzer instance cannot be created The assembly {0} does not contain any analyzers. Assembly does not contain any analyzers Unable to load Analyzer assembly {0} : {1} Unable to load Analyzer assembly Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}. Error reading ruleset file {0} - {1} Error reading debug information for '{0}' Operation caused a stack overflow. Expected identifier or numeric literal. Expected identifier or numeric literal Only auto-implemented properties, or properties that use the 'field' keyword, can have initializers. Instance properties in interfaces cannot have initializers. Auto-implemented properties must have get accessors. Auto-implemented properties must override all accessors of the overridden property. Structs without explicit constructors cannot contain members with initializers. Cannot emit debug information for a source text without encoding. Block bodies and expression bodies cannot both be provided. Control cannot fall out of switch from final case label ('{0}') Type arguments are not allowed in the nameof operator. An expression tree lambda may not contain a null propagating operator. An expression tree lambda may not contain a dictionary initializer. An extension Add method is not supported for a collection initializer in an expression lambda. nameof operator dictionary initializer Missing close delimiter '}' for interpolated expression started with '{'. A single-line comment may not be used in an interpolated string. An expression is too long or complex to compile Expression does not have a name. Sub-expression cannot be used in an argument to nameof. An alias-qualified name is not an expression. Type parameters are not allowed on a method group as an argument to 'nameof'. SearchCriteria is expected. Assembly culture strings may not contain embedded NUL characters. using static interpolated strings alternative interpolated verbatim strings await in catch blocks and finally blocks binary literals digit separators local functions A '{0}' character must be escaped (by doubling) in an interpolated string. A '{0}' character may only be escaped by doubling '{0}{0}' in an interpolated string. A format specifier may not contain trailing whitespace. Empty format specifier. There is an error in a referenced assembly '{0}'. Expression or declaration statement expected. Extension method groups are not allowed as an argument to 'nameof'. Alignment value {0} has a magnitude greater than {1} and may result in a large formatted string. Unused extern alias Unnecessary using directive Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException Alignment value has a magnitude that may result in a large formatted string Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants. Tuple must contain at least two elements. Debug entry point must be a definition of a method declared in the current compilation. #load is only allowed in scripts Cannot use #load after first token in file Could not find file. SyntaxTree resulted from a #load directive and cannot be removed or replaced directly. Source file references are not supported. The pathmap option was incorrectly formatted. Invalid real literal. Auto-implemented properties cannot return by reference Properties which return by reference must have a get accessor Properties which return by reference cannot have set accessors '{0}' must match by reference return of overridden member '{1}' '{0}' must match by init-only of overridden member '{1}' By-reference returns may only be used in methods that return by reference By-value returns may only be used in methods that return by value The return expression must be of type '{0}' because this method returns by reference '{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}' because it does not have matching return by reference. '{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}'. The body of '{0}' cannot be an iterator block because '{0}' returns by reference Lambda expressions that return by reference cannot be converted to expression trees An expression tree lambda may not contain a call to a method, property, or indexer that returns by reference An expression cannot be used in this context because it may not be passed or returned by reference Cannot return '{0}' by reference because it was initialized to a value that cannot be returned by reference Cannot return by reference a member of '{0}' because it was initialized to a value that cannot be returned by reference Local '{0}' is returned by reference but was initialized to a value that cannot be returned by reference Local is returned by reference but was initialized to a value that cannot be returned by reference A member of '{0}' is returned by reference but was initialized to a value that cannot be returned by reference A member is returned by reference but was initialized to a value that cannot be returned by reference Cannot return '{0}' by reference because it is read-only Cannot return the range variable '{0}' by reference Cannot return '{0}' by reference because it is a '{1}' A readonly field cannot be returned by writable reference A static readonly field cannot be returned by writable reference Members of readonly field '{0}' cannot be returned by writable reference Fields of static readonly field '{0}' cannot be returned by writable reference Cannot return a parameter by reference '{0}' because it is not a ref parameter Cannot return by reference a member of parameter '{0}' because it is not a ref or out parameter Cannot return a parameter by reference '{0}' because it is scoped to the current method Cannot return by reference a member of parameter '{0}' because it is scoped to the current method Cannot return a parameter by reference '{0}' through a ref parameter; it can only be returned in a return statement Cannot return by reference a member of parameter '{0}' through a ref parameter; it can only be returned in a return statement This returns a parameter by reference '{0}' through a ref parameter; but it can only safely be returned in a return statement This returns a parameter by reference through a ref parameter; but it can only safely be returned in a return statement This returns by reference a member of parameter '{0}' through a ref parameter; but it can only safely be returned in a return statement This returns by reference a member of parameter through a ref parameter; but it can only safely be returned in a return statement This returns a parameter by reference '{0}' but it is not a ref parameter This returns a parameter by reference but it is not a ref parameter This returns a parameter by reference '{0}' but it is scoped to the current method This returns a parameter by reference but it is scoped to the current method This returns by reference a member of parameter '{0}' that is not a ref or out parameter This returns by reference a member of parameter that is not a ref or out parameter This returns by reference a member of parameter '{0}' that is scoped to the current method This returns by reference a member of parameter that is scoped to the current method Cannot return local '{0}' by reference because it is not a ref local Cannot return a member of local '{0}' by reference because it is not a ref local This returns local '{0}' by reference but it is not a ref local This returns local by reference but it is not a ref local This returns a member of local '{0}' by reference but it is not a ref local This returns a member of local by reference but it is not a ref local Struct members cannot return 'this' or other instance members by reference Struct member returns 'this' or other instance members by reference Struct member returns 'this' or other instance members by reference Expression cannot be used in this context because it may indirectly expose variables outside of their declaration scope Cannot use variable '{0}' in this context because it may expose referenced variables outside of their declaration scope Use of variable '{0}' in this context may expose referenced variables outside of their declaration scope Use of variable in this context may expose referenced variables outside of their declaration scope Cannot use a result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope Cannot use a member of result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope Use of result of '{0}' in this context may expose variables referenced by parameter '{1}' outside of their declaration scope Use of result in this context may expose variables referenced by parameter outside of their declaration scope Use of member of result of '{0}' in this context may expose variables referenced by parameter '{1}' outside of their declaration scope Use of member of result in this context may expose variables referenced by parameter outside of their declaration scope This combination of arguments to '{0}' is disallowed because it may expose variables referenced by parameter '{1}' outside of their declaration scope This combination of arguments to '{0}' may expose variables referenced by parameter '{1}' outside of their declaration scope This combination of arguments may expose variables referenced by parameter outside of their declaration scope Branches of a ref conditional operator cannot refer to variables with incompatible declaration scopes The branches of the ref conditional operator refer to variables with incompatible declaration scopes The branches of the ref conditional operator refer to variables with incompatible declaration scopes A result of a stackalloc expression of type '{0}' cannot be used in this context because it may be exposed outside of the containing method A result of a stackalloc expression of type '{0}' in this context may be exposed outside of the containing method A result of a stackalloc expression of this type in this context may be exposed outside of the containing method Cannot initialize a by-value variable with a reference Cannot initialize a by-reference variable with a value The expression must be of type '{0}' because it is being assigned by reference A declaration of a by-reference variable must have an initializer Cannot use ref local '{0}' inside an anonymous method, lambda expression, or query expression A reference returned by a call to '{0}' cannot be preserved across 'await' or 'yield' boundary. 'await' cannot be used in an expression containing a ref conditional operator Both conditional operator values must be ref values or neither may be a ref value The expression must be of type '{0}' to match the alternative ref value An expression tree may not contain a reference to a local function Cannot pass argument with dynamic type to params parameter '{0}' of local function '{1}'. Syntax tree should be created from a submission. Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string literals. It is not legal to use nullable type '{0}?' in a pattern; use the underlying type '{0}' instead. It is not legal to use nullable reference type '{0}?' in an is-type expression; use the underlying type '{0}' instead. It is not legal to use nullable reference type '{0}?' in an as expression; use the underlying type '{0}' instead. Invalid operand for pattern match; value required, but found '{0}'. An error occurred while writing the output file: {0}. Tuple element names must be unique. Tuple element name '{0}' is only allowed at position {1}. Tuple element name '{0}' is disallowed at any position. Member '{0}' was not found on type '{1}' from assembly '{2}'. tuples No suitable 'Deconstruct' instance or extension method was found for type '{0}', with {1} out parameters and a void return type. Deconstruct assignment requires an expression with a type on the right-hand-side. The switch expression must be a value; found '{0}'. The switch case is unreachable. It has already been handled by a previous case or it is impossible to match. stdin argument '-' is specified, but input has not been redirected from the standard input stream. The pattern is unreachable. It has already been handled by a previous arm of the switch expression or it is impossible to match. An expression of type '{0}' cannot be handled by a pattern of type '{1}'. An expression of type '{0}' cannot be handled by a pattern of type '{1}'. Please use language version '{2}' or greater to match an open type with a constant pattern. Attribute '{0}' is ignored when public signing is specified. Attribute is ignored when public signing is specified. Option '{0}' must be an absolute path. Tuple with {0} elements cannot be converted to type '{1}'. out variable declaration Reference to an implicitly-typed out variable '{0}' is not permitted in the same argument list. Cannot infer the type of implicitly-typed out variable '{0}'. Cannot infer the type of implicitly-typed deconstruction variable '{0}'. Cannot infer the type of implicitly-typed discard. Cannot deconstruct a tuple of '{0}' elements into '{1}' variables. Cannot deconstruct dynamic objects. Deconstruction must contain at least two variables. The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'. The tuple element name is ignored because a different name or no name is specified by the assignment target. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. Predefined type '{0}' must be a struct. 'new' cannot be used with tuple type. Use a tuple literal expression instead. Deconstruction 'var (...)' form disallows a specific type for 'var'. Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference? Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names. An expression tree may not contain an out argument variable declaration. An expression tree may not contain a discard. An expression tree may not contain an 'is' pattern-matching operator. An expression tree may not contain a tuple literal. An expression tree may not contain a tuple conversion. /sourcelink switch is only supported when emitting PDB. /embed switch is only supported when emitting a PDB. Invalid instrumentation kind: {0} Invalid hash algorithm name: '{0}' The syntax 'var (...)' as an lvalue is reserved. { or ; or => expected A throw expression is not allowed in this context. A declaration is not allowed in this context. A foreach loop must declare its iteration variables. Tuple element names are not permitted on the left of a deconstruction. To cast a negative value, you must enclose the value in parentheses. An expression tree may not contain a throw-expression. An expression tree may not contain a with-expression. Invalid assembly name: {0} For type '{0}' to be used as an AsyncMethodBuilder for type '{1}', its Task property should return type '{1}' instead of type '{2}'. Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'. It is not legal to use the type 'dynamic' in a pattern. Provided documentation mode is unsupported or invalid: '{0}'. Provided source code kind is unsupported or invalid: '{0}' Provided language version is unsupported or invalid: '{0}'. Invalid name for a preprocessing symbol; '{0}' is not a valid identifier Feature '{0}' is not available in C# 7.1. Please use language version {1} or greater. Feature '{0}' is not available in C# 7.2. Please use language version {1} or greater. Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. Feature '{0}' is not available in C# 8.0. Please use language version {1} or greater. Specified language version '{0}' cannot have leading zeroes A value of type 'void' may not be assigned. '{0}' is for evaluation purposes only and is subject to change or removal in future updates. Type is for evaluation purposes only and is subject to change or removal in future updates. '{0}' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. Compiler version: '{0}'. Language version: {1}. async main Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name. To use '@$' instead of '$@' for an interpolated verbatim string, please use language version '{0}' or greater. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. Field-targeted attributes on auto-properties are not supported in this version of the language. A tuple may not contain a value of type 'void'. nullable reference types warning action enable Converting null literal or possible null value to non-nullable type. Converting null literal or possible null value to non-nullable type. Possible null reference assignment. Possible null reference assignment. Dereference of a possibly null reference. Dereference of a possibly null reference. Possible null reference return. Possible null reference return. Possible null reference argument for parameter '{0}' in '{1}'. Possible null reference argument. Thrown value may be null. Thrown value may be null. Unboxing a possibly null value. Unboxing a possibly null value. Nullability of reference types in type doesn't match overridden member. Nullability of reference types in type doesn't match overridden member. Nullability of reference types in return type doesn't match overridden member. Nullability of reference types in return type doesn't match overridden member. Nullability of return type doesn't match overridden member (possibly because of nullability attributes). Nullability of return type doesn't match overridden member (possibly because of nullability attributes). Nullability of reference types in type of parameter '{0}' doesn't match overridden member. Nullability of reference types in type of parameter doesn't match overridden member. Nullability of type of parameter '{0}' doesn't match overridden member (possibly because of nullability attributes). Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes). Nullability of reference types in type of parameter '{0}' doesn't match partial method declaration. Nullability of reference types in type of parameter doesn't match partial method declaration. Nullability of reference types in return type doesn't match partial method declaration. Nullability of reference types in return type doesn't match partial method declaration. Nullability of reference types in type of '{0}' doesn't match implicitly implemented member '{1}'. Nullability of reference types in type doesn't match implicitly implemented member. Nullability of reference types in return type of '{0}' doesn't match implicitly implemented member '{1}'. Nullability of reference types in return type doesn't match implicitly implemented member. Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match implicitly implemented member '{2}'. Nullability of reference types in type of parameter doesn't match implicitly implemented member. Nullability of reference types in return type of '{0}' doesn't match implicitly implemented member '{1}' (possibly because of nullability attributes). Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes). Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match implicitly implemented member '{2}' (possibly because of nullability attributes). Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). Nullability of reference types in type doesn't match implemented member '{0}'. Nullability of reference types in type doesn't match implemented member. Nullability of reference types in return type doesn't match implemented member '{0}'. Nullability of reference types in return type doesn't match implemented member. Nullability of reference types in type of parameter '{0}' doesn't match implemented member '{1}'. Nullability of reference types in type of parameter doesn't match implemented member. Nullability of reference types in return type doesn't match implemented member '{0}' (possibly because of nullability attributes). Nullability of reference types in return type doesn't match implemented member (possibly because of nullability attributes). Nullability of reference types in type of parameter '{0}' doesn't match implemented member '{1}' (possibly because of nullability attributes). Nullability of reference types in type of parameter doesn't match implemented member (possibly because of nullability attributes). Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the {0} as nullable. Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. Nullability of reference types in value of type '{0}' doesn't match target type '{1}'. Nullability of reference types in value doesn't match target type. Call to non-readonly member '{0}' from a 'readonly' member results in an implicit copy of '{1}'. Call to non-readonly member from a 'readonly' member results in an implicit copy. Static member '{0}' cannot be marked 'readonly'. Auto-implemented 'set' accessor '{0}' cannot be marked 'readonly'. Auto-implemented property '{0}' cannot be marked 'readonly' because it has a 'set' accessor. Cannot specify 'readonly' modifiers on both property or indexer '{0}' and its accessor. Remove one of them. Cannot specify 'readonly' modifiers on both accessors of property or indexer '{0}'. Instead, put a 'readonly' modifier on the property itself. Field-like event '{0}' cannot be 'readonly'. Both partial member declarations must be readonly or neither may be readonly '{0}': 'readonly' can only be used on accessors if the property or indexer has both a get and a set accessor Argument of type '{0}' cannot be used for parameter '{2}' of type '{1}' in '{3}' due to differences in the nullability of reference types. Argument cannot be used for parameter due to differences in the nullability of reference types. Argument of type '{0}' cannot be used as an output of type '{1}' for parameter '{2}' in '{3}' due to differences in the nullability of reference types. Argument cannot be used as an output for parameter due to differences in the nullability of reference types. A possible null value may not be used for a type marked with [NotNull] or [DisallowNull] A possible null value may not be used for a type marked with [NotNull] or [DisallowNull] Parameter '{0}' must have a non-null value when exiting with '{1}'. Parameter must have a non-null value when exiting in some condition. Parameter '{0}' must have a non-null value when exiting. Parameter must have a non-null value when exiting. Parameter '{0}' must have a non-null value when exiting because parameter '{1}' is non-null. Parameter must have a non-null value when exiting because parameter referenced by NotNullIfNotNull is non-null. Return value must be non-null because parameter '{0}' is non-null. Return value must be non-null because parameter is non-null. Member '{0}' must have a non-null value when exiting. Member must have a non-null value when exiting. Member '{0}' cannot be used in this attribute. Member cannot be used in this attribute. Member '{0}' must have a non-null value when exiting with '{1}'. Member must have a non-null value when exiting in some condition. A method marked [DoesNotReturn] should not return. A method marked [DoesNotReturn] should not return. Method '{0}' lacks `[DoesNotReturn]` annotation to match implemented or overridden member. Method lacks `[DoesNotReturn]` annotation to match implemented or overridden member. Nullability of reference types in return type of '{0}' doesn't match the target delegate '{1}' (possibly because of nullability attributes). Nullability of reference types in return type doesn't match the target delegate (possibly because of nullability attributes). Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match the target delegate '{2}' (possibly because of nullability attributes). Nullability of reference types in type of parameter doesn't match the target delegate (possibly because of nullability attributes). Cannot convert null literal to non-nullable reference type. Cannot convert null literal to non-nullable reference type. Cannot use a nullable reference type in object creation. Nullable value type may be null. Nullable value type may be null. The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. Nullability of type argument '{3}' doesn't match constraint type '{1}'. The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match constraint type. The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Explicit application of 'System.Runtime.CompilerServices.NullableAttribute' is not allowed. A nullable type parameter must be known to be a value type or non-nullable reference type unless language version '{0}' or greater is used. Consider changing the language version or adding a 'class', 'struct', or type constraint. Invalid '{0}' value: '{1}' for C# {2}. Please use language version '{3}' or greater. A void or int returning entry point cannot be async An expression of type '{0}' cannot be handled by a pattern of type '{1}' in C# {2}. Please use language version {3} or greater. The local function '{0}' is declared but never used Local function is declared but never used Local function '{0}' must declare a body because it is not marked 'static extern'. Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' {0} is not a valid C# conversion expression Cannot pass argument with dynamic type to generic local function '{0}' with inferred type arguments. leading digit separator Do not use '{0}'. This is reserved for compiler usage. The type name '{0}' is reserved to be used by the compiler. The first 'in' or 'ref readonly' parameter of the extension method '{0}' must be a concrete (non-generic) value type. Instance fields of readonly structs must be readonly. Auto-implemented instance properties in readonly structs must be readonly. Field-like events are not allowed in readonly structs. ref extension methods Conversion of a stackalloc expression of type '{0}' to type '{1}' is not possible. The first parameter of a 'ref' extension method '{0}' must be a value type or a generic type constrained to struct. An in parameter cannot have the Out attribute. A ref readonly parameter cannot have the Out attribute. {0} is not a valid C# compound assignment operation {0} is not a valid C# spread operation Filter expression is a constant 'false', consider removing the catch clause Filter expression is a constant 'false' Filter expression is a constant 'false', consider removing the try-catch block Filter expression is a constant 'false'. A conditional expression cannot be used directly in a string interpolation because the ':' ends the interpolation. Parenthesize the conditional expression. Arguments with 'in' modifier cannot be used in dynamically dispatched expressions. Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. The left-hand side of a ref assignment must be a ref variable. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. Cannot ref-assign '{1}' to '{0}' because '{1}' can only escape the current method through a return statement. This ref-assigns '{1}' to '{0}' but '{1}' can only escape the current method through a return statement. This ref-assigns a value that can only escape the current method through a return statement. This ref-assigns '{1}' to '{0}' but '{1}' has a narrower escape scope than '{0}'. This ref-assigns a value that has a narrower escape scope than the target. Cannot ref-assign '{1}' to '{0}' because '{1}' has a wider value escape scope than '{0}' allowing assignment through '{0}' of values with narrower escapes scopes than '{1}'. This ref-assigns '{1}' to '{0}' but '{1}' has a wider value escape scope than '{0}' allowing assignment through '{0}' of values with narrower escapes scopes than '{1}'. This ref-assigns a value that has a wider value escape scope than the target allowing assignment through the target of values with narrower escapes scopes. enum generic type constraints delegate generic type constraints unmanaged generic type constraints The 'new()' constraint cannot be used with the 'unmanaged' constraint The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' stackalloc initializer "Invalid rank specifier: expected ']' declaration of expression variables in member initializers and queries Pattern missing recursive patterns null pointer constant pattern default type parameter constraints Matching the tuple type '{0}' requires '{1}' subpatterns, but '{2}' subpatterns are present. A property subpattern requires a reference to the property or field to be matched, e.g. '{{ Name: {0} }}' A default literal 'default' is not valid as a pattern. Use another literal (e.g. '0' or 'null') as appropriate. To match everything, use a discard pattern '_'. No best type was found for the switch expression. There is no target type for the default literal. The delegate type could not be inferred. The contextual keyword 'var' cannot be used as an explicit lambda return type A single-element deconstruct pattern requires some other syntax for disambiguation. It is recommended to add a discard designator '_' after the close paren ')'. The syntax 'var' for a pattern is not permitted to refer to a type, but '{0}' is in scope here. The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '{0}' is not covered. The switch expression does not handle all possible values of its input type (it is not exhaustive). The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '{0}' is not covered. However, a pattern with a 'when' clause might successfully match this value. The switch expression does not handle all possible values of its input type (it is not exhaustive). The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '{0}' is not covered. The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. The name '_' refers to the constant, not the discard pattern. Use 'var _' to discard the value, or '@_' to refer to a constant by that name. Do not use '_' for a case constant. The name '_' refers to the type '{0}', not the discard pattern. Use '@_' for the type, or 'var _' to discard. Do not use '_' to refer to the type in an is-type expression. An expression tree may not contain a switch expression. Invalid object creation indexing movable fixed buffers __arglist cannot have an argument passed by 'in' or 'out' SyntaxTree is not part of the compilation An out variable cannot be declared as a ref local Multiple analyzer config files cannot be in the same directory ('{0}'). coalescing assignment Cannot create constructed generic type from another constructed generic type. Cannot create constructed generic type from non-generic type. unconstrained type parameters in null coalescing operator Nullability in constraints for type parameter '{0}' of method '{1}' doesn't match the constraints for type parameter '{2}' of interface method '{3}'. Consider using an explicit interface implementation instead. Nullability in constraints for type parameter doesn't match the constraints for type parameter in implicitly implemented interface method'. The type '{2}' cannot be used as type parameter '{1}' in the generic type or method '{0}'. Nullability of type argument '{2}' doesn't match 'class' constraint. The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint. Unexpected character sequence '...' index operator range operator static local functions name shadowing in nested functions lambda discard parameters MemberNotNull attribute native-sized integers Cannot use a collection of dynamic type in an asynchronous foreach Expected 'enable', 'disable', or 'restore' Expected 'warnings', 'annotations', or end of directive The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. Object or collection initializer implicitly dereferences possibly null member '{0}'. Object or collection initializer implicitly dereferences possibly null member. Expression tree cannot contain value of ref struct or restricted type '{0}'. 'else' cannot start a statement. An expression tree may not contain a null coalescing assignment Invalid option '{0}' for /nullable; must be 'disable', 'enable', 'warnings' or 'annotations' Parentheses are required around the switch governing expression. The name '{0}' does not identify tuple element '{1}'. The name '{0}' does not match the corresponding 'Deconstruct' parameter '{1}'. An expression of type '{0}' can never match the provided pattern. An expression of type '{0}' always matches the provided pattern. The input always matches the provided pattern. The given expression never matches the provided pattern. The given expression never matches the provided pattern. The given expression always matches the provided constant. The given expression always matches the provided constant. The given expression always matches the provided pattern. The given expression always matches the provided pattern. Feature '{0}' is not available in C# 8.0. Please use language version {1} or greater. Pattern-matching is not permitted for pointer types. Element names are not permitted when pattern-matching via 'System.Runtime.CompilerServices.ITuple'. The discard pattern is not permitted as a case label in a switch statement. Use 'case var _:' for a discard pattern, or 'case @_:' for a constant named '_'. Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type. Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type. '{0}' does not implement interface member '{1}'. Nullability of reference types in interface implemented by the base type doesn't match. Type does not implement interface member. Nullability of reference types in interface implemented by the base type doesn't match. '{0}' is already listed in the interface list on type '{1}' with different nullability of reference types. Interface is already listed in the interface list with different nullability of reference types. '{0}' is explicitly implemented more than once. A using variable cannot be used directly within a switch section (consider using braces). A goto cannot jump to a location after a using declaration. A goto cannot jump to a location before a using declaration within the same block. using declarations pattern-based disposal The feature '{0}' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. default interface implementation Target runtime doesn't support default interface implementation. '{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support default interface implementation. The modifier '{0}' is not valid for this item in C# {1}. Please use language version '{2}' or greater. '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement a non-public member in C# {3}. Please use language version '{4}' or greater. Interface member '{0}' does not have a most specific implementation. Neither '{1}', nor '{2}' are most specific. '{0}' cannot implement interface member '{1}' in type '{2}' because feature '{3}' is not available in C# {4}. Please use language version '{5}' or greater. Target runtime doesn't support 'protected', 'protected internal', or 'private protected' accessibility for a member of an interface. Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. The switch expression does not handle some null inputs (it is not exhaustive). For example, the pattern '{0}' is not covered. The switch expression does not handle some null inputs. The switch expression does not handle some null inputs (it is not exhaustive). For example, the pattern '{0}' is not covered. However, a pattern with a 'when' clause might successfully match this value. The switch expression does not handle some null inputs. Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations. obsolete on property accessor The EnumeratorCancellationAttribute applied to parameter '{0}' will have no effect. The attribute is only effective on a parameter of type CancellationToken in an async-iterator method returning IAsyncEnumerable The EnumeratorCancellationAttribute will have no effect. The attribute is only effective on a parameter of type CancellationToken in an async-iterator method returning IAsyncEnumerable Async-iterator '{0}' has one or more parameters of type 'CancellationToken' but none of them is decorated with the 'EnumeratorCancellation' attribute, so the cancellation token parameter from the generated 'IAsyncEnumerable<>.GetAsyncEnumerator' will be un ... Async-iterator member has one or more parameters of type 'CancellationToken' but none of them is decorated with the 'EnumeratorCancellation' attribute, so the cancellation token parameter from the generated 'IAsyncEnumerable<>.GetAsyncEnumerator' will be u ... The attribute [EnumeratorCancellation] cannot be used on multiple parameters Method '{0}' specifies a 'class' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is not a reference type. Method '{0}' specifies a 'struct' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is not a non-nullable value type. Method '{0}' specifies a 'default' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is constrained to a reference type or a value type. The 'default' constraint is valid on override and explicit interface implementation methods only. constraints for override and explicit interface implementation methods Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}' Partial method declarations have inconsistent nullability in constraints for type parameter stackalloc in nested expressions The type '{2}' cannot be used as type parameter '{1}' in the generic type or method '{0}'. Nullability of type argument '{2}' doesn't match 'notnull' constraint. The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint. notnull generic type constraint Duplicate null suppression operator ('!') The 'parameter null-checking' feature is not supported. Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false. Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'. function pointers &method group '{0}' is not a valid calling convention specifier for a function pointer. Type '{0}' is not defined. Type '{0}' must be public to be used as a calling convention. Method '{0}' will not be used as an entry point because a synchronous entry point '{1}' was found. Internal error in the C# compiler. static anonymous function A static anonymous function cannot contain a reference to 'this' or 'base'. A static anonymous function cannot contain a reference to '{0}'. asynchronous using parenthesized pattern or pattern and pattern not pattern type pattern relational pattern Enums, classes, and structures cannot be declared in an interface that has an 'in' or 'out' type parameter. '{0}': extern event cannot have initializer Invocation of implicit Index Indexer cannot name the argument. Invocation of implicit Range Indexer cannot name the argument. The type '{0}' may not be used as the target type of new() Use of new() is not valid in this context There is no target type for '{0}' target-typed object creation An expression tree may not contain a pattern System.Index or System.Range indexer access An expression tree may not contain a from-end index ('^') expression. An expression tree may not contain a range ('..') expression. Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'. {3} Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'. {3} Generator failed to generate source. Generator failed to initialize. records init-only setters The receiver of a `with` expression must have a non-void type. The receiver type '{0}' is not a valid record type and is not a struct type. Init-only property or indexer '{0}' can only be assigned in an object initializer, or on 'this' or 'base' in an instance constructor or an 'init' accessor. A variable may not be declared within a 'not' or 'or' pattern. Relational patterns may not be used for a value of type '{0}'. Relational patterns may not be used for a floating-point NaN. pattern matching ReadOnly/Span<char> on constant string extended partial methods constant interpolated strings Partial method '{0}' must have accessibility modifiers because it has a non-void return type. Partial method '{0}' must have accessibility modifiers because it has 'out' parameters. Partial method '{0}' must have an implementation part because it has accessibility modifiers. Partial method '{0}' must have accessibility modifiers because it has a 'virtual', 'override', 'sealed', 'new', or 'extern' modifier. Both partial member declarations must have identical accessibility modifiers. Both partial member declarations must have identical combinations of 'virtual', 'override', 'sealed', and 'new' modifiers. Both partial method declarations must have the same return type. Partial member declarations must have matching ref return values. Partial method declarations '{0}' and '{1}' have signature differences. Partial method declarations have signature differences. top-level statements Cannot use local variable or local function '{0}' declared in a top-level statement in this context. Only one compilation unit can have top-level statements. Top-level statements must precede namespace and type declarations. Cannot specify /main if there is a compilation unit with top-level statements. Program using top-level statements must be an executable. '{0}' is not a valid function pointer return type modifier. Valid modifiers are 'ref' and 'ref readonly'. A return type can only have one '{0}' modifier. '{0}' cannot be used as a modifier on a function pointer parameter. Function pointer '{0}' does not take {1} arguments No overload for '{0}' matches function pointer '{1}' Ref mismatch between '{0}' and function pointer '{1}' Cannot create a function pointer for '{0}' because it is not a static method '&' on method groups cannot be used in expression trees Calling convention of '{0}' is not compatible with '{1}'. Cannot convert method group to function pointer (Are you missing a '&'?) Cannot use an extension method with a receiver as the target of a '&' operator. The type of a local declared in a fixed statement cannot be a function pointer type. The calling convention of '{0}' is not supported by the language. The target runtime doesn't support extensible or runtime-environment default calling conventions. Given {0} parameter types and {1} parameter ref kinds. These arrays must have the same length. 'RefKind.Out' is not a valid ref kind for a return type. Passing '{0}' is not valid unless '{1}' is 'SignatureCallingConvention.Unmanaged'. Cannot use '{0}' as a calling convention modifier. Cannot convert &method group '{0}' to delegate type '{1}'. Cannot convert &method group '{0}' to non-function pointer type '{1}'. 'managed' calling convention cannot be combined with unmanaged calling convention specifiers. Feature '{0}' is not available in C# 9.0. Please use language version {1} or greater. Feature '{0}' is not available in C# 10.0. Please use language version {1} or greater. Feature '{0}' is not available in C# 11.0. Please use language version {1} or greater. Feature '{0}' is not available in C# 12.0. Please use language version {1} or greater. Feature '{0}' is not available in C# 13.0. Please use language version {1} or greater. Unexpected argument list. A constructor declared in a type with parameter list must have 'this' constructor initializer. Only a single partial type declaration may have a parameter list Records may only inherit from object or another record Only records may inherit from records. Record member '{0}' must be a readable instance property or field of type '{1}' to match positional parameter '{2}'. No accessible copy constructor found in base type '{0}'. A copy constructor in a record must call a copy constructor of the base, or a parameterless object constructor if the record inherits from object. target-typed conditional expression Conditional expression is not valid in language version {0} because a common type was not found between '{1}' and '{2}'. To use a target-typed conversion, upgrade to language version {3} or greater. '{0}' does not override expected method from 'object'. covariant returns '{0}': Target runtime doesn't support covariant return types in overrides. Return type must be '{2}' to match overridden member '{1}' '{0}': Target runtime doesn't support covariant types in overrides. Type must be '{2}' to match overridden member '{1}' '{0}' cannot be sealed because containing record is not sealed. '{0}' does not override expected method from '{1}'. Constant value '{0}' may overflow '{1}' at runtime (use 'unchecked' syntax to override) Constant value may overflow at runtime (use 'unchecked' syntax to override) Members named 'Clone' are disallowed in records. Types and aliases should not be named 'record'. Types and aliases should not be named 'record'. '{0}' must allow overriding because the containing record is not sealed. Record member '{0}' must be public. Record member '{0}' must return '{1}'. Record member '{0}' must be protected. '{0}' does not override expected property from '{1}'. Record member '{0}' may not be static. A copy constructor '{0}' must be public or protected because the record is not sealed. Record member '{0}' must be private. Operator '{0}' cannot be used here due to precedence. Use parentheses to disambiguate. Operator cannot be used here due to precedence. module initializers Module initializer method '{0}' must be accessible at the module level Module initializer method '{0}' must be static, and non-virtual, must have no parameters, and must return 'void' Module initializer method '{0}' must not be generic and must not be contained in a generic type A module initializer must be an ordinary member method extension GetAsyncEnumerator extension GetEnumerator 'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract, non-virtual methods or static local functions. '{0}' is not a valid calling convention type for 'UnmanagedCallersOnly'. Cannot use '{0}' as a {1} type on a method attributed with 'UnmanagedCallersOnly'. Methods attributed with 'UnmanagedCallersOnly' cannot have generic type parameters and cannot be declared in a generic type. '{0}' is attributed with 'UnmanagedCallersOnly' and cannot be called directly. Obtain a function pointer to this method. '{0}' is attributed with 'UnmanagedCallersOnly' and cannot be converted to a delegate type. Obtain a function pointer to this method. Application entry points cannot be attributed with 'UnmanagedCallersOnly'. Module initializer cannot be attributed with 'UnmanagedCallersOnly'. '{0}' defines 'Equals' but not 'GetHashCode' Record defines 'Equals' but not 'GetHashCode'. 'init' accessors cannot be marked 'readonly'. Mark '{0}' readonly instead. discards Mixed declarations and expressions in deconstruction record structs with on structs with on anonymous types async method builder override positional fields in records parameterless struct constructors struct field initializers ref fields variance safety for static interface members collection expressions Cannot initialize type '{0}' with a collection expression because the type is not constructible. An expression tree may not contain a collection expression. There is no target type for the collection expression. Could not find an accessible '{0}' method with the expected signature: a static method with a single parameter of type 'ReadOnlySpan<{1}>' and return type '{2}'. '{0}' has a CollectionBuilderAttribute but no element type. Collection expression target '{0}' has no element type. Collection expression type must have an applicable constructor that can be called with no arguments. Collection expression type '{0}' must have an instance or extension method 'Add' that can be called with a single argument. The CollectionBuilderAttribute builder type must be a non-generic class or struct. The CollectionBuilderAttribute method name is invalid. A collection expression of type '{0}' cannot be used in this context because it may be exposed outside of the current scope. Compiling requires binding the lambda expression at least {0} times. Consider declaring the lambda expression with explicit parameter types, or if the containing method call is generic, consider using explicit type arguments. Compiling requires binding the lambda expression many times. Consider declaring the lambda expression with explicit parameter types, or if the containing method call is generic, consider using explicit type arguments. In language version {0}, the 'field' keyword binds to a synthesized backing field for the property. To avoid generating a synthesized backing field, and to refer to the existing member, use 'this.field' or '@field' instead. The 'field' keyword binds to a synthesized backing field for the property. Identifier is a contextual keyword, with a specific meaning, in a later language version. Record equality contract property '{0}' must have a get accessor. The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported. The loaded assembly references .NET Framework, which is not supported. The analyzer assembly '{0}' references version '{1}' of the compiler, which is newer than the currently running version '{2}'. The analyzer assembly references a newer version of the compiler than the currently running version. The type '{0}' may not be used for a field of a record. A function pointer cannot be called with named arguments. file-scoped namespace Source file can only contain one file-scoped namespace declaration. Source file can not contain both file-scoped and normal namespace declarations. File-scoped namespace must precede all other members in a file. Parameter '{0}' is unread. Did you forget to use it to initialize the property with that name? Parameter is unread. Did you forget to use it to initialize the property with that name? instance member in 'nameof' The primary constructor conflicts with the synthesized copy constructor. lambda attributes lambda return type inferred delegate type auto default struct fields The #line directive value is missing or out of range The #line directive end position must be greater than or equal to the start position The #line span directive requires space before the first parenthesis, before the character offset, and before the file name Comparison of function pointers might yield an unexpected result, since pointers to the same function may be distinct. Do not compare function pointer values using type alias Using alias cannot be a 'ref' type. Only a 'using static' or 'using alias' can be 'unsafe'. Using alias cannot be a nullable reference type. Using a function pointer type in this context is not supported. The CallerArgumentExpressionAttribute may only be applied to parameters with default values CallerArgumentExpressionAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}' The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerArgumentExpressionAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerFilePathAttribute The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute. The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerLineNumberAttribute The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerMemberNameAttribute. The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerMemberNameAttribute The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name. The CallerArgumentExpressionAttribute is applied with an invalid parameter name. The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential. The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-refential. sealed ToString in record Inheriting from a record with a sealed 'Object.ToString' is not supported in C# {0}. Please use language version '{1}' or greater. list pattern List patterns may not be used for a value of type '{0}'. List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. The 'scoped' modifier can be used for refs and ref struct values only. The 'scoped' modifier of parameter '{0}' doesn't match overridden or implemented member. The 'scoped' modifier of parameter '{0}' doesn't match overridden or implemented member. The 'scoped' modifier of parameter doesn't match overridden or implemented member. The 'scoped' modifier of parameter '{0}' doesn't match target '{1}'. The 'scoped' modifier of parameter '{0}' doesn't match target '{1}'. The 'scoped' modifier of parameter doesn't match target. The 'scoped' modifier of parameter '{0}' doesn't match partial definition. A fixed field must not be a ref field. A ref field cannot refer to a ref struct. A ref field can only be declared in a ref struct. Auto-implemented property '{0}' is read before being explicitly assigned, causing a preceding implicit assignment of 'default'. Auto-implemented property is read before being explicitly assigned, causing a preceding implicit assignment of 'default'. Field '{0}' is read before being explicitly assigned, causing a preceding implicit assignment of 'default'. Field is read before being explicitly assigned, causing a preceding implicit assignment of 'default'. The 'this' object is read before all of its fields have been assigned, causing preceding implicit assignments of 'default' to non-explicitly assigned fields. The 'this' object is read before all of its fields have been assigned, causing preceding implicit assignments of 'default' to non-explicitly assigned fields. Control is returned to caller before auto-implemented property '{0}' is explicitly assigned, causing a preceding implicit assignment of 'default'. Control is returned to caller before auto-implemented property is explicitly assigned, causing a preceding implicit assignment of 'default'. Control is returned to caller before field '{0}' is explicitly assigned, causing a preceding implicit assignment of 'default'. Control is returned to caller before field is explicitly assigned, causing a preceding implicit assignment of 'default'. Use of possibly unassigned field '{0}'. Consider updating to language version '{1}' to auto-default the field. Use of possibly unassigned auto-implemented property '{0}'. Consider updating to language version '{1}' to auto-default the property. Use of possibly unassigned field '{0}'. Consider updating to language version '{1}' to auto-default the field. Use of possibly unassigned field. Consider updating the language version to auto-default the field. Use of possibly unassigned auto-implemented property '{0}'. Consider updating to language version '{1}' to auto-default the property. Use of possibly unassigned auto-implemented property. Consider updating the language version to auto-default the property. Slice patterns may not be used for a value of type '{0}'. Slice patterns may only be used once and directly inside a list pattern. The positional member '{0}' found corresponding to this parameter is hidden. interpolated string handlers Interpolated string handler method '{0}' is malformed. It does not return 'void' or 'bool'. Interpolated string handler method '{0}' has inconsistent return type. Expected to return '{1}'. Identifier or a simple member access expected. extended property patterns global using directive A global using directive cannot be used in a namespace declaration. A global using directive must precede all non-global using directives. null is not a valid parameter name. To get access to the receiver of an instance method, use the empty string as the parameter name. '{0}' is not an instance method, the receiver cannot be an interpolated string handler argument. '{0}' is not a valid parameter name from '{1}'. '{0}' is not an interpolated string handler type. Parameter '{0}' occurs after '{1}' in the parameter list, but is used as an argument for interpolated string handler conversions. This will require the caller to reorder parameters with named arguments at the call site. Consider putting the interpolated st ... Parameter to interpolated string handler conversion occurs after handler parameter InterpolatedStringHandlerArgumentAttribute arguments cannot refer to the parameter the attribute is used on. The InterpolatedStringHandlerArgumentAttribute applied to parameter '{0}' is malformed and cannot be interpreted. Construct an instance of '{1}' manually. Parameter '{0}' is an argument to the interpolated string handler conversion on parameter '{1}', but the corresponding argument is specified after the interpolated string expression. Reorder the arguments to move '{0}' before '{1}'. Parameter '{0}' is not explicitly provided, but is used as an argument to the interpolated string handler conversion on parameter '{1}'. Specify the value of '{0}' before '{1}'. An expression tree may not contain an interpolated string handler conversion. An interpolated string handler construction cannot use dynamic. Manually construct an instance of '{0}'. The parameterless struct constructor must be 'public'. static abstract members in interfaces Target runtime doesn't support static abstract members in interfaces. The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. The parameter of a unary operator must be the containing type, or its type parameter constrained to it. The parameter type for ++ or -- operator must be the containing type, or its type parameter constrained to it. The return type for ++ or -- operator must either match the parameter type, or be derived from the parameter type, or be the containing type's type parameter constrained to it unless the parameter type is a different type parameter. One of the parameters of a binary operator must be the containing type, or its type parameter constrained to it. The first operand of an overloaded shift operator must have the same type as the containing type or its type parameter constrained to it A static virtual or abstract interface member can be accessed only on a type parameter. An expression tree may not contain an access of static virtual or abstract interface member '{0}' does not implement static interface member '{1}'. '{2}' cannot implement the interface member because it is not static. '{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support static abstract members in interfaces. Explicit implementation of a user-defined operator '{0}' must be declared static User-defined conversion in an interface must convert to or from a type parameter on the enclosing type constrained to the enclosing type 'UnmanagedCallersOnly' method '{0}' cannot implement interface member '{1}' in type '{2}' The using directive for '{0}' appeared previously as global using The using directive appeared previously as global using The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type. At least one top-level statement must be non-empty. Line does not start with the same whitespace as the closing line of the raw string literal. Raw string literals are not allowed in preprocessor directives. Raw string literal delimiter must be on its own line. The raw string literal does not start with enough quote characters to allow this many consecutive quote characters as content. The interpolated raw string literal does not start with enough '$' characters to allow this many consecutive opening braces as content. The interpolated raw string literal does not start with enough '$' characters to allow this many consecutive closing braces as content. Not enough quotes for raw string literal. The interpolation must end with the same number of closing braces as the number of '$' characters that the raw string literal started with. Sequence of '@' characters is not allowed. A verbatim string or identifier can only have one '@' character and a raw string cannot have any. String must start with quote character: " Unterminated raw string literal. raw string literals Multi-line raw string literals are only allowed in verbatim interpolated strings. Multi-line raw string literals must contain at least one line of content. Newlines inside a non-verbatim interpolated string are not supported in C# {0}. Please use language version {1} or greater. generic attributes InterpolatedStringHandlerArgument has no effect when applied to lambda parameters and will be ignored at the call site. InterpolatedStringHandlerArgument has no effect when applied to lambda parameters and will be ignored at the call site. A lambda expression with attributes cannot be converted to an expression tree A constructor declared in a 'struct' with parameter list must have a 'this' initializer that calls the primary constructor or an explicitly declared constructor. A 'struct' with field initializers must include an explicitly declared constructor. A string 'null' constant is not supported as a pattern for '{0}'. Use an empty string instead. The operation may overflow '{0}' at runtime (use 'unchecked' syntax to override) The operation may overflow at runtime (use 'unchecked' syntax to override) Cannot use 'ref', 'in', or 'out' in the signature of a method attributed with 'UnmanagedCallersOnly'. newlines in interpolations Interpolated string handler conversions that reference the instance being indexed cannot be used in indexer member initializers. '{0}' cannot be made nullable. The type name '{0}' only contains lower-cased ascii characters. Such names may become reserved for the language. The type name only contains lower-cased ascii characters. Such names may become reserved for the language. Types and aliases cannot be named 'required'. required members '{0}' must be required because it overrides required member '{1}' Required member '{0}' cannot be hidden by '{1}'. Required member '{0}' cannot be less visible or have a setter less visible than the containing type '{1}'. Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. Required member '{0}' must be settable. Required member '{0}' must be set in the object initializer or attribute constructor. Required member '{0}' must be assigned a value, it cannot use a nested member or collection initializer. The required members list for '{0}' is malformed and cannot be interpreted. The required members list for the base type '{0}' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. Line contains different whitespace than the closing line of the raw string literal: '{0}' versus '{1}' Keyword 'enum' cannot be used as a constraint. Did you mean 'struct, System.Enum'? Keyword 'delegate' cannot be used as a constraint. Did you mean 'System.Delegate'? Unexpected keyword 'record'. Did you mean 'record struct' or 'record class'? checked user-defined operators User-defined operator '{0}' cannot be declared checked An 'implicit' user-defined conversion operator cannot be declared checked The operator '{0}' requires a matching non-checked version of the operator to also be defined The input string cannot be converted into the equivalent UTF-8 byte representation. {0} UTF-8 string literals An expression tree may not contain UTF-8 string conversion or literal. This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. '{2}' cannot satisfy the 'new()' constraint on parameter '{1}' in the generic type or or method '{0}' because '{2}' has required members. File-local type '{0}' cannot be used in a member signature in non-file-local type '{1}'. File-local type '{0}' cannot use accessibility modifiers. File-local type '{0}' cannot be used as a base type of non-file-local type '{1}'. File-local type '{0}' must be defined in a top level type; '{0}' is a nested type. File-local type '{0}' cannot be used because the containing file path cannot be converted into the equivalent UTF-8 byte representation. {1} File-local type '{0}' cannot be used in a 'global using static' directive. Types and aliases cannot be named 'file'. File-local type '{0}' must be declared in a file with a unique path. Path '{1}' is used in multiple files. unsigned right shift relaxed shift operator '{0}' requires compiler feature '{1}', which is not supported by this version of the C# compiler. Required member '{0}' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. Members attributed with 'ObsoleteAttribute' should not be required unless the containing type is obsolete or all constructors are obsolete. Ref returning properties cannot be required. Unexpected keyword 'unchecked' '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. Required members are not allowed on the top level of a script or submission. One of the parameters of an equality, or inequality operator declared in interface '{0}' must be a type parameter on '{0}' constrained to '{0}' Operator '{0}' cannot be applied to operands of type '{1}' and '{2}' that are not UTF-8 byte representations Implicitly typed lambda parameter '{0}' cannot have a default value. Parameter {0} has default value '{1:10}' in lambda but '{2:10}' in the target delegate type. The default parameter value does not match in the target delegate type. file types Cannot use a numeric constant or relational pattern on '{0}' because it inherits from or extends 'INumberBase<T>'. Consider using a type pattern to narrow to a specifc numeric type. array access pointer element access Types and aliases cannot be named 'scoped'. UnscopedRefAttribute cannot be applied to this parameter because it is unscoped by default. UnscopedRefAttribute can only be applied to struct or virtual interface instance methods and properties, and cannot be applied to constructors or init-only members. UnscopedRefAttribute cannot be applied to an interface implementation because implemented member '{0}' doesn't have this attribute. '{0}' is defined in a module with an unrecognized RefSafetyRulesAttribute version, expecting '11'. Target runtime doesn't support ref fields. Do not use 'System.Runtime.CompilerServices.ScopedRefAttribute'. Use the 'scoped' keyword instead. Analyzer reference '{0}' specified multiple times Analyzer reference specified multiple times The namespace '{1}' already contains a definition for '{0}' in this file. UnscopedRefAttribute cannot be applied to parameters that have a 'scoped' modifier. 'readonly' modifier must be specified after 'ref'. The 'scoped' modifier cannot be used with discard. A deconstruction variable cannot be declared as a ref local lambda optional parameters lambda params array Parameter {0} has params modifier in lambda but not in target delegate type. Parameter has params modifier in lambda but not in target delegate type. primary constructors Cannot use primary constructor parameter '{0}' in this context. Identifier '{0}' is ambiguous between type '{1}' and parameter '{2}' in this context. Parameter '{0}' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well. Parameter is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well. Cannot use parameter '{0}' that has ref-like type inside an anonymous method, lambda expression, query expression, or local function Cannot use ref, out, or in primary constructor parameter '{0}' inside an instance member Cannot use primary constructor parameter '{0}' that has ref-like type inside an instance member Anonymous methods, lambda expressions, query expressions, and local functions inside an instance member of a struct cannot access primary constructor parameter Anonymous methods, lambda expressions, query expressions, and local functions inside a struct cannot access primary constructor parameter also used inside an instance member Parameter '{0}' is unread. Parameter is unread. A primary constructor parameter of a readonly type cannot be assigned to (except in init-only setter of the type or a variable initializer) A primary constructor parameter of a readonly type cannot be returned by writable reference A primary constructor parameter of a readonly type cannot be used as a ref or out value (except in init-only setter of the type or a variable initializer) Members of primary constructor parameter '{0}' of a readonly type cannot be modified (except in init-only setter of the type or a variable initializer) Members of primary constructor parameter '{0}' of a readonly type cannot be returned by writable reference Members of primary constructor parameter '{0}' of a readonly type cannot be used as a ref or out value (except in init-only setter of the type or a variable initializer) Cannot return primary constructor parameter '{0}' by reference. Struct primary constructor parameter '{0}' of type '{1}' causes a cycle in the struct layout Unexpected parameter list. The '&' operator should not be used on parameters or local variables in async methods. The '&' operator should not be used on parameters or local variables in async methods. Attribute parameter 'SizeConst' must be specified. Attribute parameter 'SizeConst' must be specified. 'static' modifier must precede 'unsafe' modifier. A switch expression arm does not begin with a 'case' keyword. The 'interceptors' feature is not enabled in this namespace. Add '{0}' to your project. An interceptor cannot be declared in the global namespace. Cannot intercept '{0}' because it is not an invocation of an ordinary member method. Method '{0}' cannot be used as an interceptor because its containing type has type parameters. Method '{0}' must be non-generic or have arity {1} to match '{2}'. Method '{0}' must be non-generic to match '{1}'. Cannot intercept: compilation does not contain a file with path '{0}'. Cannot intercept: compilation does not contain a file with path '{0}'. Did you mean to use path '{1}'? Cannot intercept: Path '{0}' is unmapped. Expected mapped path '{1}'. The given file has '{0}' lines, which is fewer than the provided line number '{1}'. The given line is '{0}' characters long, which is fewer than the provided character number '{1}'. Line and character numbers provided to InterceptsLocationAttribute must be positive. The provided line and character number does not refer to an interceptable method name, but rather to token '{0}'. The provided line and character number does not refer to the start of token '{0}'. Did you mean to use line '{1}' and character '{2}'? Cannot intercept method '{0}' with interceptor '{1}' because the signatures do not match. Intercepting a call to '{0}' with interceptor '{1}', but the signatures do not match. Signatures of interceptable and interceptor methods do not match. An interceptor method must be an ordinary member method. Interceptor must have a 'this' parameter matching parameter '{0}' on '{1}'. Interceptor must not have a 'this' parameter because '{0}' does not have a 'this' parameter. Interceptor cannot have a 'null' file path. Possible method name '{0}' cannot be intercepted because it is not being invoked. Cannot intercept a call in file with path '{0}' because multiple files in the compilation have this path. The indicated call is intercepted multiple times. Cannot intercept call with '{0}' because it is not accessible within '{1}'. Cannot intercept call to '{0}' with '{1}' because of a difference in 'scoped' modifiers or '[UnscopedRef]' attributes. A constant value of type '{0}' is expected Cannot use primary constructor parameter of type '{0}' inside an instance member Nullability of reference types in type of parameter '{0}' doesn't match interceptable method '{1}'. Nullability of reference types in type of parameter doesn't match interceptable method. Nullability of reference types in return type doesn't match interceptable method '{0}'. Nullability of reference types in return type doesn't match interceptable method. A nameof operator cannot be intercepted. An interceptor cannot be marked with 'UnmanagedCallersOnlyAttribute'. '{0}' type is not valid for 'using static'. Only a class, struct, interface, enum, delegate, or namespace can be used. '{0}' is defined in assembly '{1}'. Parameter '{0}' is captured into the state of the enclosing type and its value is also used to initialize a field, property, or event. Parameter is captured into the state of the enclosing type and its value is also used to initialize a field, property, or event. Cannot convert expression to '{0}' because it is not an assignable variable Cannot convert expression to '{0}' because it may not be passed or returned by reference inline arrays Index is outside the bounds of the inline array Inline array length must be greater than 0. Inline array struct must not have explicit layout. Inline array struct must declare one and only one instance field. An expression tree may not contain an inline array access or conversion Target runtime doesn't support inline array types. Elements of an inline array type can be accessed only with a single argument implicitly convertible to 'int', 'System.Index', or 'System.Range'. An inline array access may not have a named argument specifier Primary constructor parameter '{0}' is shadowed by a member from base. Primary constructor parameter is shadowed by a member from base Inline array element field cannot be declared as required, readonly, volatile, or as a fixed size buffer. Inline array indexer will not be used for element access expression. Inline array indexer will not be used for element access expression. Inline array 'Slice' method will not be used for element access expression. Inline array 'Slice' method will not be used for element access expression. Inline array conversion operator will not be used for conversion from expression of the declaring type. Inline array conversion operator will not be used for conversion from expression of the declaring type. 'Inline arrays' language feature is not supported for an inline array type that is not valid as a type argument, or has element type that is not valid as a type argument. 'Inline arrays' language feature is not supported for an inline array type that is not valid as a type argument, or has element type that is not valid as a type argument. foreach statement on an inline array of type '{0}' is not supported ref readonly parameters string escape character Reference kind modifier of parameter '{0}' doesn't match the corresponding parameter '{1}' in overridden or implemented member. Reference kind modifier of parameter doesn't match the corresponding parameter in overridden or implemented member. Reference kind modifier of parameter '{0}' doesn't match the corresponding parameter '{1}' in hidden member. Reference kind modifier of parameter doesn't match the corresponding parameter in hidden member. Reference kind modifier of parameter '{0}' doesn't match the corresponding parameter '{1}' in target. Reference kind modifier of parameter doesn't match the corresponding parameter in target. Ref field '{0}' should be ref-assigned before use. Ref field should be ref-assigned before use. Collection expression of type '{0}' may incur unexpected heap allocations. Consider explicitly creating an array, then converting to '{0}' to make the allocation explicit. Collection expression may incur unexpected heap allocations. Consider explicitly creating an array, then converting to the final type to make the allocation explicit. Collection expression of type '{0}' may incur unexpected heap allocations due to the use of '..' spreads. Consider explicitly creating an array, then converting to '{0}' to make the allocation explicit. Collection expression may incur unexpected heap allocations due to use of '..' spreads. Consider explicitly creating an array, then converting to the final type to make the allocation explicit. Expected interpolated string This version of '{0}' cannot be used with collection expressions. The diagnosticId argument to the 'Experimental' attribute must be a valid identifier implicit indexer initializer A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in 'lock' statement. A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in 'lock' statement. Lock object params collections '{0}' is applicable only with expanded form of non-array params collection which is not supported during dynamic dispatch. Collection initializer results in an infinite chain of instantiations of collection '{0}'. Creation of params collection '{0}' results in an infinite chain of invocation of constructor '{1}'. Method '{0}' cannot be less visible than the member with params collection '{1}'. Constructor '{0}' leaves required member '{1}' uninitialized. An expression tree may not contain an expanded form of non-array params collection parameter. '{0}' does not contain a definition for a suitable instance 'Add' method Non-array params collection type must have an applicable constructor that can be called with no arguments. Modifiers cannot be placed on using declarations Cannot perform a dynamic invocation on an expression with type '{0}'. The data argument to InterceptsLocationAttribute is not in the correct format. Version '{0}' of the interceptors format is not supported. The latest supported version is '1'. Cannot intercept a call in file '{0}' because it is duplicated elsewhere in the compilation. Cannot intercept a call in file '{0}' because a matching file was not found in the compilation. The data argument to InterceptsLocationAttribute refers to an invalid position in file '{0}'. ref and unsafe in async and iterator methods field keyword A 'ref' local cannot be preserved across 'await' or 'yield' boundary. Cannot use 'yield return' in an 'unsafe' block The '&' operator cannot be used on parameters or local variables in iterator methods. ref struct interfaces Target runtime doesn't support by-ref-like generics. 'ref struct' is already specified. The 'allows' constraint clause must be the last constraint specified Cannot allow ref structs for a type parameter known from other constraints to be a class The type '{2}' may not be a ref struct or a type parameter allowing ref structs in order to use it as parameter '{1}' in the generic type or method '{0}' '{0}' cannot implement interface member '{1}' for ref struct '{2}'. A non-virtual instance interface member cannot be accessed on a type parameter that allows ref struct. foreach statement cannot operate on enumerators of type '{0}' because it is a type parameter that allows ref struct and it is not known at compile time to implement IDisposable. Partial property '{0}' must have an implementation part. Partial property '{0}' must have a definition part. A partial property may not have multiple defining declarations, and cannot be an auto-property. A partial property may not have multiple implementing declarations Property accessor '{0}' must be implemented because it is declared on the definition part Property accessor '{0}' does not implement any accessor declared on the definition part Property accessor '{0}' must be '{1}' to match the definition part Both partial property declarations must have the same type. Partial property declarations '{0}' and '{1}' have signature differences. Partial property declarations have signature differences. Both partial property declarations must be required or neither may be required A partial property cannot have an initializer on both the definition and implementation. allows ref struct constraint Cannot use 'OverloadResolutionPriorityAttribute' on an overriding member. Cannot use 'OverloadResolutionPriorityAttribute' on this member. overload resolution priority Attribute 'System.Runtime.CompilerServices.InlineArray' cannot be applied to a record struct. Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier, or declaring the {0} as nullable, or adding '[field: MaybeNull, AllowNull]' attributes. Non-nullable property must contain a non-null value when exiting constructor. Consider adding the 'required' modifier, or declaring the property as nullable, or adding '[field: MaybeNull, AllowNull]' attributes. DiagnosticAnalyzer for C# compiler's syntax/semantic/compilation diagnostics. Determines if is of a specified kind. The source token. The syntax kind to test for. if the token is of the specified kind; otherwise, . Determines if is of a specified kind. The source trivia. The syntax kind to test for. if the trivia is of the specified kind; otherwise, . Determines if is of a specified kind. The source node. The syntax kind to test for. if the node is of the specified kind; otherwise, . Determines if is of a specified kind. The source node or token. The syntax kind to test for. if the node or token is of the specified kind; otherwise, . Returns the index of the first node of a specified kind in the node list. Node list. The to find. Returns non-negative index if the list contains a node which matches , -1 otherwise. True if the list has at least one node of the specified kind. Returns the index of the first node of a specified kind in the node list. Node list. The to find. Returns non-negative index if the list contains a node which matches , -1 otherwise. True if the list has at least one node of the specified kind. Returns the index of the first trivia of a specified kind in the trivia list. Trivia list. The to find. Returns non-negative index if the list contains a trivia which matches , -1 otherwise. True if the list has at least one trivia of the specified kind. Returns the index of the first token of a specified kind in the token list. Token list. The to find. Returns non-negative index if the list contains a token which matches , -1 otherwise. Tests whether a list contains a token of a particular kind. The to test for. Returns true if the list contains a token which matches An array of child bound nodes. Note that any of the child nodes may be null.