Microsoft.CodeAnalysis
Represents a non source code file.
Path to the file.
Returns a with the contents of this file, or null if
there were errors reading the file.
Errors encountered when trying to read the additional file. Always empty if
has not been called.
If is set, then will be null.
The only arity in that case will be encoded in the symbol.
This is base class for a bag used to accumulate information while binding is performed.
Including diagnostic messages and dependencies in the form of "used" assemblies.
An information that should be reported at a call site of a symbol.
Diagnostic info that should be reported at the use site of the symbol, or null if there is none.
When not-null, this is primary dependency of the use-site, usually the assembly defining the used symbol.
Never a core library. Usually it is not included into the .
Null if is an error.
The set of other assemblies the use site will depend upon, excluding a core library.
Empty if is an error.
A helper used to combine information from multiple s related to the same
use site.
A helper used to efficiently cache in the symbol.
Either
- null (meaning no diagnostic info and dependencies), or
- a , or
- dependencies as a , or
- a tuple of a and a .
Atomically initializes the cache with the given value if it is currently fully default.
This will not initialize .
Diagnostic info that should be reported at the use site of the symbol, or null if there is none.
The set of assemblies the use site will depend upon, excluding assembly for core library.
Empty or null if is an error.
Case-insensitive operations (mostly comparison) on unicode strings.
ToLower implements the Unicode lowercase mapping
as described in ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt.
VB uses these mappings for case-insensitive comparison.
If is upper case, then this returns its Unicode lower case equivalent. Otherwise, is returned unmodified.
This class seeks to perform the lowercase Unicode case mapping.
Returns a StringComparer that compares strings according to Unicode rules for case-insensitive
identifier comparison (lower-case mapping).
These are also the rules used for VB identifier comparison.
Returns a StringComparer that compares strings according to Unicode rules for case-insensitive
identifier comparison (lower-case mapping).
These are also the rules used for VB identifier comparison.
Determines if two strings are equal according to Unicode rules for case-insensitive
identifier comparison (lower-case mapping).
First identifier to compare
Second identifier to compare
true if the identifiers should be considered the same.
These are also the rules used for VB identifier comparison.
Determines if two strings are equal according to Unicode rules for case-insensitive
identifier comparison (lower-case mapping).
First identifier to compare
Second identifier to compare
true if the identifiers should be considered the same.
These are also the rules used for VB identifier comparison.
Determines if the string 'value' end with string 'possibleEnd'.
Determines if the string 'value' starts with string 'possibleStart'.
Compares two strings according to the Unicode rules for case-insensitive
identifier comparison (lower-case mapping).
First identifier to compare
Second identifier to compare
-1 if < , 1 if > , 0 if they are equal.
These are also the rules used for VB identifier comparison.
Compares two strings according to the Unicode rules for case-insensitive
identifier comparison (lower-case mapping).
First identifier to compare
Second identifier to compare
-1 if < , 1 if > , 0 if they are equal.
These are also the rules used for VB identifier comparison.
Gets a case-insensitive hash code for Unicode identifiers.
identifier to get the hash code for
The hash code for the given identifier
These are also the rules used for VB identifier comparison.
Convert a string to lower case per Unicode
In-place convert string in StringBuilder to lower case per Unicode rules
Constructs and caches already created pseudo-methods.
Every compiled module is supposed to have one of this, created lazily
(multidimensional arrays are not common).
Acquires an array constructor for a given array type
Acquires an element getter method for a given array type
Acquires an element setter method for a given array type
Acquires an element referencer method for a given array type
Maps {array type, method kind} tuples to implementing pseudo-methods.
lazily fetches or creates a new array method.
"newobj ArrayConstructor" is equivalent of "newarr ElementType"
when working with multidimensional arrays
"call ArrayGet" is equivalent of "ldelem ElementType"
when working with multidimensional arrays
"call ArrayAddress" is equivalent of "ldelema ElementType"
when working with multidimensional arrays
"call ArraySet" is equivalent of "stelem ElementType"
when working with multidimensional arrays
Represents a parameter in an array pseudo-method.
NOTE: It appears that only number of indices is used for verification,
types just have to be Int32.
Even though actual arguments can be native ints.
Represents the "value" parameter of the Set pseudo-method.
NOTE: unlike index parameters, type of the value parameter must match
the actual element type.
Base of all array methods. They have a lot in common.
Identifies a specific await within a set of awaits generated for a syntax node.
If multiple await expressions are produced for the same syntax node EnC needs to know how they map to specific async calls.
For example, `await foreach` generates two awaits -- one for MoveNextAsync ( is 0)
and the other for DisposeAsync ( is 1).
Identifies a specific await within a set of awaits generated for a syntax node.
If multiple await expressions are produced for the same syntax node EnC needs to know how they map to specific async calls.
For example, `await foreach` generates two awaits -- one for MoveNextAsync ( is 0)
and the other for DisposeAsync ( is 1).
Block is not reachable or reachability analysis
has not been performed.
Block can be reached either falling through
from previous block or from branch.
Block is reachable from try or catch but
finally prevents falling through.
Returns true if this block has a branch label
and is not a "nop" branch.
Instructions that are not branches.
The block contains only the final branch or nothing at all
Updates position of the current block to account for shorter sizes of previous blocks.
If possible, changes the branch code of the current block to the short version and
updates the delta correspondingly.
Position delta created by previous block size reductions.
replaces branches with more compact code if possible.
* same branch as in the next ===> nop
* branch to the next block ===> nop
* branch to ret block ===> ret
* cond branch over uncond branch ===> flip condition, skip next block
* cond branch to equivalent ===> pop args + nop
Blocks are identical if:
1) have same regular instructions
2) lead to unconditional control transfer (no fall through)
3) branch with the same instruction to the same label
Returns reversed branch operation for the current block.
If no reverse opcode can be obtained Nop is returned.
Abstract Execution state.
If we know something interesting about IL stream we put it here.
Eval stack's high watermark.
Current evaluation stack depth.
Record effects of that currently emitted instruction on the eval stack.
In some cases we have to get a final IL offset during emit phase, for example for
proper emitting sequence points. The problem is that before the builder is realized we
don't know the actual IL offset, but only {block/offset-in-the-block} pair.
Thus, whenever we need to mark some IL position we allocate a new marker id, store it
in and reference this IL marker in the entity requiring the IL offset.
IL markers will be 'materialized' when the builder is realized; the resulting offsets
will be put into array. Note that only markers from reachable blocks
are materialized, the rest will have offset -1.
Realizes method body.
No more data can be added to the builder after this call.
Gets all scopes that contain variables.
Gets all scopes that contain variables.
IL opcodes emitted by this builder.
This includes branch instructions that end blocks except if they are fall-through NOPs.
This count allows compilers to see if emitting a particular statement/expression
actually produced any instructions.
Example: a label will not result in any code so when emitting debugging information
an extra NOP may be needed if we want to decorate the label with sequence point.
Marks blocks that are reachable.
Marks blocks that are recursively reachable from the given block.
If a label points to a block that does nothing other than passing to block X,
replaces target label's block with block X.
Drops blocks that are not reachable
Returns true if any blocks were dropped
Marks all blocks unreachable.
Rewrite any block marked as BlockedByFinally as an "infinite loop".
Matches the code generated by the native compiler in
ILGENREC::AdjustBlockedLeaveTargets.
Returns true if the block has the signature of the special
labeled block that follows a complete try/catch or try/finally.
Returns true if any branches were optimized (that does not include shortening)
We need this because optimizing a branch may result in unreachable code that needs to be eliminated.
=== Example:
x = 1;
if (blah)
{
global = 1;
}
else
{
throw null;
}
return x;
=== rewrites into
push 1;
if (blah)
{
global = 1;
ret;
}
else
{
throw null;
}
// this ret unreachable now!
// even worse - empty stack is assumed thus the ret is illegal.
ret;
Define a sequence point with the given syntax tree and span within it.
Defines a hidden sequence point.
The effect of this is that debugger will not associate following code
with any source (until it sees a lexically following sequence point).
This is used for synthetic code that is reachable through labels.
If such code is not separated from previous sequence point by the means of a hidden sequence point
It looks as a part of the statement that previous sequence point specifies.
As a result, when user steps through the code and goes through a jump to such label,
it will appear as if the jump landed at the beginning of the previous statement.
NOTE: Also inserted as the first statement of a method that would not otherwise have a leading
sequence point so that step-into will find the method body.
Define a hidden sequence point at the first statement of
the method so that step-into will find the method body.
This is called when starting emitting a method for which there is some source.
It is done in case the first sequence point is a hidden point.
Even though hidden points do not have syntax, they need to associate with some document.
Marks the end of filter condition and start of the actual filter handler.
Puts local variable into current scope.
Puts local constant into current scope.
Mark current IL position with a label
Primary method for emitting string switch jump table
switch case labels
fall through label for the jump table
Local holding the value to switch on.
This value has already been loaded onto the execution stack.
Local holding the hash value of the key for emitting
hash table switch. Hash value has already been computed and loaded into keyHash.
This parameter is null if emitting non hash table switch.
Delegate to emit string compare call and conditional branch based on the compare result.
Delegate to compute string hash consistent with value of keyHash.
Primary method for emitting integer switch jump table.
switch case labels
fall through label for the jump table.
Local or parameter holding the value to switch on.
This value has already been loaded onto the execution stack.
Primitive type code of switch key.
Finishes filter condition (and starts actual handler portion of the handler).
Returns the last block of the condition.
Generates code that creates an instance of multidimensional array
Generates code that loads an element of a multidimensional array
Generates code that loads an address of an element of a multidimensional array.
Generates code that stores an element of a multidimensional array.
Contains information about a label.
Sometimes we need to know if a label is targeted by conditional branches.
For example optimizer can do optimizations of branches into outer try scopes only
if they are unconditional (because there are no conditional Leave opcodes)
Used when we see a branch, but label is not yet marked.
Used when label is marked to the code.
Gets all scopes that contain variables.
Returns an ExceptionHandlerRegion for each exception handler clause
beneath the root scope. Each ExceptionHandlerRegion indicates the type
of clause (catch or finally) and the bounds of the try block and clause block.
Base class for IL scopes where a scope contains IL blocks and other nested
scopes. A scope may represent a scope for variable declarations, an exception
handler clause, or an entire exception handler (multiple clauses).
Recursively calculates the start and end of the given scope.
Only scopes with locals are actually dumped to the list.
Recursively calculates the start and end of the given scope.
Only scopes with locals are actually dumped to the list.
Free any basic blocks owned by this scope or sub-scopes.
Class that collects content of the scope (blocks, nested scopes, variables etc).
There is one for every opened scope.
A scope for a single try, catch, or finally clause. If the clause
is a catch clause, ExceptionType will be set.
A scope for an entire exception handler (a try block with either several
catches or a finally block). Unlike other scopes, this scope contains
nested scopes only, no IL blocks (although nested ExceptionHandlerScopes
for the clauses will contain IL blocks).
Compares scopes by their start (ascending) and then size (descending).
Debug information maintained for each closure.
The information is emitted to PDB in Custom Debug Information record for a method containing the closure.
Debug information maintained for each closure.
The information is emitted to PDB in Custom Debug Information record for a method containing the closure.
Unique identification of an emitted entity (method, lambda, closure) used for debugging purposes (EnC).
When used for a synthesized method the ordinal and generation numbers are included its name.
For user defined methods the ordinal is included in Custom Debug Information record attached to the method.
The index of the method in member list of the containing type, or if undefined.
The EnC generation the method was defined in (0 is the baseline build).
These opcodes represent control transfer.
They should not appear inside basic blocks.
Opcodes that represents a branch to a label.
Handles storage of items referenced via tokens in metadata. When items are stored
they are uniquely "associated" with fake tokens, which are basically sequential numbers.
IL gen will use these fake tokens during codegen and later, when actual values
are known, the method bodies will be patched.
To support these two scenarios we need two maps - Item-->uint, and uint-->Item. (The second is really just a list).
Gets a field that may be used to lazily cache an array created to store the specified data.
This is used to cache an array created with the data passed to .
Gets the or corresponding to this token.
Debug information maintained for each lambda.
The information is emitted to PDB in Custom Debug Information record for a method containing the lambda.
The syntax offset of the syntax node declaring the lambda (lambda expression) or its body (lambda in a query).
The ordinal of the closure frame the lambda or local function belongs to, or
if the lambda is static, or
if the lambda is closed over "this" pointer only.
We need a CCI representation for local constants because they are emitted as locals in
PDB scopes to improve the debugging experience (see LocalScopeProvider.GetConstantsInScope).
Id that associates an emitted user-defined or long-lived synthesized local variable
with a syntax node that defined it. If a syntax node defines multiple variables it
provides information necessary to identify which one of these variables is it.
We calculate a "syntax offset" for each user-defined and long-lived synthesized variable.
Every such variable symbol has to be associated with a syntax node (its declarator).
In usual cases this is the textual distance of the declarator from the start of the method body.
It gets a bit complicated when the containing method body is not contiguous (constructors).
If the variable is in the body of the constructor the definition of syntax offset is the same.
If the variable is defined in a constructor initializer or in a member initializer
(this is only possible when declaration expressions or closures in primary constructors are involved)
then the distance is a negative sum of the widths of all the initializers that succeed the declarator
of the variable in the emitted constructor body plus the relative offset of the declarator from
the start of the containing initializer.
If a single node is a declarator for multiple variables of the same synthesized kind (it can only happen for synthesized variables)
we calculate additional number "ordinal" for such variable. We assign the ordinals to the synthesized variables with the same kind
and syntax offset in the order as they appear in the lowered bound tree. It is important that a valid EnC edit can't change
the ordinal of a synthesized variable. If it could it would need to be assigned a different kind or associated with a different declarator node.
.
Creates a new LocalDefinition.
Local symbol, used by edit and continue only, null otherwise.
Name associated with the slot.
Type associated with the slot.
Slot position in the signature.
Local kind.
Local id.
Value to emit in the attributes field in the PDB.
Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.
The synthesized dynamic attributes of the local.
Tuple element names of the local.
At this level there are two kinds of local variables:
-
Locals - have identities by which consuming code refers to them.
Typical use is a local variable or a compiler generated temp that can be accessed in multiple operations.
Any object can be used as identity. Reference equality is used.
-
Temps - do not have identity. They are borrowed and returned to the free list.
Typical use is a scratch temporary or spilling storage.
Structure that represents a local signature (as in ECMA-335, Partition I, ยง8.6.1.3 Local signatures).
Retrieve a local slot by its symbol.
Release a local slot by its symbol.
Slot is not associated with symbol after this.
Gets a local slot.
Frees a local slot.
An expression that creates an array instance in metadata. Only for use in custom attributes.
An expression that represents a (name, value) pair and that is typically used in method calls, custom attributes and object initializers.
The name of the parameter or property or field that corresponds to the argument.
The value of the argument.
True if the named argument provides the value of a field.
An expression that results in a System.Type instance.
The type that will be represented by the System.Type instance.
Holds on to the method body data.
This is a list of the using directives that were in scope for this method body.
Ordered by .
True if there's a stackalloc somewhere in the method.
This class represents the PermissionSetAttribute specified in source which needs 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 at ndp\clr\src\vm\securityattributes.cpp.
It involves following steps:
1) Verifying that the specified file name resolves to a valid path: This is done during binding.
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 (see method ).
4) Replacing the 'File = fileName' named argument with 'Hex = hexFileContent' argument, where hexFileContent is the converted output from step 3) above.
Zero or more positional arguments for the attribute constructor.
A reference to the constructor that will be used to instantiate this custom attribute during execution (if the attribute is inspected via Reflection).
Zero or more named arguments that specify values for fields and properties of the attribute.
The number of positional arguments.
The number of named arguments.
The type of the attribute. For example System.AttributeUsageAttribute.
Exception class to enable generating ERR_PermissionSetAttributeFileReadError while reading the file for PermissionSetAttribute fixup.
TypeDefinition that represents <PrivateImplementationDetails> class.
The main purpose of this class so far is to contain mapped fields and their types.
Gets a field that can be used to cache an array allocated to store data from a corresponding call.
The data that will be used to initialize the field.
The type of the field, e.g. int[].
The emit context to use with the array type to extract its element type.
The field to use to cache an array for this data and alignment.
Gets a field that can be used to to store data directly in an RVA field.
The data for the field.
The alignment value is the necessary alignment for addresses for the underlying element type of the array.
The data is stored by using a type whose size is equal to the total size of the blob. If a built-in system
type has an appropriate size and .pack, it can be used. Otherwise, a type is generated of the same size as
the data, and that type needs its .pack set to the alignment required for the underlying data. While that
.pack value isn't required by anything else in the compiler (the compiler always aligns RVA fields at 8-byte
boundaries, which accomodates any element type that's relevant), it is necessary for IL rewriters. Such rewriters
also need to ensure an appropriate alignment is maintained for the RVA field, and while they could also simplify
by choosing a worst-case alignment as does the compiler, they may instead use the .pack value as the alignment
to use for that field, since it's an opaque blob with no other indication as to what kind of data is
stored and what alignment might be required.
The field. This may have been newly created or may be an existing field previously created for the same data and alignment.
Simple struct type with explicit size and no members.
Synthesized by instrumentation.
Synthesized by instrumentation.
Definition of a simple field mapped to a metadata block
Definition of a field for storing an array caching the data from a metadata block or array of constants.
Just a default implementation of a type definition.
Represents a sequence point before translation by #line/ExternalSource directives.
Some features of the compiler (such as anonymous types, pay-as-you-go, NoPIA, ...)
rely on all referenced symbols to go through translate mechanism. Because by default
symbol translator does not translate some of indirectly referenced symbols, such as
type argument, we have to force translation here
This class provides unified implementation for this functionality.
Scope of user-defined variable hoisted to state machine.
Maintains a list of sequence points in a space efficient way. Most of the time sequence points
occur in the same syntax tree, so optimize for that case. Store a sequence point as an offset, and
position in a syntax tree, then translate to CCI format only on demand.
Use a ArrayBuilder{RawSequencePoint} to create.
Create a SequencePointList with the raw sequence points from an ArrayBuilder.
A linked list of instances for each syntax tree is created (almost always of length one).
Get all the sequence points, possibly mapping them using #line/ExternalSource directives, and mapping
file names to debug documents with the given mapping function.
Function that maps file paths to CCI debug documents
where sequence points should be deposited
Represents the combination of an IL offset and a source text span.
A local whose type is represented by a metadata signature instead of a type symbol.
Used when emitting a new version of a method during EnC for variables that are no longer used.
This temp is not interesting to the expression compiler. However, it
may be replaced by an interesting local in a later stage.
Debug information maintained for each state machine.
Facilitates mapping of state machine states from a compilation to the previous one (or to a metadata baseline) during EnC.
The number of the first state that has not been used in any of the previous versions of the state machine,
or null if we are not generating EnC delta.
For 1st generation EnC delta, this is calculated by examining the stored in the baseline metadata.
For subsequent generations, the number is updated to account for newly generated states in that generation.
The number of the first state that has not been used in any of the previous versions of the state machine,
or null if we are not generating EnC delta, or the state machine has no decreasing states.
For 1st generation EnC delta, this is calculated by examining the stored in the baseline metadata.
For subsequent generations, the number is updated to account for newly generated states in that generation.
Class for emitting the switch jump table for switch statements with integral governing type
Switch key for the jump table
Primitive type of the switch key
Fall through label for the jump table
Integral case labels sorted and indexed by their ConstantValue
Degenerate buckets here are buckets with contiguous range of constants
leading to the same label. Like:
case 0:
case 1:
case 2:
case 3:
DoOneThing();
break;
case 4:
case 5:
case 6:
case 7:
DoAnotherThing();
break;
NOTE: A trivial bucket with only one case constant is by definition degenerate.
Try to merge with the nextBucket.
If merge results in a better bucket than two original ones, merge and return true.
Else don't merge and return false.
Switch key for the jump table
Switch case labels
Fall through label for the jump table
Delegate to emit string compare call and conditional branch based on the compare result.
Key to compare
Case constant to compare the key against
Target label to branch to if key = stringConstant
Delegate to compute string hash code.
This piece is language-specific because VB treats "" and null as equal while C# does not.
Delegate to emit string compare call
Delegate to emit string hash
Local storing the key hash value, used for emitting hash table based string switch.
Dispenser of unique ordinals for synthesized variable names that have the same kind and syntax offset.
Handles storage of items referenced via tokens in metadata (strings or Symbols).
When items are stored they are uniquely "associated" with fake token, which is basically
a sequential number.
IL gen will use these fake tokens during codegen and later, when actual token values are known
the method bodies will be patched.
To support these two scenarios we need two maps - Item-->uint, and uint-->Item. (the second is really just a list).
This map supports tokens of type and .
Returns an index of a slot that stores specified hoisted local variable in the previous generation.
Number of slots reserved for hoisted local variables.
Some of the slots might not be used anymore (a variable might have been deleted or its type changed).
Still, new hoisted variables are assigned slots starting with .
Returns true and an index of a slot that stores an awaiter of a specified type in the previous generation, if any.
Number of slots reserved for awaiters.
Some of the slots might not be used anymore (the type of an awaiter might have changed).
Still, new awaiters are assigned slots starting with .
The id of the method, or null if the method wasn't assigned one.
Finds a closure in the previous generation that corresponds to the specified syntax.
Syntax of the closure scope.
Id of the parent closure.
Names of variables hoisted into the closure, or default if the closure is a class.
Id of the closure assigned in the generation that defined the closure.
Not-null if the previous closure is found, but is incompatible with the shape of the closure in the current source.
The previous closure can't be reused (a new one needs to be emitted) and IL bodies of lambdas of the previous closure are updated to throw an exception.
The exception message is specified in .
See LambdaFrame.AssertIsLambdaScopeSyntax for kinds of syntax nodes that represent closures.
Finds a lambda in the previous generation that corresponds to the specified syntax.
Syntax of the lambda or its body.
True if is a lambda body syntax, false if it is a lambda syntax.
The ordinal of the closure the lambda is emitted to.
Id of the lambda assigned in the generation that defined the lambda.
Not-null if the previous lambda is found, but is incompatible with the shape of the lambda in the current source.
The previous lambda can't be reused (a new one needs to be emitted) and the previous lambda IL body is updated to throw an exception.
The exception message is specified in .
State number to be used for next state of the state machine,
or if none of the previous versions of the method was a state machine with an increasing state
True if the state number increases with progress, false if it decreases (e.g. states for iterator try-finally blocks, or iterator states of async iterators).
For a given node associated with entering a state of a state machine in the new compilation,
returns the ordinal of the corresponding state in the previous version of the state machine.
Await expression, await foreach statement, yield return statement, or try block syntax node.
True if there is a corresponding node in the previous code version that matches the given .
First state of an async iterator state machine that is used to resume the machine after yield return.
Initial state is not used to resume state machine that yielded. State numbers decrease as the iterator makes progress.
Initial iterator state of an async iterator.
Distinct from so that DisposeAsync can throw in latter case.
First state of an iterator state machine. State numbers decrease for subsequent finalize states.
First state in async state machine that is used to resume the machine after await.
State numbers increase as the async computation makes progress.
Initial iterator state of an iterator.
First state in iterator state machine that is used to resume the machine after yield return.
Initial state is not used to resume state machine that yielded. State numbers increase as the iterator makes progress.
Maps an array builder to immutable array.
The array to map
The mapping delegate
If the items's length is 0, this will return an empty immutable array
Maps an array builder to immutable array.
The sequence to map
The mapping delegate
The extra input used by mapping delegate
If the items's length is 0, this will return an empty immutable array.
Maps an array builder to immutable array.
The sequence to map
The mapping delegate
The extra input used by mapping delegate
If the items's length is 0, this will return an empty immutable array.
Realizes the OneOrMany and disposes the builder in one operation.
Create BitArray with at least the specified number of bits.
return a bit array with all bits set from index 0 through bitCount-1
Make a copy of a bit array.
Invert all the bits in the vector.
Is the given bit array null?
Modify this bit vector by bitwise AND-ing each element with the other bit vector.
For the purposes of the intersection, any bits beyond the current length will be treated as zeroes.
Return true if any changes were made to the bits of this bit vector.
Modify this bit vector by '|'ing each element with the other bit vector.
True if any bits were set as a result of the union.
The CachingLookup class provides a convenient representation of an ILookup that is based
upon a potentially slow lookup, and caches lookup results so that subsequent lookups are
fast. Internally a ConcurrentDictionary is used to cache lookup results. The client provides
two delegates to perform lookups: One that maps a key to a IEnumerable of values, and one
that provides all keys.
The client must provide an IEqualityComparer used for comparing keys. Failed lookups are
cached, but that has the disadvantage that every different failed lookup will consume a
small amount of extra memory. However, that memory can be reclaimed by forcing a full
population of the cache.
Thread safe.
Create a CachingLookup.
A function that takes a key, and returns an IEnumerable of values that
correspond to that key. If no values correspond, the function may either return null or an empty
IEnumerable.
A function that returns an IEnumerable of all keys that have associated values.
A IEqualityComparer used to compare keys.
Does this key have one or more associated values?
Get the values associated with a key.
Key to look up.
All values associated with key. Returns an empty IEnumerable if
no values are associated. Never returns null.
Get the number of distinct keys.
Forces a full population of the cache.
Enumerate all the keys.
Forces a full population of the cache.
Add the values from all keys to a flat array.
Forces a full population of the cache.
Create an instance of the concurrent dictionary.
The concurrent dictionary
Create a dictionary instance suitable for use as the fully populated map.
A new, empty dictionary, suitable for use as the fully populated map.
Use the underlying (possibly slow) functions to get the values associated with a key.
Add a new value with the given key to the given concurrent map.
The concurrent map to augment.
The key of the new entry.
The added entry. If there was a race, and another thread beat this one, then this returns the previously added entry.
Determines if the given map is fully populated.
The map to test.
true if the map is fully populated.
Create the fully populated map from an existing map and the key generator.
The existing map which may be null or a ConcurrentDictionary.
Fully populate the underlying dictionary. Once this returns, the dictionary is guaranteed
to have every key in it.
A MultiDictionary that allows only adding, and preserves the order of values added to the
dictionary. Thread-safe for reading, but not for adding.
Always uses the default comparer.
Add a value to the dictionary.
Get all values associated with K, in the order they were added.
Returns empty read-only array if no values were present.
Get a collection of all the keys.
Each value is either a single V or an .
Never null.
A set of ints that is small, thread-safe and lock free.
Several assumptions have been made that allow it to be small and fast:
1. Deletes never happen.
2. The size is small. In dogfooding experiments, 89% had 4 or fewer elements and
98% had 8 or fewer elements. The largest size was 17.
3. As a result of assumption 2, linear look-up is good enough.
4. One value, in this case int.MinValue, is used as a sentinel and may never appear in the set.
Determine if the given integer appears in the set.
The value to look up.
true if appears in the set. false otherwise.
Insert the given value into the set.
The value to insert
true if was added. false if it was already present.
If the given slot is unoccupied, then try to replace it with a new value.
The slot to examine.
The new value to insert if the slot is unoccupied.
An out param indicating whether the slot was successfully updated.
true if the value in the slot either now contains, or already contained . false otherwise.
Provides methods for creating a segmented dictionary that is immutable; meaning it cannot be changed once it is
created.
Represents a segmented dictionary that is immutable; meaning it cannot be changed once it is created.
There are different scenarios best for and others
best for .
In general, is applicable in scenarios most like
the scenarios where is applicable, and
is applicable in scenarios most like the scenarios where
is applicable.
The following table summarizes the performance characteristics of
:
-
Operation
Complexity
Complexity
Comments
-
Item
O(1)
O(log n)
Directly index into the underlying segmented dictionary
-
Add()
O(n)
O(log n)
Requires creating a new segmented dictionary
This type is backed by segmented arrays to avoid using the Large Object Heap without impacting algorithmic
complexity.
The type of the keys in the dictionary.
The type of the values in the dictionary.
This type has a documented contract of being exactly one reference-type field in size. Our own
class depends on it, as well as others externally.
IMPORTANT NOTICE FOR MAINTAINERS AND REVIEWERS:
This type should be thread-safe. As a struct, it cannot protect its own fields from being changed from one
thread while its members are executing on other threads because structs can change in place simply by
reassigning the field containing this struct. Therefore it is extremely important that โ โ Every member
should only dereference this ONCE โ โ . If a member needs to reference the
field, that counts as a dereference of this. Calling other instance members
(properties or methods) also counts as dereferencing this. Any member that needs to use this more
than once must instead assign this to a local variable and use that for the rest of the code instead.
This effectively copies the one field in the struct to a local variable so that it is insulated from other
threads.
Private helper class for use only by .
The private builder implementation.
The return value from the implementation of is
. This is the return value for most instances of this
enumerator.
The return value from the implementation of is
. This is the return value for instances of this
enumerator created by the implementation in
.
Private helper class for use only by and
.
The immutable collection this builder is based on.
The current mutable collection this builder is operating on. This field is initialized to a copy of
the first time a change is made.
Represents a segmented hash set that is immutable; meaning it cannot be changed once it is created.
There are different scenarios best for and others
best for .
The following table summarizes the performance characteristics of
:
-
Operation
Complexity
Complexity
Comments
-
Contains
O(1)
O(log n)
Directly index into the underlying segmented list
-
Add()
O(n)
O(log n)
Requires creating a new segmented hash set and cloning all impacted segments
This type is backed by segmented arrays to avoid using the Large Object Heap without impacting algorithmic
complexity.
The type of the value in the set.
This type has a documented contract of being exactly one reference-type field in size. Our own
class depends on it, as well as others externally.
IMPORTANT NOTICE FOR MAINTAINERS AND REVIEWERS:
This type should be thread-safe. As a struct, it cannot protect its own fields from being changed from one
thread while its members are executing on other threads because structs can change in place simply by
reassigning the field containing this struct. Therefore it is extremely important that โ โ Every member
should only dereference this ONCE โ โ . If a member needs to reference the
field, that counts as a dereference of this. Calling other instance members
(properties or methods) also counts as dereferencing this. Any member that needs to use this more
than once must instead assign this to a local variable and use that for the rest of the code instead.
This effectively copies the one field in the struct to a local variable so that it is insulated from other
threads.
The private builder implementation.
Private helper class for use only by and
.
The immutable collection this builder is based on.
The current mutable collection this builder is operating on. This field is initialized to a copy of
the first time a change is made.
Represents a segmented list that is immutable; meaning it cannot be changed once it is created.
There are different scenarios best for and others
best for .
The following table summarizes the performance characteristics of
:
-
Operation
Complexity
Complexity
Comments
-
Item
O(1)
O(log n)
Directly index into the underlying segmented list
-
Add()
Currently O(n), but could be O(1) with a relatively large constant
O(log n)
Currently requires creating a new segmented list, but could be modified to only clone the segments with changes
-
Insert()
O(n)
O(log n)
Requires creating a new segmented list and cloning all impacted segments
This type is backed by segmented arrays to avoid using the Large Object Heap without impacting algorithmic
complexity.
The type of the value in the list.
This type has a documented contract of being exactly one reference-type field in size. Our own
class depends on it, as well as others externally.
IMPORTANT NOTICE FOR MAINTAINERS AND REVIEWERS:
This type should be thread-safe. As a struct, it cannot protect its own fields from being changed from one
thread while its members are executing on other threads because structs can change in place simply by
reassigning the field containing this struct. Therefore it is extremely important that โ โ Every member
should only dereference this ONCE โ โ . If a member needs to reference the
field, that counts as a dereference of this. Calling other instance members
(properties or methods) also counts as dereferencing this. Any member that needs to use this more
than once must instead assign this to a local variable and use that for the rest of the code instead.
This effectively copies the one field in the struct to a local variable so that it is insulated from other
threads.
The private builder implementation.
Private helper class for use only by and
.
The immutable collection this builder is based on.
The current mutable collection this builder is operating on. This field is initialized to a copy of
the first time a change is made.
Swaps the values in the two references if the first is greater than the second.
Swaps the values in the two references, regardless of whether the two references are the same.
Helper methods for use in array/span sorting routines.
Returns the integer (floor) log of the specified value, base 2.
Note that by convention, input value 0 returns 0 since Log(0) is undefined.
Does not directly use any hardware intrinsics, nor does it incur branching.
The value.
How many ints must be allocated to represent n bits. Returns (n+31)/32, but avoids overflow.
Returns approximate reciprocal of the divisor: ceil(2**64 / divisor).
This should only be used on 64-bit.
Performs a mod operation using the multiplier pre-computed with .
PERF: This improves performance in 64-bit scenarios at the expense of performance in 32-bit scenarios. Since
we only build a single AnyCPU binary, we opt for improved performance in the 64-bit scenario.
Provides static methods to invoke members on value types that explicitly implement the
member.
Normally, invocation of explicit interface members requires boxing or copying the value type, which is
especially problematic for operations that mutate the value. Invocation through these helpers behaves like a
normal call to an implicitly implemented member.
Provides static methods to invoke members on value types that explicitly implement
the member.
Normally, invocation of explicit interface members requires boxing or copying the value type, which is
especially problematic for operations that mutate the value. Invocation through these helpers behaves like a
normal call to an implicitly implemented member.
Provides static methods to invoke members on value types that explicitly implement the
member.
Normally, invocation of explicit interface members requires boxing or copying the value type, which is
especially problematic for operations that mutate the value. Invocation through these helpers behaves like a
normal call to an implicitly implemented member.
Provides static methods to invoke members on value types that explicitly implement the
member.
Normally, invocation of explicit interface members requires boxing or copying the value type, which is
especially problematic for operations that mutate the value. Invocation through these helpers behaves like a
normal call to an implicitly implemented member.
Provides static methods to invoke members on value types that explicitly implement
the member.
Normally, invocation of explicit interface members requires boxing or copying the value type, which is
especially problematic for operations that mutate the value. Invocation through these helpers behaves like a
normal call to an implicitly implemented member.
Provides static methods to invoke members on value types that explicitly implement the
member.
Normally, invocation of explicit interface members requires boxing or copying the value type, which is
especially problematic for operations that mutate the value. Invocation through these helpers behaves like a
normal call to an implicitly implemented member.
Used internally to control behavior of insertion into a or .
The default insertion behavior.
Specifies that an existing entry with the same key should be overwritten if encountered.
Specifies that if an existing entry with the same key is encountered, an exception should be thrown.
Returns a by-ref to type that is a null reference.
Returns if a given by-ref to type is a null reference.
This check is conceptually similar to (void*)(&source) == nullptr.
Calculates the maximum number of elements of size which can fit into an array
which has the following characteristics:
- The array can be allocated in the small object heap.
- The array length is a power of 2.
The size of the elements in the array.
The segment size to use for small object heap segmented arrays.
Calculates a shift which can be applied to an absolute index to get the page index within a segmented array.
The number of elements in each page of the segmented array. Must be a power of 2.
The shift to apply to the absolute index to get the page index within a segmented array.
Calculates a mask, which can be applied to an absolute index to get the index within a page of a segmented
array.
The number of elements in each page of the segmented array. Must be a power of 2.
The bit mask to obtain the index within a page from an absolute index within a segmented array.
Equality comparer for hashsets of hashsets
Destination array is not long enough to copy all the items in the collection. Check array index and length.
Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.
The given key '{0}' was not present in the dictionary.
Destination array was not long enough. Check the destination index, length, and the array's lower bounds.
Source array was not long enough. Check the source index, length, and the array's lower bounds.
The lower bound of target array must be zero.
Only single dimensional arrays are supported for the requested action.
The value "{0}" is not of type "{1}" and cannot be used in this generic collection.
An item with the same key has already been added. Key: {0}
Target array type is not compatible with the type of items in the collection.
Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
Number was less than the array's lower bound in the first dimension.
Larger than collection size.
Count must be positive and count must refer to a location within the string/array/collection.
Index was out of range. Must be non-negative and less than the size of the collection.
Index must be within the bounds of the List.
Non-negative number required.
capacity was less than the current size.
Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Collection was modified; enumeration operation may not execute.
Enumeration has either not started or has already finished.
Failed to compare two elements in the array.
Mutating a key collection derived from a dictionary is not allowed.
Mutating a value collection derived from a dictionary is not allowed.
The specified arrays must have the same number of dimensions.
Collection was of a fixed size.
Object is not a array with the same number of elements as the array to compare it to.
Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.
Cannot find the old value
Index was out of range. Must be non-negative and less than or equal to the size of the collection.
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation
function. The transformation is retried as many times as necessary to win the optimistic locking race.
The type of value stored by the list.
The variable or field to be changed, which may be accessed by multiple threads.
A function that mutates the value. This function should be side-effect free,
as it may run multiple times when races occur with other threads.
if the location's value is changed by applying the result of the
function; otherwise, if the location's value remained
the same because the last invocation of returned the existing value.
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation
function. The transformation is retried as many times as necessary to win the optimistic locking race.
The type of value stored by the list.
The type of argument passed to the .
The variable or field to be changed, which may be accessed by multiple threads.
A function that mutates the value. This function should be side-effect free, as it may run multiple times
when races occur with other threads.
The argument to pass to .
if the location's value is changed by applying the result of the
function; otherwise, if the location's value remained
the same because the last invocation of returned the existing value.
Assigns a field or variable containing an immutable list to the specified value and returns the previous
value.
The type of value stored by the list.
The field or local variable to change.
The new value to assign.
The prior value at the specified .
Assigns a field or variable containing an immutable list to the specified value if it is currently equal to
another specified value. Returns the previous value.
The type of value stored by the list.
The field or local variable to change.
The new value to assign.
The value to check equality for before assigning.
The prior value at the specified .
Assigns a field or variable containing an immutable list to the specified value if it is has not yet been
initialized.
The type of value stored by the list.
The field or local variable to change.
The new value to assign.
if the field was assigned the specified value; otherwise,
if it was previously initialized.
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation
function. The transformation is retried as many times as necessary to win the optimistic locking race.
The type of value stored by the set.
The variable or field to be changed, which may be accessed by multiple threads.
A function that mutates the value. This function should be side-effect free,
as it may run multiple times when races occur with other threads.
if the location's value is changed by applying the result of the
function; otherwise, if the location's value remained
the same because the last invocation of returned the existing value.
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation
function. The transformation is retried as many times as necessary to win the optimistic locking race.
The type of value stored by the set.
The type of argument passed to the .
The variable or field to be changed, which may be accessed by multiple threads.
A function that mutates the value. This function should be side-effect free, as it may run multiple times
when races occur with other threads.
The argument to pass to .
if the location's value is changed by applying the result of the
function; otherwise, if the location's value remained
the same because the last invocation of returned the existing value.
Assigns a field or variable containing an immutable set to the specified value and returns the
previous value.
The type of value stored by the set.
The field or local variable to change.
The new value to assign.
The prior value at the specified .
Assigns a field or variable containing an immutable set to the specified value if it is currently
equal to another specified value. Returns the previous value.
The type of value stored by the set.
The field or local variable to change.
The new value to assign.
The value to check equality for before assigning.
The prior value at the specified .
Assigns a field or variable containing an immutable set to the specified value if it is has not yet
been initialized.
The type of value stored by the set.
The field or local variable to change.
The new value to assign.
if the field was assigned the specified value; otherwise,
if it was previously initialized.
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation
function. The transformation is retried as many times as necessary to win the optimistic locking race.
The type of key stored by the dictionary.
The type of value stored by the dictionary.
The variable or field to be changed, which may be accessed by multiple threads.
A function that mutates the value. This function should be side-effect free,
as it may run multiple times when races occur with other threads.
if the location's value is changed by applying the result of the
function; otherwise, if the location's value remained
the same because the last invocation of returned the existing value.
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation
function. The transformation is retried as many times as necessary to win the optimistic locking race.
The type of key stored by the dictionary.
The type of value stored by the dictionary.
The type of argument passed to the .
The variable or field to be changed, which may be accessed by multiple threads.
A function that mutates the value. This function should be side-effect free, as it may run multiple times
when races occur with other threads.
The argument to pass to .
if the location's value is changed by applying the result of the
function; otherwise, if the location's value remained
the same because the last invocation of returned the existing value.
Assigns a field or variable containing an immutable dictionary to the specified value and returns the
previous value.
The type of key stored by the dictionary.
The type of value stored by the dictionary.
The field or local variable to change.
The new value to assign.
The prior value at the specified .
Assigns a field or variable containing an immutable dictionary to the specified value if it is currently
equal to another specified value. Returns the previous value.
The type of key stored by the dictionary.
The type of value stored by the dictionary.
The field or local variable to change.
The new value to assign.
The value to check equality for before assigning.
The prior value at the specified .
Assigns a field or variable containing an immutable dictionary to the specified value if it is has not yet
been initialized.
The type of key stored by the dictionary.
The type of value stored by the dictionary.
The field or local variable to change.
The new value to assign.
if the field was assigned the specified value; otherwise,
if it was previously initialized.
Defines a fixed-size collection with the same API surface and behavior as an "SZArray", which is a
single-dimensional zero-based array commonly represented in C# as T[]. The implementation of this
collection uses segmented arrays to avoid placing objects on the Large Object Heap.
The type of elements stored in the array.
Private helper class for use only by .
The number of elements in each page of the segmented array of type .
The segment size is calculated according to , performs the IL operation
defined by . ECMA-335 defines this operation with the following note:
sizeof returns the total size that would be occupied by each element in an array of this type โ
including any padding the implementation chooses to add. Specifically, array elements lie sizeof
bytes apart.
The bit shift to apply to an array index to get the page index within .
The bit mask to apply to an array index to get the index within a page of .
An unsafe class that provides a set of methods to access the underlying data representations of immutable segmented
collections.
Gets the backing storage array for a .
The type of elements stored in the array.
The segmented array.
The backing storage array for the segmented array. Note that replacing segments within the returned
value will invalidate the data structure.
Gets either a ref to a in the or a
ref null if it does not exist in the .
The dictionary to get the ref to from.
The key used for lookup.
The type of the keys in the dictionary.
The type of the values in the dictionary.
Items should not be added or removed from the while the ref
is in use. The ref null can be detected using .
Gets either a read-only ref to a in the
or a ref null if it does not exist in the .
The dictionary to get the ref to from.
The key used for lookup.
The type of the keys in the dictionary.
The type of the values in the dictionary.
The ref null can be detected using .
Gets either a ref to a in the
or a ref null if it does not exist in the .
The dictionary to get the ref to from.
The key used for lookup.
The type of the keys in the dictionary.
The type of the values in the dictionary.
Items should not be added or removed from the
while the ref is in use. The ref null can be detected using
.
Gets an value wrapping the input .
The type of elements in the input segmented list.
The input segmented list to wrap in the returned value.
An value wrapping .
When using this method, callers should take extra care to ensure that they're the sole owners of the input
list, and that it won't be modified once the returned value starts
being used. Doing so might cause undefined behavior in code paths which don't expect the contents of a given
values to change after its creation.
If is , the returned value
will be uninitialized (i.e. its property will be
).
Gets the underlying for an input value.
The type of elements in the input value.
The input value to get the underlying from.
The underlying for , if present; otherwise, .
When using this method, callers should make sure to not pass the resulting underlying list to methods that
might mutate it. Doing so might cause undefined behavior in code paths using which
don't expect the contents of the value to change.
If is uninitialized (i.e. its property is
), the resulting will be .
Gets an value wrapping the input .
The type of elements in the input segmented hash set.
The input segmented hash set to wrap in the returned value.
An value wrapping .
When using this method, callers should take extra care to ensure that they're the sole owners of the input
set, and that it won't be modified once the returned value starts
being used. Doing so might cause undefined behavior in code paths which don't expect the contents of a given
values to change after its creation.
If is , the returned
value will be uninitialized (i.e. its property will be
).
Gets the underlying for an input value.
The type of elements in the input value.
The input value to get the underlying from.
The underlying for , if present; otherwise, .
When using this method, callers should make sure to not pass the resulting underlying hash set to methods that
might mutate it. Doing so might cause undefined behavior in code paths using which
don't expect the contents of the value to change.
If is uninitialized (i.e. its
property is ), the resulting will be .
Gets an value wrapping the input .
The type of keys in the input segmented dictionary.
The type of values in the input segmented dictionary.
The input segmented dictionary to wrap in the returned value.
An value wrapping .
When using this method, callers should take extra care to ensure that they're the sole owners of the input
dictionary, and that it won't be modified once the returned
value starts being used. Doing so might cause undefined behavior in code paths which don't expect the contents
of a given values to change after its creation.
If is , the returned
value will be uninitialized (i.e. its
property will be ).
Gets the underlying for an input value.
The type of keys in the input value.
The type of values in the input value.
The input value to get the underlying from.
The underlying for , if present; otherwise, .
When using this method, callers should make sure to not pass the resulting underlying dictionary to methods that
might mutate it. Doing so might cause undefined behavior in code paths using which
don't expect the contents of the value to change.
If is uninitialized (i.e. its
property is ), the resulting will be .
Represents a collection of keys and values.
This collection has the same performance characteristics as , but
uses segmented arrays to avoid allocations in the Large Object Heap.
The type of the keys in the dictionary.
The type of the values in the dictionary.
Private helper class for use only by .
doesn't devirtualize on .NET Framework, so we always ensure
is initialized to a non- value.
Ensures that the dictionary can hold up to 'capacity' entries without any further expansion of its backing storage
Sets the capacity of this dictionary to what it would be if it had been originally initialized with all its entries
This method can be used to minimize the memory overhead
once it is known that no new elements will be added.
To allocate minimum size storage array, execute the following statements:
dictionary.Clear();
dictionary.TrimExcess();
Sets the capacity of this dictionary to hold up 'capacity' entries without any further expansion of its backing storage
This method can be used to minimize the memory overhead
once it is known that no new elements will be added.
0-based index of next entry in chain: -1 means end of chain
also encodes whether this entry _itself_ is part of the free list by changing sign and subtracting 3,
so -2 means end of free list, -3 means index 0 but on free list, -4 means index 1 but on free list, etc.
Cutoff point for stackallocs. This corresponds to the number of ints.
When constructing a hashset from an existing collection, it may contain duplicates,
so this is used as the max acceptable excess ratio of capacity to count. Note that
this is only used on the ctor and not to automatically shrink if the hashset has, e.g,
a lot of adds followed by removes. Users must explicitly shrink by calling TrimExcess.
This is set to 3 because capacity is acceptable as 2x rounded up to nearest prime.
doesn't devirtualize on .NET Framework, so we always ensure
is initialized to a non- value.
Initializes the SegmentedHashSet from another SegmentedHashSet with the same element type and equality comparer.
Removes all elements from the object.
Determines whether the contains the specified element.
The element to locate in the object.
true if the object contains the specified element; otherwise, false.
Gets the index of the item in , or -1 if it's not in the set.
Gets a reference to the specified hashcode's bucket, containing an index into .
Gets the number of elements that are contained in the set.
Adds the specified element to the .
The element to add to the set.
true if the element is added to the object; false if the element is already present.
Searches the set for a given value and returns the equal value it finds, if any.
The value to search for.
The value from the set that the search found, or the default value of when the search yielded no match.
A value indicating whether the search was successful.
This can be useful when you want to reuse a previously stored reference instead of
a newly constructed one (so that more sharing of references can occur) or to look up
a value that has more complete data than the value you currently have, although their
comparer functions indicate they are equal.
Modifies the current object to contain all elements that are present in itself, the specified collection, or both.
The collection to compare to the current object.
Modifies the current object to contain only elements that are present in that object and in the specified collection.
The collection to compare to the current object.
Removes all elements in the specified collection from the current object.
The collection to compare to the current object.
Modifies the current object to contain only elements that are present either in that object or in the specified collection, but not both.
The collection to compare to the current object.
Determines whether a object is a subset of the specified collection.
The collection to compare to the current object.
true if the object is a subset of ; otherwise, false.
Determines whether a object is a proper subset of the specified collection.
The collection to compare to the current object.
true if the object is a proper subset of ; otherwise, false.
Determines whether a object is a proper superset of the specified collection.
The collection to compare to the current object.
true if the object is a superset of ; otherwise, false.
Determines whether a object is a proper superset of the specified collection.
The collection to compare to the current object.
true if the object is a proper superset of ; otherwise, false.
Determines whether the current object and a specified collection share common elements.
The collection to compare to the current object.
true if the object and share at least one common element; otherwise, false.
Determines whether a object and the specified collection contain the same elements.
The collection to compare to the current object.
true if the object is equal to ; otherwise, false.
Copies the elements of a object to an array, starting at the specified array index.
The destination array.
The zero-based index in array at which copying begins.
Removes all elements that match the conditions defined by the specified predicate from a collection.
Gets the object that is used to determine equality for the values in the set.
Ensures that this hash set can hold the specified number of elements without growing.
Sets the capacity of a object to the actual number of elements it contains,
rounded up to a nearby, implementation-specific value.
Returns an object that can be used for equality testing of a object.
Initializes buckets and slots arrays. Uses suggested capacity by finding next prime
greater than or equal to capacity.
Adds the specified element to the set if it's not already contained.
The element to add to the set.
The index into of the element.
true if the element is added to the object; false if the element is already present.
Implementation Notes:
If other is a hashset and is using same equality comparer, then checking subset is
faster. Simply check that each element in this is in other.
Note: if other doesn't use same equality comparer, then Contains check is invalid,
which is why callers must take are of this.
If callers are concerned about whether this is a proper subset, they take care of that.
If other is a hashset that uses same equality comparer, intersect is much faster
because we can use other's Contains
Iterate over other. If contained in this, mark an element in bit array corresponding to
its position in _slots. If anything is unmarked (in bit array), remove it.
This attempts to allocate on the stack, if below StackAllocThreshold.
if other is a set, we can assume it doesn't have duplicate elements, so use this
technique: if can't remove, then it wasn't present in this set, so add.
As with other methods, callers take care of ensuring that other is a hashset using the
same equality comparer.
Implementation notes:
Used for symmetric except when other isn't a SegmentedHashSet. This is more tedious because
other may contain duplicates. SegmentedHashSet technique could fail in these situations:
1. Other has a duplicate that's not in this: SegmentedHashSet technique would add then
remove it.
2. Other has a duplicate that's in this: SegmentedHashSet technique would remove then add it
back.
In general, its presence would be toggled each time it appears in other.
This technique uses bit marking to indicate whether to add/remove the item. If already
present in collection, it will get marked for deletion. If added from other, it will
get marked as something not to remove.
Determines counts that can be used to determine equality, subset, and superset. This
is only used when other is an IEnumerable and not a SegmentedHashSet. If other is a SegmentedHashSet
these properties can be checked faster without use of marking because we can assume
other has no duplicates.
The following count checks are performed by callers:
1. Equals: checks if unfoundCount = 0 and uniqueFoundCount = _count; i.e. everything
in other is in this and everything in this is in other
2. Subset: checks if unfoundCount >= 0 and uniqueFoundCount = _count; i.e. other may
have elements not in this and everything in this is in other
3. Proper subset: checks if unfoundCount > 0 and uniqueFoundCount = _count; i.e
other must have at least one element not in this and everything in this is in other
4. Proper superset: checks if unfound count = 0 and uniqueFoundCount strictly less
than _count; i.e. everything in other was in this and this had at least one element
not contained in other.
An earlier implementation used delegates to perform these checks rather than returning
an ElementCount struct; however this was changed due to the perf overhead of delegates.
Allows us to finish faster for equals and proper superset
because unfoundCount must be 0.
Checks if equality comparers are equal. This is used for algorithms that can
speed up if it knows the other item has unique elements. I.e. if they're using
different equality comparers, then uniqueness assumption between sets break.
0-based index of next entry in chain: -1 means end of chain
also encodes whether this entry _itself_ is part of the free list by changing sign and subtracting 3,
so -2 means end of free list, -3 means index 0 but on free list, -4 means index 1 but on free list, etc.
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and
manipulate lists.
This collection has the same performance characteristics as , but uses segmented
arrays to avoid allocations in the Large Object Heap.
The type of elements in the list.
Ensures that the capacity of this list is at least the specified .
If the current capacity of the list is less than specified ,
the capacity is increased by continuously twice current capacity until it is at least the specified .
The minimum capacity to ensure.
The new capacity of this list.
Increase the capacity of this list to at least the specified .
The minimum capacity to ensure.
Creates a shallow copy of a range of elements in the source .
The zero-based index at which the range starts.
The length of the range.
A shallow copy of a range of elements in the source .
is less than 0.
-or-
is less than 0.
and do not denote a valid range of elements in the .
Whether or not the backing array should be created immediately, or should
be deferred until the first time that is used. Note: if is then the array will be created in a non-threadsafe
fashion (effectively different threads might observe a small window of time when different arrays could be
returned. Derived types should only pass here if that behavior is acceptable for
their use case.
Extension methods associated with ConsList.
The collection of extension methods for the type
If the given key is not found in the dictionary, add it with the given value and return the value.
Otherwise return the existing value associated with that key.
If the given key is not found in the dictionary, add it with the result of invoking getValue and return the value.
Otherwise return the existing value associated with that key.
A simple class to implement IGrouping.
This extension method is added so that it's preferred over LINQ's Any.
This is more efficient than LINQ, especially in that it avoids the enumerator boxing allocation.
A dictionary that maps strings to all known spellings of that string. Can be used to
efficiently store the set of known type names for a module for both VB and C# while also
answering questions like "do you have a type called Goo" in either a case sensitive or
insensitive manner.
The collection of extension methods for the type
Converts a sequence to an immutable array.
Elemental type of the sequence.
The sequence to convert.
An immutable copy of the contents of the sequence.
If items is null (default)
If the sequence is null, this will throw
Converts a sequence to an immutable array.
Elemental type of the sequence.
The sequence to convert.
An immutable copy of the contents of the sequence.
If the sequence is null, this will return an empty array.
Converts a sequence to an immutable array.
Elemental type of the sequence.
The sequence to convert.
An immutable copy of the contents of the sequence.
If the sequence is null, this will return the default (null) array.
Converts an array to an immutable array. The array must not be null.
The sequence to convert
Converts a array to an immutable array.
The sequence to convert
If the sequence is null, this will return the default (null) array.
Converts an array to an immutable array.
The sequence to convert
If the array is null, this will return an empty immutable array.
Reads bytes from specified .
The stream.
Read-only content of the stream.
Maps an immutable array to another immutable array.
The array to map
The mapping delegate
If the items's length is 0, this will return an empty immutable array
Maps an immutable array to another immutable array.
The sequence to map
The mapping delegate
The extra input used by mapping delegate
If the items's length is 0, this will return an empty immutable array.
Maps an immutable array to another immutable array.
The sequence to map
The mapping delegate
The extra input used by mapping delegate
If the items's length is 0, this will return an empty immutable array.
Maps a subset of immutable array to another immutable array.
Type of the source array items
Type of the transformed array items
The array to transform
The condition to use for filtering the array content.
A transform function to apply to each element that is not filtered out by .
If the items's length is 0, this will return an empty immutable array.
Maps a subset of immutable array to another immutable array.
Type of the source array items
Type of the transformed array items
Type of the extra argument
The array to transform
The condition to use for filtering the array content.
A transform function to apply to each element that is not filtered out by .
The extra input used by and .
If the items's length is 0, this will return an empty immutable array.
Maps and flattens a subset of immutable array to another immutable array.
Type of the source array items
Type of the transformed array items
The array to transform
A transform function to apply to each element.
If the array's length is 0, this will return an empty immutable array.
Maps and flattens a subset of immutable array to another immutable array.
Type of the source array items
Type of the transformed array items
The array to transform
A transform function to apply to each element.
If the array's length is 0, this will return an empty immutable array.
Maps and flattens a subset of immutable array to another immutable array.
Type of the source array items
Type of the transformed array items
The array to transform
The condition to use for filtering the array content.
A transform function to apply to each element that is not filtered out by .
If the items's length is 0, this will return an empty immutable array.
Maps and flattens a subset of immutable array to another immutable array.
Type of the source array items
Type of the transformed array items
The array to transform
The condition to use for filtering the array content.
A transform function to apply to each element that is not filtered out by .
If the items's length is 0, this will return an empty immutable array.
Maps an immutable array through a function that returns ValueTasks, returning the new ImmutableArray.
Maps an immutable array through a function that returns ValueTasks, returning the new ImmutableArray.
Zips two immutable arrays together through a mapping function, producing another immutable array.
If the items's length is 0, this will return an empty immutable array.
Creates a new immutable array based on filtered elements by the predicate. The array must not be null.
The array to process
The delegate that defines the conditions of the element to search for.
Creates a new immutable array based on filtered elements by the predicate. The array must not be null.
The array to process
The delegate that defines the conditions of the element to search for.
Casts the immutable array of a Type to an immutable array of its base type.
Determines whether this instance and another immutable array are equal.
The comparer to determine if the two arrays are equal.
True if the two arrays are equal
Returns an empty array if the input array is null (default)
Returns an empty array if the input nullable value type is null or the underlying array is null (default)
Returns an array of distinct elements, preserving the order in the original array.
If the array has no duplicates, the original array is returned. The original array must not be null.
Determines whether duplicates exist using default equality comparer.
Array to search for duplicates
Whether duplicates were found
Determines whether duplicates exist using . Use other override
if you don't need a custom comparer.
Array to search for duplicates
Comparer to use in search
Whether duplicates were found
Performs a comparison without allocating an intermediate
.
A representation of a string of characters that requires O(1) extra space to concatenate two ropes.
A rope can wrap a simple string.
A rope can be formed from the concatenation of two ropes.
Two ropes are "the same" if they represent the same sequence of characters.
A rope that wraps a simple string.
A rope that represents the concatenation of two ropes.
Dictionary designed to hold small number of items.
Compared to the regular Dictionary, average overhead per-item is roughly the same, but
unlike regular dictionary, this one is based on an AVL tree and as such does not require
rehashing when items are added.
It does require rebalancing, but that is allocation-free.
Major caveats:
1) There is no Remove method. (can be added, but we do not seem to use Remove that much)
2) foreach [keys|values|pairs] may allocate a small array.
3) Performance is no longer O(1). At a certain count it becomes slower than regular Dictionary.
In comparison to regular Dictionary on my machine:
On trivial number of elements (5 or so) it is more than 2x faster.
The break even count is about 120 elements for read and 55 for write operations (with unknown initial size).
At UShort.MaxValue elements, this dictionary is 6x slower to read and 4x slower to write
Generally, this dictionary is a win if number of elements is small, not known beforehand or both.
If the size of the dictionary is known at creation and it is likely to contain more than 10 elements,
then regular Dictionary is a better choice.
Gets a mutable reference to a stored in a using variable.
This supporting method allows , a non-copyable
implementing , to be used with using statements while still allowing them to
be passed by reference in calls. The following two calls are equivalent:
using var array = TemporaryArray<T>.Empty;
// Using the 'Unsafe.AsRef' method
Method(ref Unsafe.AsRef(in array));
// Using this helper method
Method(ref array.AsRef());
โ Do not move or rename this method without updating the corresponding
RS0049
analyzer.
The type of element stored in the temporary array.
A read-only reference to a temporary array which is part of a using statement.
A mutable reference to the temporary array.
Provides temporary storage for a collection of elements. This type is optimized for handling of small
collections, particularly for cases where the collection will eventually be discarded or used to produce an
.
This type stores small collections on the stack, with the ability to transition to dynamic storage if/when
larger number of elements are added.
The type of elements stored in the collection.
The number of elements the temporary can store inline. Storing more than this many elements requires the
array transition to dynamic storage.
The first inline element.
This field is only used when is . In other words, this type
stores elements inline or stores them in , but does not use both approaches
at the same time.
The second inline element.
The third inline element.
The fourth inline element.
The number of inline elements held in the array. This value is only used when is
.
A builder used for dynamic storage of collections that may exceed the limit for inline elements.
This field is initialized to non- the first time the
needs to store more than four elements. From that point, is used instead of inline
elements, even if items are removed to make the result smaller than four elements.
Create an with the elements currently held in the temporary array, and clear the
array.
Create an with the elements currently held in the temporary array, and clear
the array.
Transitions the current from inline storage to dynamic storage storage. An
instance is taken from the shared pool, and all elements currently in inline
storage are added to it. After this point, dynamic storage will be used instead of inline storage.
Throws .
This helper improves the ability of the JIT to inline callers.
A helper class that contains a topological sort algorithm.
Produce a topological sort of a given directed acyclic graph, given a set of nodes which include all nodes
that have no predecessors. Any nodes not in the given set, but reachable through successors, will be added
to the result. This is an iterative rather than recursive implementation, so it is unlikely to cause a stack
overflow.
The type of the node
Any subset of the nodes that includes all nodes with no predecessors
A function that adds successor nodes to a provided .
A list of all reachable nodes, in which each node always precedes its successors
true if successful; false if not successful due to cycles in the graph
Implements a readonly collection over a set of existing collections. This can be used to
prevent having to copy items from one collection over to another (thus bloating space).
Note: this is a *collection*, not a *set*. There is no removal of duplicated elements. This
allows us to be able to efficiently do operations like CopyTo, Count, etc. in O(c) time
instead of O(n) (where 'c' is the number of collections and 'n' is the number of elements).
If you have a few collections with many elements in them, then this is an appropriate
collection for you.
Represents a single EditorConfig file, see https://editorconfig.org for details about the format.
Key that indicates if this config is a global config
Key that indicates the precedence of this config when is true
Filename that indicates this file is a user provided global config
A set of keys that are reserved for special interpretation for the editorconfig specification.
All values corresponding to reserved keys in a (key,value) property pair are always lowercased
during parsing.
This list was retrieved from https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
at 2018-04-21 19:37:05Z. New keys may be added to this list in newer versions, but old ones will
not be removed.
A set of values that are reserved for special use for the editorconfig specification
and will always be lower-cased by the parser.
The directory the editorconfig was contained in, with all directory separators
replaced with '/'.
The path passed to during construction.
Comparer for sorting files by path length.
Gets whether this editorconfig is a topmost editorconfig.
Gets whether this editorconfig is a global editorconfig.
Get the global level of this config, used to resolve conflicting keys
A user can explicitly set the global level via the .
When no global level is explicitly set, we use a heuristic:
-
Any file matching the is determined to be a user supplied global config and gets a level of 100
-
Any other file gets a default level of 0
This value is unused when is false.
Parses an editor config file text located at the given path. No parsing
errors are reported. If any line contains a parse error, it is dropped.
Parses an editor config file text located at the given path. No parsing
errors are reported. If any line contains a parse error, it is dropped.
Represents a named section of the editorconfig file, which consists of a name followed by a set
of key-value pairs.
Used to compare s of sections. Specified by editorconfig to
be a case-sensitive comparison.
Used to compare s of sections. Specified by editorconfig to
be a case-sensitive comparison.
Used to compare keys in . The editorconfig spec defines property
keys as being compared case-insensitively according to Unicode lower-case rules.
For regular files, the name as present directly in the section specification of the editorconfig file. For sections in
global configs, this is the unescaped full file path.
Keys and values for this section. All keys are lower-cased according to the
EditorConfig specification and keys are compared case-insensitively. Values are
lower-cased if the value appears in
or if the corresponding key is in . Otherwise,
the values are the literal values present in the source.
Takes a and creates a matcher that
matches the given language. Returns null if the section name is
invalid.
Test if a section name is an absolute path with no special chars
::= |
::= "*" | "**" | "?" | | |
::= any unicode character
::= "{" "}"
::= | ","
]]>
Compile a globbing character class of the form [...]. Returns true if
the character class was successfully compiled. False if there was a syntax
error. The starting character is expected to be directly after the '['.
Parses choice defined by the following grammar:
::= "{" "}"
::= | ","
]]>
Parses range defined by the following grammar.
::= "{" ".." "}"
::= "-" |
::= |
::= 0-9
]]>
Call after getting from
Returns false if there are no more characters in the lex stream.
Otherwise, produces the next character in the stream and returns true.
Returns the string representation of a decimal integer, or null if
the current lexeme is not an integer.
Holds results from .
Options that customize diagnostic severity as reported by the compiler.
Options that do not have any special compiler behavior and are passed to analyzers as-is.
Any produced diagnostics while applying analyzer configuration.
Represents a set of , and can compute the effective analyzer options for a given source file. This is used to
collect all the files for that would apply to a compilation.
The list of s in this set. This list has been sorted per .
This does not include any of the global configs that were merged into .
s for each section. The entries in the outer array correspond to entries in , and each inner array
corresponds to each .
Gets an that contain the options that apply globally
Returns a for a source file. This computes which rules applies to this file, and correctly applies
precedence rules if there are multiple rules for the same file.
The path to a file such as a source file or additional file. Must be non-null.
This method is safe to call from multiple threads.
Merge any partial global configs into a single global config, and remove the partial configs
An of containing a mix of regular and unmerged partial global configs
Diagnostics produced during merge will be added to this bag
A that contains the merged partial configs, or null if there were no partial configs
Builds a global analyzer config from a series of partial configs
Represents a combined global analyzer config.
We parse all s as individual files, according to the editorconfig spec.
However, when viewing the configs as an if multiple files have the
is_global property set to true we combine those files and treat them as a single
'logical' global config file. This type represents that combined file.
Describes a command line analyzer assembly specification.
Assembly file path.
The base class for representing command line arguments to a
.
Drop to an interactive loop. If a script is specified in executes the script first.
Directory used to resolve relative paths stored in the arguments.
Except for paths stored in , all
paths stored in the properties of this class are resolved and
absolute. This is the directory that relative paths specified on
command line were resolved against.
A list of pairs of paths. This stores the value of the command-line compiler
option /pathMap:X1=Y1;X2=Y2... which causes a prefix of X1 followed by a path
separator to be replaced by Y1 followed by a path separator, and so on for each following pair.
This option is used to help get build-to-build determinism even when the build
directory is different from one build to the next. The prefix matching is case sensitive.
Sequence of absolute paths used to search for references.
Sequence of absolute paths used to search for sources specified as #load directives.
Sequence of absolute paths used to search for key files.
If true, use UTF-8 for output.
Compilation name or null if not specified.
Gets the emit options.
Name of the output file or null if not specified.
Path of the output ref assembly or null if not specified.
Path of the PDB file or null if same as output binary path with .pdb extension.
Path of the file containing information linking the compilation to source server that stores
a snapshot of the source code included in the compilation.
Absolute path of the .ruleset file or null if not specified.
True to emit PDB information (to a standalone PDB file or embedded into the PE file).
Absolute path of the output directory (could only be null if there is an error reported).
Absolute path of the documentation comment XML file or null if not specified.
Absolute path of the directory to place generated files in, or null to not emit any generated files.
Options controlling the generation of a SARIF log file containing compilation or
analysis diagnostics, or null if no log file is desired.
Options controlling the generation of a SARIF log file containing compilation or
analysis diagnostics, or null if no log file is desired.
An absolute path of the app.config file or null if not specified.
Errors while parsing the command line arguments.
References to metadata supplied on the command line.
Includes assemblies specified via /r and netmodules specified via /addmodule.
References to analyzers supplied on the command line.
A set of paths to EditorConfig-compatible analyzer config files.
A set of additional non-code text files that can be used by analyzers.
A set of files to embed in the PDB.
Report additional information related to analyzers, such as analyzer execution time.
Report additional information related to InternalsVisibleToAttributes for all assemblies the compiler sees in this compilation.
Skip execution of s.
If true, prepend the command line header logo during
.
If true, append the command line help during
If true, append the compiler version during
If true, prepend the compiler-supported language versions during
The path to a Win32 resource.
The path to a .ico icon file.
The path to a Win32 manifest file to embed
into the output portable executable (PE) file.
If true, do not embed any Win32 manifest, including
one specified by or any
default manifest.
Resources specified as arguments to the compilation.
Encoding to be used for source files or 'null' for autodetect/default.
Hash algorithm to use to calculate source file debug checksums and PDB checksum.
Arguments following a script file or separator "--". Null if the command line parser is not interactive.
Source file paths.
Includes files specified directly on command line as well as files matching patterns specified
on command line using '*' and '?' wildcards or /recurse option.
Full path of a log of file paths accessed by the compiler, or null if file logging should be suppressed.
Two log files will be created:
One with path and extension ".read" logging the files read,
and second with path and extension ".write" logging the files written to during compilation.
If true, prints the full path of the file containing errors or
warnings in diagnostics.
Options to the .
Options to the .
Specify the preferred output language name.
Returns a full path of the file that the compiler will generate the assembly to if compilation succeeds.
The method takes rather than using the value of
since the latter might be unspecified, in which case actual output path can't be determined for C# command line
without creating a compilation and finding an entry point. VB does not allow to
be unspecified.
Returns a full path of the PDB file that the compiler will generate the debug symbols to
if is true and the compilation succeeds.
The method takes rather than using the value of
since the latter might be unspecified, in which case actual output path can't be determined for C# command line
without creating a compilation and finding an entry point. VB does not allow to
be unspecified.
Returns true if the PDB is generated to a PDB file, as opposed to embedded to the output binary and not generated at all.
Resolves metadata references stored in using given file resolver and metadata provider.
to use for assembly name and relative path resolution.
Yields resolved metadata references or .
is null.
Resolves metadata references stored in using given file resolver and metadata provider.
If a non-null diagnostic bag is provided, it catches exceptions that may be generated while reading the metadata file and
reports appropriate diagnostics.
Otherwise, if is null, the exceptions are unhandled.
called by CommonCompiler with diagnostics and message provider
Resolves analyzer references stored in using given file resolver.
Load an assembly from a file path
Yields resolved or .
Enumerates files in the specified directory and subdirectories whose name matches the given pattern.
Full path of the directory to enumerate.
File name pattern. May contain wildcards '*' (matches zero or more characters) and '?' (matches any character).
Specifies whether to search the specified only, or all its subdirectories as well.
Sequence of file paths.
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 object representing the parsed command line.
Determines if a is equal to the provided option name
Prefer this over the Equals methods on . The
implementation allocates a .
The 99% case here is that we are dealing with an ASCII string that matches the input hence
it's worth special casing that here and falling back to the more complicated comparison
when dealing with non-ASCII input
Trims all '.' and whitespace from the end of the path
Splits specified on
treating two consecutive separators as if they were a single non-separating character.
E.g. "a,,b,c" split on ',' yields ["a,b", "c"].
Returns false if any of the client arguments are invalid and true otherwise.
The original args to the client.
The original args minus the client args, if no errors were encountered.
Only defined if no errors were encountered.
True if '/shared' was an argument, false otherwise.
Only defined if no errors were encountered.
The value to the '/keepalive' argument if one was specified, null otherwise.
Only defined if errors were encountered.
The error message for the encountered error.
Only specified if is true and the session key
was provided. Can be null
See
Remove the extraneous quotes and slashes from the argument. This function is designed to have
compat behavior with the native compiler.
Mimics the function RemoveQuotes from the native C# compiler. The native VB equivalent of this
function is called RemoveQuotesAndSlashes. It has virtually the same behavior except for a few
quirks in error cases.
Split a string by a set of separators, taking quotes into account.
Tries to parse a UInt64 from string in either decimal, octal or hex format.
The string value.
The result if parsing was successful.
true if parsing was successful, otherwise false.
Tries to parse a UInt16 from string in either decimal, octal or hex format.
The string value.
The result if parsing was successful.
true if parsing was successful, otherwise false.
Sort so that more specific keys precede less specific.
When mapping a path we find the first key in the array that is a prefix of the path.
If multiple keys are prefixes of the path we want to use the longest (more specific) one for the mapping.
Describes a command line metadata reference (assembly or netmodule) specification.
Metadata file path or an assembly display name.
Metadata reference properties.
Describes a source file specification stored on command line arguments.
Resolved absolute path of the source file (does not contain wildcards).
Although this path is absolute it may not be normalized. That is, it may contain ".." and "." in the middle.
True if the input has been redirected from the standard input stream.
True if the file should be treated as a script file.
Base class for csc.exe, csi.exe, vbc.exe and vbi.exe implementations.
This implementation of will delay the creation
of the PE / PDB file until the compiler determines the compilation has succeeded. This prevents
the compiler from deleting output from the previous compilation when a new compilation
fails. The method must be called to retrieve all diagnostics.
Looks for metadata references among the assembly file references given to the compilation when constructed.
When scripts are included into a project we don't want #r's to reference other assemblies than those
specified explicitly in the project references.
Fallback encoding that is lazily retrieved if needed. If is
evaluated and stored, the value is used if a PDB is created for this compilation.
The set of source file paths that are in the set of embedded paths.
This is used to prevent reading source files that are embedded twice.
The used to access the file system inside this instance.
Print compiler version
The type of the compiler class for version information in /help and /version.
We don't simply use this.GetType() because that would break mock subclasses.
The version of this compiler with commit hash, used in logo and /version output.
Tool name used, along with assembly version, for error logging.
Tool version identifier used for error logging.
Resolves metadata references stored in command line arguments and reports errors for those that can't be resolved.
Reads content of a source file.
Source file information.
Storage for diagnostics.
File content or null on failure.
Reads content of a source file.
Source file information.
Storage for diagnostics.
If given opens successfully, set to normalized absolute path of the file, null otherwise.
File content or null on failure.
Read all analyzer config files from the given paths.
Returns the fallback encoding for parsing source files, if used, or null
if not used
Read a UTF-8 encoded file and return the text as a string.
Returns true if there were any errors, false otherwise.
Returns true if there were any errors, false otherwise.
Returns true if there were any errors, false otherwise.
Reports all IVT information for the given compilation and references, to aid in troubleshooting otherwise inexplicable IVT failures.
Returns true if there are any error diagnostics in the bag which cannot be suppressed and
are guaranteed to break the build.
Only diagnostics which have default severity error and are tagged as NotConfigurable fall in this bucket.
This includes all compiler error diagnostics and specific analyzer error diagnostics that are marked as not configurable by the analyzer author.
Returns true if the bag has any diagnostics with effective Severity=Error. Also returns true for warnings or informationals
or warnings promoted to error via /warnaserror which are not suppressed.
csc.exe and vbc.exe entry point.
Perform source generation, if the compiler supports it.
The compilation before any source generation has occurred.
The base directory for the of generated files.
The to use when parsing any generated sources.
The generators to run
A provider that returns analyzer config options.
Any additional texts that should be passed to the generators when run.
Any diagnostics that were produced during generation.
A compilation that represents the original compilation with any additional, generated texts added to it.
Perform all the work associated with actual compilation
(parsing, binding, compile, emit), resulting in diagnostics
and analyzer output.
Returns the name with which the assembly should be output
When overridden by a derived class, this property can override the current thread's
CurrentUICulture property for diagnostic message resource lookups.
Looks for metadata references among the assembly file references given to the compilation when constructed.
When scripts are included into a project we don't want #r's to reference other assemblies than those
specified explicitly in the project references.
Special informational diagnostic for each programmatic reported by a .
The path which contains the compiler binaries and response files.
The path in which the compilation takes place. This is also referred to as "baseDirectory" in
the code base.
The path which contains mscorlib. This can be null when specified by the user or running in a
CoreClr environment.
The temporary directory a compilation should use instead of Path.GetTempPath. The latter
relies on global state individual compilations should ignore.
Base class for logging compiler diagnostics.
Contains information associated with a
for the . It contains the following:
1. Analyzer execution time in seconds for the analyzer owning the descriptor.
2. Analyzer execution time in percentage of the total analyzer execution time.
3. Set of all effective severities for the diagnostic Id, configured through options
from editorconfig, ruleset, command line options, etc. for either part of the compilation
or the entire compilation.
4. A boolean value "HasAnyExternalSuppression" indicating if the diagnostic ID has any
external non-source suppression from editorconfig, ruleset, command line options, etc.,
which disables the descriptor for either part of the compilation or the entire compilation.
Note that this flag doesn't account for source suppressions from pragma directives,
SuppressMessageAttributes, DiagnosticSuppressors, etc. which suppress individual instances
of reported diagnostics.
Contains information associated with a
for the . It contains the following:
1. Analyzer execution time in seconds for the analyzer owning the descriptor.
2. Analyzer execution time in percentage of the total analyzer execution time.
3. Set of all effective severities for the diagnostic Id, configured through options
from editorconfig, ruleset, command line options, etc. for either part of the compilation
or the entire compilation.
4. A boolean value "HasAnyExternalSuppression" indicating if the diagnostic ID has any
external non-source suppression from editorconfig, ruleset, command line options, etc.,
which disables the descriptor for either part of the compilation or the entire compilation.
Note that this flag doesn't account for source suppressions from pragma directives,
SuppressMessageAttributes, DiagnosticSuppressors, etc. which suppress individual instances
of reported diagnostics.
Options controlling the generation of a SARIF log file containing compilation or analyzer diagnostics.
Absolute path of the error log file.
Version of the SARIF format used in the error log.
Initializes a new instance of the class.
Absolute path of the error log file.
Version of the SARIF format used in the error log.
Compares descriptors by the values that we write to a SARIF log and nothing else.
We cannot just use 's built-in implementation
of for two reasons:
1. is part of that built-in
equatability, but we do not write it out, and so descriptors differing only
by MessageFormat (common) would lead to duplicate rule metadata entries in
the log.
2. is *not* part of that built-in
equatability, but we do write them out, and so descriptors differing only
by CustomTags (rare) would cause only one set of tags to be reported in the
log.
Base class for the and classes.
The SarifV2ErrorLogger produces the standardized SARIF v2.1.0. The SarifV1ErrorLogger produces
the non-standardized SARIF v1.0.0. It is retained (and in fact, is retained as the default)
for compatibility with previous versions of the compiler. Customers who want to integrate
with standardized SARIF tooling should specify /errorlog:logFilePath;version=2 on the command
line to produce SARIF v2.1.0.
Used for logging compiler diagnostics to a stream in the unstandardized SARIF
(Static Analysis Results Interchange Format) v1.0.0 format.
https://github.com/sarif-standard/sarif-spec
https://rawgit.com/sarif-standard/sarif-spec/main/Static%20Analysis%20Results%20Interchange%20Format%20(SARIF).html
To log diagnostics in the standardized SARIF v2.1.0 format, use the SarifV2ErrorLogger.
Represents a distinct set of s and provides unique string keys
to distinguish them.
The first added with a given
value is given that value as its unique key. Subsequent adds with the same ID will have .NNN
appended to their with an auto-incremented numeric value.
The total number of descriptors in the set.
Adds a descriptor to the set if not already present.
The unique key assigned to the given descriptor.
Converts the set to a list of (key, descriptor) pairs sorted by key.
Used for logging compiler diagnostics to a stream in the standardized SARIF
(Static Analysis Results Interchange Format) v2.1.0 format.
http://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html
Represents a distinct set of s and provides unique integer indices
to distinguish them.
The total number of descriptors in the set.
Adds a descriptor to the set if not already present.
The unique key assigned to the given descriptor.
Converts the set to a list, sorted by index.
Specifies the version of the SARIF log file to produce.
The original, non-standardized version of the SARIF format.
The first standardized version of the SARIF format.
The default SARIF version, which is v1.0.0 for compatibility with
previous versions of the compiler.
The latest supported SARIF version.
Try to parse the SARIF log file version from a string.
Used for logging all the paths which are "touched" (used) in any way
in the process of compilation.
Adds a fully-qualified path to the Logger for a read file.
Semantics are undefined after a call to .
Adds a fully-qualified path to the Logger for a written file.
Semantics are undefined after a call to .
Adds a fully-qualified path to the Logger for a read and written
file. Semantics are undefined after a call to
.
Writes all of the paths the TouchedFileLogger to the given
TextWriter in upper case. After calling this method the
logger is in an undefined state.
Writes all of the paths the TouchedFileLogger to the given
TextWriter in upper case. After calling this method the
logger is in an undefined state.
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.
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.
Describes the kind of real signing that is being done during Emit. In the case of public signing
this value will be .
This form of signing occurs in memory using the APIs. This is the default
form of signing and will be used when a strong name key is provided in a file on disk.
This form of signing occurs using the COM APIs. This form of signing
requires the unsigned PE to be written to disk before it can be signed (typically by writing it
out to the %TEMP% folder). This signing is used when the key in a key container, the signing
requires a counter signature or customers opted in via the UseLegacyStrongNameProvider feature
flag.
This type abstracts away the legacy COM based signing implementation for PE streams. Under the hood
a temporary file must be created on disk (at the last possible moment), emitted to, signed on disk
and then copied back to the original . Only when legacy signing is enabled though.
Create the stream which should be used for Emit. This should only be called one time.
The returned here is owned by this type and should not be disposed
by the caller.
Abstraction that allows the caller to delay the creation of the values
until they are actually needed. The provided here is owned by
this type and consumers should not dispose it.
This method will be called once during Emit at the time the Compilation needs
to create a stream for writing. It will not be called in the case of
user errors in code. Shall not be called when returns non-null.
Returns a . If one cannot be gotten or created then a diagnostic will
be added to
Returns true if this is a case sensitive compilation, false otherwise. Case sensitivity
affects compilation features such as name lookup as well as choosing what names to emit
when there are multiple different choices (for example between a virtual method and an
override).
Used for test purposes only to emulate missing members.
Used for test purposes only to emulate missing members.
Gets the source language ("C#" or "Visual Basic").
This method generates a string that represents the input content to the compiler which impacts
the output of the build. This string is effectively a content key for a
with these values that can be used to identify the outputs.
The returned string has the following properties:
-
The format is undefined. Consumers should assume the format and content can change between
compiler versions.
-
It is designed to be human readable and diffable. This is to help developers
understand the difference between two compilations which is impacting the deterministic
output
-
It is *not* in a minimal form. If used as a key in say a content addressable storage consumers
should first pass it through a strong hashing function.
Compilations which do not use the /deterministic option can still use this API but
the results will change on every invocation.
The set of inputs that impact deterministic output are described in the following document
- https://github.com/dotnet/roslyn/blob/main/docs/compilers/Deterministic%20Inputs.md
There are a few dark corners of determinism that are not captured with this key as they are
considered outside the scope of this work:
-
Environment variables: clever developers can subvert determinism by manipulation of
environment variables that impact program execution. For example changing normal library
loading by manipulating the %LIBPATH% environment variable. Doing so can cause a change
in deterministic output of compilation by changing compiler, runtime or generator
dependencies.
-
Manipulation of strong name keys: strong name keys are read "on demand" by the compiler
and both normal compilation and this key can have non-deterministic output if they are
manipulated at the correct point in program execution. That is an existing limitation
of compilation that is tracked by https://github.com/dotnet/roslyn/issues/57940
This API can throw exceptions in a few cases like invalid file paths.
Checks options passed to submission compilation constructor.
Throws an exception if the options are not applicable to submissions.
Creates a new compilation equivalent to this one with different symbol instances.
Returns a new compilation with a given event queue.
Returns a new compilation with a given semantic model provider.
Gets a new for the specified syntax tree.
The specified syntax tree.
True if the SemanticModel should ignore accessibility rules when answering semantic questions.
Gets a for the given .
If is non-null, it attempts to use
to get a semantic model. Otherwise, it creates a new semantic model using .
Creates a new for the given .
Unlike the and ,
it does not attempt to use the to get a semantic model, but instead always creates a new semantic model.
Returns a new INamedTypeSymbol representing an error type with the given name and arity
in the given optional container.
Returns a new INamespaceSymbol representing an error (missing) namespace with the given name.
Simple assembly name, or null if not specified.
The name is used for determining internals-visible-to relationship with referenced assemblies.
If the compilation represents an assembly the value of is its simple name.
Unless specifies otherwise the module name
written to metadata is with an extension based upon .
Creates a compilation with the specified assembly name.
The new assembly name.
A new compilation.
Gets the options the compilation was created with.
Creates a new compilation with the specified compilation options.
The new options.
A new compilation.
True if the compilation represents an interactive submission.
The previous submission, if any, or null.
Gets or allocates a runtime submission slot index for this compilation.
Non-negative integer if this is a submission and it or a previous submission contains code, negative integer otherwise.
The type object that represents the type of submission result the host requested.
The type of the globals object or null if not specified for this compilation.
Gets the syntax trees (parsed from source code) that this compilation was created with.
Creates a new compilation with additional syntax trees.
The new syntax trees.
A new compilation.
Creates a new compilation with additional syntax trees.
The new syntax trees.
A new compilation.
Creates a new compilation without the specified syntax trees. Preserves metadata info for use with trees
added later.
The new syntax trees.
A new compilation.
Creates a new compilation without the specified syntax trees. Preserves metadata info for use with trees
added later.
The new syntax trees.
A new compilation.
Creates a new compilation without any syntax trees. Preserves metadata info for use with
trees added later.
Creates a new compilation with an old syntax tree replaced with a new syntax tree.
Reuses metadata from old compilation object.
The new tree.
The old tree.
A new compilation.
Returns true if this compilation contains the specified tree. False otherwise.
A syntax tree.
Optional semantic model provider for this compilation.
The event queue that this compilation was created with.
If this value is not 0, we might be about to enqueue more events into .
In this case, we need to wait for the count to go to zero before completing the queue.
This is necessary in cases where multi-step operations that impact the queue occur. For
example when a thread of execution is storing cached data on a symbol before pushing
an event to the queue. If another thread were to come in between those two steps, see the
cached data it could mistakenly believe the operation was complete and cause the queue
to close. This counter ensures that the queue will remain open for the duration of a
complex operation.
Metadata references passed to the compilation constructor.
Unique metadata references specified via #r directive in the source code of this compilation.
All reference directives used in this compilation.
Maps values of #r references to resolved metadata references.
All metadata references -- references passed to the compilation
constructor as well as references specified via #r directives.
Creates a metadata reference for this compilation.
Optional aliases that can be used to refer to the compilation root namespace via extern alias directive.
Embed the COM types from the reference so that the compiled
application no longer requires a primary interop assembly (PIA).
Creates a new compilation with the specified references.
The new references.
A new compilation.
Creates a new compilation with the specified references.
The new references.
A new compilation.
Creates a new compilation with the specified references.
Creates a new compilation with additional metadata references.
The new references.
A new compilation.
Creates a new compilation with additional metadata references.
The new references.
A new compilation.
Creates a new compilation without the specified metadata references.
The new references.
A new compilation.
Creates a new compilation without the specified metadata references.
The new references.
A new compilation.
Creates a new compilation without any metadata references.
Creates a new compilation with an old metadata reference replaced with a new metadata
reference.
The new reference.
The old reference.
A new compilation.
Gets the or for a metadata reference used to create this
compilation.
The target reference.
Assembly or module symbol corresponding to the given reference or null if there is none.
Gets the that corresponds to the assembly symbol.
The target symbol.
Assembly identities of all assemblies directly referenced by this compilation.
Includes identities of references passed in the compilation constructor
as well as those specified via directives in source code.
The that represents the assembly being created.
Gets the for the module being created by compiling all of
the source code.
The root namespace that contains all namespaces and types defined in source code or in
referenced metadata, merged into a single namespace hierarchy.
Gets the corresponding compilation namespace for the specified module or assembly namespace.
Returns the Main method that will serves as the entry point of the assembly, if it is
executable (and not a script).
Get the symbol for the predefined type from the Cor Library referenced by this
compilation.
Get the symbol for the predefined type member from the COR Library referenced by this compilation.
Returns true if the type is System.Type.
Lookup member declaration in well known type used by this Compilation.
Lookup well-known type used by this Compilation.
Returns true if the specified type is equal to or derives from System.Attribute well-known type.
The INamedTypeSymbol for the .NET System.Object type, which could have a TypeKind of
Error if there was no COR Library in this Compilation.
The TypeSymbol for the type 'dynamic' in this Compilation.
If the compilation is a VisualBasic compilation.
A symbol representing the script globals type.
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.
Returns a new ArrayTypeSymbol representing an array type tied to the base types of the
COR Library in this Compilation.
Returns a new ArrayTypeSymbol representing an array type tied to the base types of the
COR Library in this Compilation.
This overload is for backwards compatibility. Do not remove.
Returns a new IPointerTypeSymbol representing a pointer type tied to a type in this
Compilation.
If the compilation is a VisualBasic compilation.
Returns a new IFunctionPointerTypeSymbol representing a function pointer type tied to types in this
Compilation.
If the compilation is a VisualBasic compilation.
If:
* is passed as the returnRefKind.
* parameterTypes and parameterRefKinds do not have the same length.
If returnType is , or if parameterTypes or parameterRefKinds are default,
or if any of the types in parameterTypes are null.
Returns a new INamedTypeSymbol representing a native integer.
If the compilation is a VisualBasic 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.
This lookup follows the following order:
- If the type is found in the compilation's assembly, that type is returned.
-
Next, the core library (the library that defines System.Object and has no assembly references) is searched.
If the type is found there, that type is returned.
-
Finally, all remaining referenced non-extern assemblies are searched. If one and only one type matching the provided metadata name is found, that
single type is returned. Accessibility is ignored for this check.
Null if the type can't be found or there was an ambiguity during lookup.
Since VB does not have the concept of extern aliases, it considers all referenced assemblies.
In C#, if the core library is referenced as an extern assembly, it will be searched. All other extern-aliased assemblies will not be searched.
Because accessibility to the current assembly is ignored when searching for types that match the provided metadata name, if multiple referenced
assemblies define the same type symbol (as often happens when users copy well-known types from the BCL or other sources) then this API will return null,
even if all but one of those symbols would be otherwise inaccessible to user-written code in the current assembly. For fine-grained control over ambiguity
resolution, consider using instead and filtering the results for the symbol required.
Assemblies can contain multiple modules. Within each assembly, the search is performed based on module's position in the module list of that assembly. When
a match is found in one module in an assembly, no further modules within that assembly are searched.
Type forwarders are ignored, and not considered part of the assembly where the TypeForwardAttribute is written.
Ambiguities are detected on each nested level. For example, if A+B is requested, and there are multiple As but only one of them has a B nested
type, the lookup will be considered ambiguous and null will be returned.
Gets all types with the compilation's assembly and all referenced assemblies that have the
given canonical CLR metadata name. Accessibility to the current assembly is ignored when
searching for matching type names.
Empty array if no types match. Otherwise, all types that match the name, current assembly first if present.
Assemblies can contain multiple modules. Within each assembly, the search is performed based on module's position in the module list of that assembly. When
a match is found in one module in an assembly, no further modules within that assembly are searched.
Type forwarders are ignored, and not considered part of the assembly where the TypeForwardAttribute is written.
Returns a new INamedTypeSymbol with the given element types and
(optional) element names, locations, and nullable annotations.
Returns a new INamedTypeSymbol with the given element types, names, and locations.
This overload is for backwards compatibility. Do not remove.
Check that if any names are provided, and their number matches the expected cardinality.
Returns a normalized version of the element names (empty array if all the names are null).
Returns a new INamedTypeSymbol with the given underlying type and
(optional) element names, locations, and nullable annotations.
The underlying type needs to be tuple-compatible.
Returns a new INamedTypeSymbol with the given underlying type and element names and locations.
The underlying type needs to be tuple-compatible.
This overload is for backwards compatibility. Do not remove.
Returns a new anonymous type symbol with the given member types, names, source locations, and nullable annotations.
Anonymous type members will be readonly by default. Writable properties are
supported in VB and can be created by passing in in the
appropriate locations in .
Returns a new anonymous type symbol with the given member types, names, and source locations.
Anonymous type members will be readonly by default. Writable properties are
supported in VB and can be created by passing in in the
appropriate locations in .
This overload is for backwards compatibility. Do not remove.
Creates an whose is for a binary operator. Built-in operators are commonly created for
symbols like bool int.operator ==(int v1, int v2) which the language implicitly supports, even if such
a symbol is not explicitly defined for that type in either source or metadata.
The binary operator name. Should be one of the names from .
The return type of the binary operator.
The type of the left operand of the binary operator.
The type of the right operand of the binary operator.
Creates an whose is for a unary operator. Built-in operators are commonly created for
symbols like bool int.operator -(int value) which the language implicitly supports, even if such a
symbol is not explicitly defined for that type in either source or metadata.
The unary operator name. Should be one of the names from .
The return type of the unary operator.
The type the operator applies to.
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 true if there is an implicit (C#) or widening (VB) conversion from
to . Returns false if
either or is null, or
if no such conversion exists.
Checks if is accessible from within . An optional qualifier of type
is used to resolve protected access for instance members. All symbols are
required to be from this compilation or some assembly referenced () by this
compilation. is required to be an or .
Submissions can reference symbols from previous submissions and their referenced assemblies, even
though those references are missing from .
See https://github.com/dotnet/roslyn/issues/27356.
This implementation works around that by permitting symbols from previous submissions as well.
It is advised to avoid the use of this API within the compilers, as the compilers have additional
requirements for access checking that are not satisfied by this implementation, including the
avoidance of infinite recursion that could result from the use of the ISymbol APIs here, the detection
of use-site diagnostics, and additional returned details (from the compiler's internal APIs) that are
helpful for more precisely diagnosing reasons for accessibility failure.
Gets the diagnostics produced during the parsing stage.
Gets the diagnostics produced during symbol declaration.
Gets the diagnostics produced during the analysis of method bodies and field initializers.
Gets all the diagnostics for the compilation, including syntax, declaration, and
binding. Does not include any diagnostics that might be produced during emit, see
.
Unique metadata assembly references that are considered to be used by this compilation.
For example, if a type declared in a referenced assembly is referenced in source code
within this compilation, the reference is considered to be used. Etc.
The returned set is a subset of references returned by API.
The result is undefined if the compilation contains errors.
The effect of imported namespaces on result of this API depends on whether reporting of
unused imports is disabled for the compilation. The reporting of unused imports is disabled
if is set to .
When unused imports reporting is disabled, all referenced assemblies containing any types
that belong to imported namespaces are included in the result. I.e. considered used.
When unused imports reporting is enabled, imported namespaces do not have effect on the result
of this API. Therefore, removing assembly references that aren't in the result, could potentially
cause error "CS0246: The type or namespace name could not be found (are you missing a using directive or an assembly reference?)"
on an unused namespace import. However, that import would be reported by compiler as unused
for the compilation on which this API was invoked. In order to avoid the errors, it is recommended to
remove unused assembly references and unused imports at the same time.
Filter out warnings based on the compiler options (/nowarn, /warn and /warnaserror) and the pragma warning directives.
'incoming' is freed.
Bag to which filtered diagnostics will be added.
Diagnostics to be filtered.
True if there are no unsuppressed errors (i.e., no errors which fail compilation).
Filter out warnings based on the compiler options (/nowarn, /warn and /warnaserror) and the pragma warning directives.
True if there are no unsuppressed errors (i.e., no errors which fail compilation).
Create a stream filled with default win32 resources.
There are two ways to sign PE files
1. By directly signing the
2. Write the unsigned PE to disk and use CLR COM APIs to sign.
The preferred method is #1 as it's more efficient and more resilient (no reliance on %TEMP%). But
we must continue to support #2 as it's the only way to do the following:
- Access private keys stored in a key container
- Do proper counter signature verification for AssemblySignatureKey attributes
Constructs the module serialization properties out of the compilation options of this compilation.
The value is not used by Windows loader, but the OS appcompat infrastructure uses it to identify apps.
It is useful for us to have a mechanism to identify the compiler that produced the binary.
This is the appropriate value to use for that. That is what it was invented for.
We don't want to have the high bit set for this in case some users perform a signed comparison to
determine if the value is less than some version. The C++ linker is at 0x0B.
We'll start our numbering at 0x30 for C#, 0x50 for VB.
Return true if the compilation contains any code or types.
Report declaration diagnostics and compile and synthesize method bodies.
True if successful.
Update resources.
True if successful.
Generate XML documentation comments.
True if successful.
Reports all unused imports/usings so far (and thus it must be called as a last step of Emit)
Signals the event queue, if any, that we are done compiling.
There should not be more compiling actions after this step.
NOTE: once we signal about completion to analyzers they will cancel and thus in some cases we
may be effectively cutting off some diagnostics.
It is not clear if behavior is desirable.
See: https://github.com/dotnet/roslyn/issues/11470
What tree to complete. null means complete all trees.
Emit the IL for the compiled source code into the specified stream.
Stream to which the compilation will be written.
Stream to which the metadata-only output will be written.
Stream to which the compilation's debug info will be written. Null to forego PDB generation.
Stream to which the compilation's XML documentation will be written. Null to forego XML generation.
Stream from which the compilation's Win32 resources will be read (in RES format).
Null to indicate that there are none. The RES format begins with a null resource entry.
Note that the caller is responsible for disposing this stream, if provided.
List of the compilation's managed resources. Null to indicate that there are none.
Emit options.
Debug entry-point of the assembly. The method token is stored in the generated PDB stream.
When a program launches with a debugger attached the debugger places the first breakpoint to the start of the debug entry-point method.
The CLR starts executing the static Main method of type. When the first breakpoint is hit
the debugger steps thru the code statement by statement until user code is reached, skipping methods marked by ,
and taking other debugging attributes into consideration.
By default both entry points in an executable program (, , )
are the same method (Main). A non-executable program has no entry point. Runtimes that implement a custom loader may specify debug entry-point
to force the debugger to skip over complex custom loader logic executing at the beginning of the .exe and thus improve debugging experience.
Unlike ordinary entry-point which is limited to a non-generic static method of specific signature, there are no restrictions on the
method other than having a method body (extern, interface, or abstract methods are not allowed).
Stream containing information linking the compilation to a source control.
Texts to embed in the PDB.
Only supported when emitting Portable PDBs.
To cancel the emit process.
This overload is only intended to be directly called by tests that want to pass .
The map is used for storing a list of methods and their associated IL.
Emit the differences between the compilation and the previous generation
for Edit and Continue. The differences are expressed as added and changed
symbols, and are emitted as metadata, IL, and PDB deltas. A representation
of the current compilation is returned as an EmitBaseline for use in a
subsequent Edit and Continue.
Emit the differences between the compilation and the previous generation
for Edit and Continue. The differences are expressed as added and changed
symbols, and are emitted as metadata, IL, and PDB deltas. A representation
of the current compilation is returned as an EmitBaseline for use in a
subsequent Edit and Continue.
Emit the differences between the compilation and the previous generation
for Edit and Continue. The differences are expressed as added and changed
symbols, and are emitted as metadata, IL, and PDB deltas. A representation
of the current compilation is returned as an EmitBaseline for use in a
subsequent Edit and Continue.
Check compilation options and create .
if successful.
False when the "debug-analyzers" feature flag is set.
When that flag is set, the compiler will not catch exceptions from analyzer execution to allow creating dumps.
The compiler needs to define an ordering among different partial class in different syntax trees
in some cases, because emit order for fields in structures, for example, is semantically important.
This function defines an ordering among syntax trees in this compilation.
Compare two source locations, using their containing trees, and then by Span.First within a tree.
Can be used to get a total ordering on declarations, for example.
Compare two source locations, using their containing trees, and then by Span.First within a tree.
Can be used to get a total ordering on declarations, for example.
Compare two source locations, using their containing trees, and then by Span.First within a tree.
Can be used to get a total ordering on declarations, for example.
Return the lexically first of two locations.
Return the lexically first of multiple locations.
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 may be faster than when predicate is just a simple string check.
is case sensitive or not depending on the target language.
Return source declaration symbols whose name matches the provided name. This may be
faster than when predicate is just a simple string check. is case sensitive or not depending on the target language.
Given a reporting unreferenced s, returns
the actual instances that were not referenced.
Returns the required language version found in a , if any is found.
Returns null if none is found.
Determines whether the runtime this is targeting supports a particular capability.
Returns if an unknown capability is passed in.
The list of RetargetingAssemblySymbol objects created for this Compilation.
RetargetingAssemblySymbols are created when some other compilation references this one,
but the other references provided are incompatible with it. 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.AssemblySymbol, but reference a special RetargetingAssemblySymbol created
for C1 by ReferenceManager.
WeakReference is used to allow RetargetingAssemblySymbol to be collected when they become unused.
Guarded by .
Adds given retargeting assembly for this compilation into the cache.
must be locked while calling this method.
Adds cached retargeting symbols into the given list.
must be locked while calling this method.
Indicates the reasons why a candidate (or set of candidate) symbols were not considered
correct in SemanticInfo. Higher values take precedence over lower values, so if, for
example, there a symbol with a given name that was inaccessible, and other with the wrong
arity, only the inaccessible one would be reported in the SemanticInfo.
No CandidateSymbols.
Only a type or namespace was valid in the given location, but the candidate symbols was
of the wrong kind.
Only an event was valid in the given location, but the candidate symbols was
of the wrong kind.
The candidate symbol must be a WithEvents member, but it was not.
Only an attribute type was valid in the given location, but the candidate symbol was
of the wrong kind.
The candidate symbol takes a different number of type parameters that was required.
The candidate symbol existed, but was not allowed to be created in a new expression.
For example, interfaces, static classes, and unconstrained type parameters.
The candidate symbol existed, but was not allowed to be referenced. For example, the
"get_XXX" method used to implement a property named "XXX" may not be directly
referenced. Similarly, the type "System.Void" can not be directly referenced.
Also occurs if "this" is used in a context (static method or field initializer)
where "this" is not available.
The candidate symbol had an accessibility modifier (private, protected, ...) that made
it inaccessible.
The candidate symbol was in a place where a value was required, but was not a value
(e.g., was a type or namespace).
The candidate symbol was in a place where a variable (or sometimes, a property) was
required, but was not allowed there because it isn't a symbol that can be assigned to.
For example, the left hand side of an assignment, or a ref or out parameter.
The candidate symbol was used in a way that an invocable member (method, or variable of
delegate type) was required, but the candidate symbol was not invocable.
The candidate symbol must be an instance variable, but was used as static, or the
reverse.
Overload resolution did not choose a method. The candidate symbols are the methods there
were considered during overload resolution (which may or may not be applicable methods).
Method could not be selected statically.
The candidate symbols are the methods there were considered during overload resolution
(which may or may not be applicable methods).
Multiple ambiguous symbols were available with the same name. This can occur if "using"
statements bring multiple namespaces into scope, and the same type is available in
multiple. This can also occur if multiple properties of the same name are available in a
multiple interface inheritance situation.
CandidateSymbols are members of a group of results. This is used when there isn't a problem,
but there is more than one result, for example nameof(int.ToString).
Maps an async/iterator method to the synthesized state machine type that implements the method.
Represents compilation options common to C# and VB.
The kind of assembly generated when emitted.
Name of the primary module, or null if a default name should be used.
The name usually (but not necessarily) includes an extension, e.g. "MyModule.dll".
If is null the actual name written to metadata
is derived from the name of the compilation ()
by appending a default extension for .
The full name of a global implicit class (script class). This class implicitly encapsulates top-level statements,
type declarations, and member declarations. Could be a namespace qualified name.
The full name of a type that declares static Main method. Must be a valid non-generic namespace-qualified name.
Null if any static Main method is a candidate for an entry point.
Specifies public key used to generate strong name for the compilation assembly, or empty if not specified.
If specified the values of and
must be null. If is true the assembly is marked as fully signed
but only signed with the public key (aka "OSS signing").
The name of the file containing the public and private keys to use to generate strong name of the
compilation assembly and to sign it.
To sign the output supply either one of or .
but not both. If both are specified is ignored.
If is also set, must be the absolute
path to key file.
The CSP container containing the key with which to sign the output.
To sign the output supply either one of or .
but not both. If both are specified is ignored.
This setting is obsolete and only supported on Microsoft Windows platform.
Use to generate assemblies with strong name and
a signing tool (Microsoft .NET Framework Strong Name Utility (sn.exe) or equivalent) to sign them.
Mark the compilation assembly as delay-signed.
If true the resulting assembly is marked as delay signed.
If false and , , or is specified
or attribute System.Reflection.AssemblyKeyFileAttribute or System.Reflection.AssemblyKeyNameAttribute is applied to the
compilation assembly in source the resulting assembly is signed accordingly to the specified values/attributes.
If null the semantics is specified by the value of attribute System.Reflection.AssemblyDelaySignAttribute
applied to the compilation assembly in source. If the attribute is not present the value defaults to "false".
Mark the compilation assembly as fully signed, but only sign with the public key.
If true, the assembly is marked as signed, but is only signed with the public key.
The key must be provided through either an absolute path in
or directly via .
Whether bounds checking on integer arithmetic is enforced by default or not.
Specifies which version of the common language runtime (CLR) can run the assembly.
Specifies whether or not optimizations should be performed on the output IL.
This is independent of whether or not PDB information is generated.
Global warning report option
Global warning level (a non-negative integer).
Specifies whether building compilation may use multiple threads.
Specifies whether the compilation should be deterministic.
Used for time-based version generation when contains a wildcard.
If equal to default() the actual current local time will be used.
Emit mode that favors debuggability.
Specifies whether to import members with accessibility other than public or protected by default.
Default value is . The value specified is not going to
affect correctness of analysis performed by compilers because all members needed for correctness
are going to be imported regardless. This setting can force compilation to import members that it
normally doesn't.
Apply additional disambiguation rules during resolution of referenced assemblies.
Modifies the incoming diagnostic, for example escalating its severity, or discarding it (returning null) based on the compilation options.
The modified diagnostic, or null
Warning report option for each warning.
Provider to retrieve options for particular syntax trees.
Whether diagnostics suppressed in source, i.e. is true, should be reported.
Resolves paths to metadata references specified in source via #r directives.
Null if the compilation can't contain references to metadata other than those explicitly passed to its factory (such as #r directives in sources).
Gets the resolver for resolving XML document references for the compilation.
Null if the compilation is not allowed to contain XML file references, such as XML doc comment include tags and permission sets stored in an XML file.
Gets the resolver for resolving source document references for the compilation.
Null if the compilation is not allowed to contain source file references, such as #line pragmas and #load directives.
Provides strong name and signature the source assembly.
Null if assembly signing is not supported.
Used to compare assembly identities. May implement unification and portability policies specific to the target platform.
if not specified.
Gets the default nullable context state in this compilation.
This context does not apply to files that are marked as generated. Nullable is off
by default in those locations.
A set of strings designating experimental compiler features that are to be enabled.
Gets the source language ("C#" or "Visual Basic").
Creates a new options instance with the specified general diagnostic option.
Creates a new options instance with the specified diagnostic-specific options.
Creates a new options instance with the specified diagnostic-specific options.
Creates a new options instance with the specified suppressed diagnostics reporting option.
Creates a new options instance with the concurrent build property set accordingly.
Creates a new options instance with the deterministic property set accordingly.
Creates a new options instance with the specified output kind.
Creates a new options instance with the specified platform.
Creates a new options instance with the specified public sign setting.
Creates a new options instance with optimizations enabled or disabled.
Performs validation of options compatibilities and generates diagnostics if needed
Errors collection related to an incompatible set of compilation options
Represents the possible compilation stages for which it is possible to get diagnostics
(errors).
Provides information about statements which transfer control in and out of a region. This
information is returned from a call to .
The set of statements inside the region what are the
destination of branches outside the region.
The set of statements inside a region that jump to locations outside
the region.
Indicates whether a region completes normally. Return true if and only if the end of the
last statement in a region is reachable or the region contains no statements.
The set of return statements found within a region.
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.
Provides information about how data flows into and out of a region. This information is
returned from a call to
, or one of its language-specific overloads,
where you pass the first and last statements of the region as parameters.
"Inside" means those statements or ones between them. "Outside" are any other statements of the same method.
The set of local variables that are declared within a region. Note
that the region must be bounded by a method's body or a field's initializer, so
parameter symbols are never included in the result.
The set of local variables which are assigned a value outside a region
that may be used inside the region.
The set of local variables which are assigned a value inside a region
that may be used outside 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.
The set of local variables for which a value is always assigned inside
a region.
The set of local variables that are read inside a region.
The set of local variables that are written inside a region.
The set of the local variables that are read outside a region.
The set of local variables that are written outside a region.
The set of the local variables that have been referenced in anonymous
functions and therefore must be moved to a field of a frame class.
This is the union of and .
The set of variables that are captured inside a region.
The set of variables that are captured outside a region.
The set of non-constant local variables and parameters that have had their
address (or the address of one of their fields) taken.
The set of local functions that are used.
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.
The string returned from this function represents the inputs to the compiler which impact determinism. It is
meant to be inline with the specification here:
- https://github.com/dotnet/roslyn/blob/main/docs/compilers/Deterministic%20Inputs.md
Options which can cause compilation failure, but doesn't impact the result of a successful
compilation should be included. That is because it is interesting to describe error states
not just success states. Think about caching build failures as well as build successes.
When an option is omitted, say if there is no value for a public crypto key, we should emit
the property with a null value vs. omitting the property. Either approach would produce
correct results the preference is to be declarative that an option is omitted.
The default is to include all inputs to the compilation which impact the output of the
compilation: binaries or diagnostics.
Ignore all file paths, but still include file names, in the deterministic key.
This is useful for scenarios where the consumer is interested in the content of the
being the same but aren't concerned precisely with the file
path of the content. A typical example of this type of consumer is one that operates
in CI where the path changes frequently.
Ignore the versions of the tools contributing to the build (compiler and runtime)
Compiler output is not guaranteed to be deterministically equivalent between versions
but very often is for wide ranges of versions. This option is useful for consumers
who are comfortable ignoring the versions when looking at compiler output.
The result of the Compilation.Emit method.
True if the compilation successfully produced an executable.
If false then the diagnostics should include at least one error diagnostic
indicating the cause of the failure.
A list of all the diagnostics associated with compilations. This include parse errors, declaration errors,
compilation errors, and emitting errors.
Key used to group anonymous delegate templates by properties that are easy to infer from both source symbols and metadata.
Key used to group anonymous delegate templates by properties that are easy to infer from both source symbols and metadata.
Name of the anonymous type field.
True if the anonymous type field was marked as 'Key' in VB.
is case insensitive.
Represents additional info needed by async method implementation methods
(MoveNext methods) to properly emit necessary PDB data for async debugging.
IL offset of catch handler or -1
Set of IL offsets where await operators yield control
Set of IL offsets where await operators are to be resumed
Symbol changes when emitting EnC delta.
Previous EnC generation baseline, or null if this is not EnC delta.
True if this module is an EnC update.
EnC generation. 0 if the module is not an EnC delta, 1 if it is the first EnC delta, etc.
If this module represents an assembly, name of the assembly used in AssemblyDef table. Otherwise name of the module same as .
Name of the module. Used in ModuleDef table.
Public types defined in other modules making up this assembly and to which other assemblies may refer to via this assembly
followed by types forwarded to another assembly.
Used to distinguish which style to pick while writing native PDB information.
The PDB content for custom debug information is different between Visual Basic and CSharp.
E.g. C# always includes a CustomMetadata Header (MD2) that contains the namespace scope counts, where
as VB only outputs namespace imports into the namespace scopes.
C# defines forwards in that header, VB includes them into the scopes list.
Currently the compiler doesn't allow mixing C# and VB method bodies. Thus this flag can be per module.
It is possible to move this flag to per-method basis but native PDB CDI forwarding would need to be adjusted accordingly.
Linked assembly names to be stored to native PDB (VB only).
Project level imports (VB only, TODO: C# scripts).
Default namespace (VB only).
Additional top-level types injected by the Expression Evaluators.
Anonymous types defined in the compilation.
Top-level embedded types (e.g. attribute types that are not present in referenced assemblies).
Top-level named types defined in source.
A list of the files that constitute the assembly. Empty for netmodule. These are not the source language files that may have been
used to compile the assembly, but the files that contain constituent modules of a multi-module assembly as well
as any external resources. It corresponds to the File table of the .NET assembly file format.
Builds symbol definition to location map used for emitting token -> location info
into PDB to be consumed by WinMdExp.exe tool (only applicable for /t:winmdobj)
Builds a list of types, and their documents, that would otherwise not be referenced by any document info
of any methods in those types, or any nested types. This data is helpful for navigating to the source of
types that have no methods in one or more of the source files they are contained in.
For example:
First.cs:
partial class Outer
{
partial class Inner
{
public void Method()
{
}
}
}
/// Second.cs:
partial class Outer
{
partial class Inner
{
}
}
When navigating to the definition of "Outer" we know about First.cs because of the MethodDebugInfo for Outer.Inner.Method()
but there would be no document information for Second.cs so this method would return that information.
When navigating to "Inner" we likewise know about First.cs because of the MethodDebugInfo, and we know about Second.cs because
of the document info for its containing type, so this method would not return information for Inner. In fact this method
will never return information for any nested type.
Number of debug documents in the module.
Used to determine capacities of lists and indices when emitting debug info.
An approximate number of method definitions that can
provide a basis for approximating the capacities of
various databases used during Emit.
CorLibrary assembly referenced by this module.
Returns copy of User Strings referenced from the IL in the module.
Assembly reference aliases (C# only).
Common base class for C# and VB PE module builder.
Returns all top-level (not nested) types defined in the module.
Captures the set of synthesized definitions that should be added to a type
during emit process.
Returns null if there are no compiler generated types.
Returns null if there are no synthesized fields.
Returns null if there are no synthesized properties.
Returns null if there are no synthesized methods.
Debugging information associated with the specified method that is emitted by the compiler to support Edit and Continue.
Deserializes Edit and Continue method debug information from specified blobs.
Local variable slot map.
Lambda and closure map.
Invalid data.
Deserializes Edit and Continue method debug information from specified blobs.
Local variable slot map.
Lambda and closure map.
State machine suspension points, if the method is the MoveNext method of the state machine.
Invalid data.
Invalid data.
Invalid data.
Ordered by id.
Caches for named PE types.
Gets a for a given ,
if it is defined in the initial metadata or has been added since.
Returns method handle of a method symbol from the immediately preceding generation.
The method may have been defined in any preceding generation but symbol must be mapped to
the immediately preceding one.
Enumerates method symbols synthesized for the body of a given in the previous generation that are not synthesized for the current method body (if any).
Method from the previous generation.
Lambdas generated to the current version of the method. This includes both lambdas mapped to previous ones and newly introduced lambdas.
Constructs a deleted definition
The old definition of the member
Cache of type definitions used in signatures of deleted members. Used so that if a method 'C M(C c)' is deleted
we use the same instance for the method return type, and the parameter type.
Represents a type referenced from a deleted member (as distinct from a type that has been deleted). This is also
why it doesn't inherit from
Type definitions containing any changes (includes added types).
Cache of type definitions used in signatures of deleted members. Used so that if a method 'C M(C c)' is deleted
we use the same instance for the method return type, and the parameter type.
Return tokens for all updated debuggable methods.
Return tokens for all updated or added types.
Add an item from a previous generation
that has been updated in this generation.
Represents a module from a previous compilation. Used in Edit and Continue
to emit the differences in a subsequent compilation.
A map of the assembly identities of the baseline compilation to the identities of the original metadata AssemblyRefs.
Only includes identities that differ between these two.
Creates an from the metadata of the module before editing
and from a function that maps from a method to an array of local names.
Initial .
The metadata of the module before editing.
A function that for a method handle returns Edit and Continue debug information emitted by the compiler into the PDB.
The function shall throw if the debug information can't be read for the specified method.
This exception and are caught and converted to an emit diagnostic. Other exceptions are passed through.
A function that for a method handle returns the signature of its local variables.
The function shall throw if the information can't be read for the specified method.
This exception and are caught and converted to an emit diagnostic. Other exceptions are passed through.
True if the baseline PDB is portable.
An for the module.
Only the initial baseline is created using this method; subsequent baselines are created
automatically when emitting the differences in subsequent compilations.
When an active method (one for which a frame is allocated on a stack) is updated the values of its local variables need to be preserved.
The mapping of local variable names to their slots in the frame is not included in the metadata and thus needs to be provided by
.
The is only needed for the initial generation. The mapping for the subsequent generations
is carried over through . The compiler assigns slots to named local variables (including named temporary variables)
it the order in which they appear in the source code. This property allows the compiler to reconstruct the local variable mapping
for the initial generation. A subsequent generation may add a new variable in between two variables of the previous generation.
Since the slots of the previous generation variables need to be preserved the only option is to add these new variables to the end.
The slot ordering thus no longer matches the syntax ordering. It is therefore necessary to pass
to the next generation (rather than e.g. create new s from scratch based on metadata produced by subsequent compilations).
is null.
is null.
is null.
Error reading module metadata.
Module metadata is invalid.
Module has been disposed.
The original metadata of the module.
Metadata generation ordinal. Zero for
full metadata and non-zero for delta.
Unique Guid for this delta, or default(Guid)
if full metadata.
The latest generation number of each symbol added via edit.
Maps a parent handle to a non-empty ordered array of row ids of custom attributes added since the initial baseline.
EnC metadata for methods added or updated since the initial generation, indexed by method row id.
Reads EnC debug information of a method from the initial baseline PDB.
The function shall throw if the debug information can't be read for the specified method.
This exception and are caught and converted to an emit diagnostic. Other exceptions are passed through.
The function shall return an empty if the method that corresponds to the specified handle
has no debug information.
A function that for a method handle returns the signature of its local variables.
The function shall throw if the information can't be read for the specified method.
This exception and are caught and converted to an emit diagnostic. Other exceptions are passed through.
The function shall return a nil if the method that corresponds to the specified handle
has no local variables.
Handles of methods with sequence points that have been updated in this delta.
Handles of types that were changed (updated or inserted) in this delta.
Info to write to the PDB.
Id of the parent closure. Only relevant when emitting EnC delta.
Metadata names of fields of a struct closure that store variables captured by the closure. Null for class closures.
Only relevant when emitting EnC delta.
True if the closure being built is compatible with the previous one.
True if
- The parent closure hasn't changed
- Both closures are struct closures or neither is.
- The set of variables captured by the new struct closure
must be a subset of previously captured variables
(the runtime doesn't allow adding fields to structs).
True if the lambda being built is compatible with the previous one.
True if
- The closure ordinal of the previous lambda is the same as the current one.
It is not necessary to check that the generation of the closure matches.
Two closures of the same ordinal that differ in generation can only exist because the first closure was deleted (or regenerated due to a rude edit) in
an earlier generation and the latter closure corresponding to the same scope was added in a subsequent generation.
The above condition ensures that the current lambda syntax maps to an existing lambda syntax in the previous generation.
The closure the previous lambda is emitted to couldn't have been deleted.
Guarantees that the containing type of the synthesized method remains unchanged.
- The sequence of struct closures the local function captures is preserved.
Guarantees that the signature of the synthesized method remains unchanged.
When invoked on a node that represents an anonymous function or a query clause [1]
with a of another anonymous function or a query clause of the same kind [2],
returns the body of the [1] that positionally corresponds to the specified .
E.g. join clause declares left expression and right expression -- each of these expressions is a lambda body.
JoinClause1.GetCorrespondingLambdaBody(JoinClause2.RightExpression) returns JoinClause1.RightExpression.
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.
No change to symbol or members.
No change to symbol but may contain changed symbols.
Symbol updated.
Symbol added.
Maps definitions being emitted to the corresponding definitions defined in the previous generation (metadata or source).
Contains all symbols from the current compilation that were explicitly updated/added to the source and
their containing types and namespaces.
A set of symbols whose name emitted to metadata must include a "#{generation}" suffix to avoid naming collisions with existing types.
Populated based on semantic edits with .
A set of symbols, from the old compilation, that have been deleted from the new compilation
keyed by the containing type from the new compilation.
Populated based on semantic edits with .
Updated methods.
True if the symbol is a source symbol added during EnC session.
The symbol may be declared in any source compilation in the current solution.
Returns true if the symbol or some child symbol has changed and needs to be compiled.
Calculate the set of changes up to top-level types. The result
will be used as a filter when traversing the module.
Note that these changes only include user-defined source symbols, not synthesized symbols since those will be
generated during lowering of the changed user-defined symbols.
Return the symbol that contains this symbol as far
as changes are concerned. For instance, an auto property
is considered the containing symbol for the backing
field and the accessor methods. By default, the containing
symbol is simply Symbol.ContainingSymbol.
Merges synthesized or deleted members generated during lowering, or emit, of the current compilation with aggregate
synthesized or deleted members from all previous source generations (gen >= 1).
Suppose {S -> {A, B, D}, T -> {E, F}} are all synthesized members in previous generations,
and {S' -> {A', B', C}, U -> {G, H}} members are generated in the current compilation.
Where X matches X' via this matcher, i.e. X' is from the new compilation and
represents the same metadata entity as X in the previous compilation.
Then the resulting collection shall have the following entries:
{S' -> {A', B', C, D}, U -> {G, H}, T -> {E, F}}
In C#, this is the set of anonymous types only; in VB, this is the set of anonymous types and delegates.
In C#, the set of anonymous delegates with name fully determined by signature;
in VB, this set is unused and empty.
A map of the assembly identities of the baseline compilation to the identities of the original metadata AssemblyRefs.
Only includes identities that differ between these two.
Represents compilation emit options.
True to emit an assembly excluding executable code such as method bodies.
Tolerate errors, producing a PE stream and a success result even in the presence of (some) errors.
Unless set (private) members that don't affect the language semantics of the resulting assembly will be excluded
when emitting metadata-only assemblies as primary output (with on).
If emitting a secondary output, this flag is required to be false.
Type of instrumentation that should be added to the output binary.
Subsystem version
Specifies the size of sections in the output file.
Valid values are 0, 512, 1024, 2048, 4096 and 8192.
If the value is 0 the file alignment is determined based upon the value of .
True to enable high entropy virtual address space for the output binary.
Specifies the preferred base address at which to load the output DLL.
Debug information format.
Assembly name override - file name and extension. If not specified the compilation name is used.
By default the name of the output assembly is . Only in rare cases it is necessary
to override the name.
CAUTION: If this is set to a (non-null) value other than the existing compilation output name, then internals-visible-to
and assembly references may not work as expected. In particular, things that were visible at bind time, based on the
name of the compilation, may not be visible at runtime and vice-versa.
The name of the PDB file to be embedded in the PE image, or null to use the default.
If not specified the file name of the source module with an extension changed to "pdb" is used.
A crypto hash algorithm used to calculate PDB Checksum stored in the PE/COFF File.
If not specified (the value is default(HashAlgorithmName)) the checksum is not calculated.
Runtime metadata version.
The encoding used to parse source files that do not have a Byte Order Mark. If specified,
is stored in the emitted PDB in order to allow recreating the original compilation.
If is not specified, the encoding used to parse source files
that do not declare their encoding via Byte Order Mark and are not UTF-8 encoded.
Test only - allows us to test .
Sets the byte alignment for portable executable file sections.
Can be one of the following values: 0, 512, 1024, 2048, 4096, 8192
Error type symbols should be replaced with an object of this class
in the translation layer for emit.
For the name we will use a word "Error" followed by a guid, generated on the spot.
A fake containing assembly for an ErrorType object.
For the name we will use a word "Error" followed by a guid, generated on the spot.
Specifies a kind of instrumentation to be applied in generated code.
No instrumentation.
Instruments the code to add test coverage.
Instruments all methods, local functions and lambdas in the code with calls to ,
to guard against accidental stack overflow.
Instruments code with calls to on a module-level defined
to enable cancellation of code that hasn't necessarily been written as cancellable.
The is emitted to a static field <PrivateImplementationDetails>.ModuleCancellationToken
.
Represents additional info needed by iterator method implementation methods
(MoveNext methods) to properly emit necessary PDB data for iterator debugging.
Represents instrumentation of a method.
Kinds of instrumentation to apply to the entire method body.
This is only used for testing.
This is only used for testing.
This is only used for testing.
Returns null if member doesn't belong to an embedded NoPia type.
Describes rude edit to be reported at runtime.
Error message.
Describes rude edit to be reported at runtime.
Error message.
Describes a symbol edit between two compilations.
For example, an addition of a method, an update of a method, removal of a type, etc.
The type of edit.
The symbol from the earlier compilation,
or null if the edit represents an addition.
The symbol from the later compilation, or the symbol of the containing type
from the later compilation if the edit represents a deletion.
A map from syntax node in the later compilation to syntax node in the previous compilation,
or null if is false and the map is not needed or
the source of the current method is the same as the source of the previous method.
The map does not need to map all syntax nodes in the active method, only those syntax nodes
that declare a local or generate a long lived local.
Associates a syntax node in the later compilation to an error that should be
reported at runtime by the IL generated for the node, if any.
Instrumentation update to be applied to a method.
If not empty, and must be non-null s, and
must be .
Initializes an instance of .
The type of edit.
The symbol from the earlier compilation, or null if the edit represents an addition.
The symbol from the later compilation, or the symbol of the containing type
from the later compilation if is .
A map from syntax node in the later compilation to syntax node in the previous compilation,
or null if the method state (locals, closures, etc.) doesn't need to be preserved.
Instrumentation update to be applied to a method.
or is null and the edit isn't a or , respectively.
is not a valid kind.
True if is not null.
s are considered equal if they are of the same and
the corresponding and symbols are the same.
The effects of edits that compare equal on the emitted metadata/IL are not necessarily the same.
No change.
Symbol is updated.
Symbol is inserted.
Symbol is deleted.
Existing symbol is replaced by its new version.
Information associated with method body of a state machine MoveNext method.
Original async/iterator method transformed into MoveNext()
Represents an invalid operation with one or more child operations.
Current usage:
- C# invalid expression or invalid statement
- VB invalid expression or invalid statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a block containing a sequence of operations and local declarations.
Current usage:
- C# "{ ... }" block statement
- VB implicit block statement for method bodies and other block scoped statements
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operations contained within the block.
Local declarations contained within the block.
Represents a variable declaration statement.
Current Usage:
- C# local declaration statement
- C# fixed statement
- C# using statement
- C# using declaration
- VB Dim statement
- VB Using statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Variable declaration in the statement.
In C#, this will always be a single declaration, with all variables in .
Represents a switch operation with a value to be switched upon and switch cases.
Current usage:
- C# switch statement
- VB Select Case statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Locals declared within the switch operation with scope spanning across all .
Value to be switched upon.
Cases of the switch.
Exit label for the switch statement.
Represents a loop operation.
Current usage:
- C# 'while', 'for', 'foreach' and 'do' loop statements
- VB 'While', 'ForTo', 'ForEach', 'Do While' and 'Do Until' loop statements
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of the loop.
Body of the loop.
Declared locals.
Loop continue label.
Loop exit/break label.
Represents a for each loop.
Current usage:
- C# 'foreach' loop statement
- VB 'For Each' loop statement
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Refers to the operation for declaring a new local variable or reference an existing variable or an expression.
Collection value over which the loop iterates.
Optional list of comma separated next variables at loop bottom in VB.
This list is always empty for C#.
Whether this for each loop is asynchronous.
Always false for VB.
Represents a for loop.
Current usage:
- C# 'for' loop statement
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
List of operations to execute before entry to the loop. For C#, this comes from the first clause of the for statement.
Locals declared within the loop Condition and are in scope throughout the ,
and .
They are considered to be declared per iteration.
Condition of the loop. For C#, this comes from the second clause of the for statement.
List of operations to execute at the bottom of the loop. For C#, this comes from the third clause of the for statement.
Represents a for to loop with loop control variable and initial, limit and step values for the control variable.
Current usage:
- VB 'For ... To ... Step' loop statement
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Refers to the operation for declaring a new local variable or reference an existing variable or an expression.
Operation for setting the initial value of the loop control variable. This comes from the expression between the 'For' and 'To' keywords.
Operation for the limit value of the loop control variable. This comes from the expression after the 'To' keyword.
Operation for the step value of the loop control variable. This comes from the expression after the 'Step' keyword,
or inferred by the compiler if 'Step' clause is omitted.
if arithmetic operations behind this loop are 'checked'.
Optional list of comma separated next variables at loop bottom.
Represents a while or do while loop.
Current usage:
- C# 'while' and 'do while' loop statements
- VB 'While', 'Do While' and 'Do Until' loop statements
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Condition of the loop. This can only be null in error scenarios.
True if the is evaluated at start of each loop iteration.
False if it is evaluated at the end of each loop iteration.
True if the loop has 'Until' loop semantics and the loop is executed while is false.
Additional conditional supplied for loop in error cases, which is ignored by the compiler.
For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided.
The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property.
This property should be null for all non-error cases.
Represents an operation with a label.
Current usage:
- C# labeled statement
- VB label statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Label that can be the target of branches.
Operation that has been labeled. In VB, this is always null.
Represents a branch operation.
Current usage:
- C# goto, break, or continue statement
- VB GoTo, Exit ***, or Continue *** statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Label that is the target of the branch.
Kind of the branch.
Represents an empty or no-op operation.
Current usage:
- C# empty statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a return from the method with an optional return value.
Current usage:
- C# return statement and yield statement
- VB Return statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Value to be returned.
Represents a of operations that are executed while holding a lock onto the .
Current usage:
- C# lock statement
- VB SyncLock statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operation producing a value to be locked.
Body of the lock, to be executed while holding the lock.
Represents a try operation for exception handling code with a body, catch clauses and a finally handler.
Current usage:
- C# try statement
- VB Try statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Body of the try, over which the handlers are active.
Catch clauses of the try.
Finally handler of the try.
Exit label for the try. This will always be null for C#.
Represents a of operations that are executed while using disposable .
Current usage:
- C# using statement
- VB Using statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Declaration introduced or resource held by the using.
Body of the using, over which the resources of the using are maintained.
Locals declared within the with scope spanning across this entire .
Whether this using is asynchronous.
Always false for VB.
Represents an operation that drops the resulting value and the type of the underlying wrapped .
Current usage:
- C# expression statement
- VB expression statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Underlying operation with a value and type.
Represents a local function defined within a method.
Current usage:
- C# local function statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Local function symbol.
Body of the local function.
This can be null in error scenarios, or when the method is an extern method.
An extra body for the local function, if both a block body and expression body are specified in source.
This is only ever non-null in error situations.
Represents an operation to stop or suspend execution of code.
Current usage:
- VB Stop statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an operation that stops the execution of code abruptly.
Current usage:
- VB End Statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an operation for raising an event.
Current usage:
- VB raise event statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Reference to the event to be raised.
Arguments of the invocation, excluding the instance argument. Arguments are in evaluation order.
If the invocation is in its expanded form, then params/ParamArray arguments would be collected into arrays.
Default values are supplied for optional arguments missing in source.
Represents a textual literal numeric, string, etc.
Current usage:
- C# literal expression
- VB literal expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a type conversion.
Current usage:
- C# conversion expression
- VB conversion expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Value to be converted.
Operator method used by the operation, null if the operation does not use an operator method.
Type parameter which runtime type will be used to resolve virtual invocation of the , if any.
Null if is resolved statically, or is null.
Gets the underlying common conversion information.
If you need conversion information that is language specific, use either
or
.
False if the conversion will fail with a at runtime if the cast fails. This is true for C#'s
as operator and for VB's TryCast operator.
True if the conversion can fail at runtime with an overflow exception. This corresponds to C# checked and unchecked blocks.
Represents an invocation of a method.
Current usage:
- C# method invocation expression
-
C# collection element initializer.
For example, in the following collection initializer: new C() { 1, 2, 3 }, we will have
3 nodes, each of which will be a call to the corresponding Add method
with either 1, 2, 3 as the argument
- VB method invocation expression
-
VB collection element initializer.
Similar to the C# example, New C() From {1, 2, 3} will have 3
nodes with 1, 2, and 3 as their arguments, respectively
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Method to be invoked.
Type parameter which runtime type will be used to resolve virtual invocation of the .
Null if is resolved statically, or is an instance method.
'This' or 'Me' instance to be supplied to the method, or null if the method is static.
True if the invocation uses a virtual mechanism, and false otherwise.
Arguments of the invocation, excluding the instance argument. Arguments are in evaluation order.
If the invocation is in its expanded form, then params/ParamArray arguments would be collected into arrays.
Default values are supplied for optional arguments missing in source.
Represents a reference to an array element.
Current usage:
- C# array element reference expression
- VB array element reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Array to be indexed.
Indices that specify an individual element.
Represents a reference to a declared local variable.
Current usage:
- C# local reference expression
- VB local reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Referenced local variable.
True if this reference is also the declaration site of this variable. This is true in out variable declarations
and in deconstruction operations where a new variable is being declared.
Represents a reference to a parameter.
Current usage:
- C# parameter reference expression
- VB parameter reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Referenced parameter.
Represents a reference to a member of a class, struct, or interface.
Current usage:
- C# member reference expression
- VB member reference expression
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Instance of the type. Null if the reference is to a static/shared member.
Referenced member.
Type parameter which runtime type will be used to resolve virtual invocation of the .
Null if is resolved statically, or is an instance member.
Represents a reference to a field.
Current usage:
- C# field reference expression
- VB field reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Referenced field.
If the field reference is also where the field was declared.
This is only ever true in CSharp scripts, where a top-level statement creates a new variable
in a reference, such as an out variable declaration or a deconstruction declaration.
Represents a reference to a method other than as the target of an invocation.
Current usage:
- C# method reference expression
- VB method reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Referenced method.
Indicates whether the reference uses virtual semantics.
Represents a reference to a property.
Current usage:
- C# property reference expression
- VB property reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Referenced property.
Arguments of the indexer property reference, excluding the instance argument. Arguments are in evaluation order.
If the invocation is in its expanded form, then params/ParamArray arguments would be collected into arrays.
Default values are supplied for optional arguments missing in source.
Represents a reference to an event.
Current usage:
- C# event reference expression
- VB event reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Referenced event.
Represents an operation with one operand and a unary operator.
Current usage:
- C# unary operation expression
- VB unary operation expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of unary operation.
Operand.
if this is a 'lifted' unary operator. When there is an
operator that is defined to work on a value type, 'lifted' operators are
created to work on the versions of those
value types.
if overflow checking is performed for the arithmetic operation.
Operator method used by the operation, null if the operation does not use an operator method.
Type parameter which runtime type will be used to resolve virtual invocation of the , if any.
Null if is resolved statically, or is null.
Represents an operation with two operands and a binary operator that produces a result with a non-null type.
Current usage:
- C# binary operator expression
- VB binary operator expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of binary operation.
Left operand.
Right operand.
if this is a 'lifted' binary operator. When there is an
operator that is defined to work on a value type, 'lifted' operators are
created to work on the versions of those
value types.
if this is a 'checked' binary operator.
if the comparison is text based for string or object comparison in VB.
Operator method used by the operation, null if the operation does not use an operator method.
Type parameter which runtime type will be used to resolve virtual invocation of the
or corresponding true/false operator, if any.
Null if operators are resolved statically, or are not used.
Represents a conditional operation with:
- to be tested
- operation to be executed when is true and
- operation to be executed when the is false
Current usage:
- C# ternary expression a ? b : c and if statement
- VB ternary expression If(a, b, c) and If Else statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Condition to be tested.
Operation to be executed if the is true.
Operation to be executed if the is false.
Is result a managed reference
Represents a coalesce operation with two operands:
- , which is the first operand that is unconditionally evaluated and is the result of the operation if non null
- , which is the second operand that is conditionally evaluated and is the result of the operation if is null
Current usage:
- C# null-coalescing expression Value ?? WhenNull
- VB binary conditional expression If(Value, WhenNull)
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operation to be unconditionally evaluated.
Operation to be conditionally evaluated if evaluates to null/Nothing.
Conversion associated with when it is not null/Nothing.
Identity if result type of the operation is the same as type of .
Otherwise, if type of is nullable, then conversion is applied to an
unwrapped , otherwise to the itself.
Represents an anonymous function operation.
Current usage:
- C# lambda expression
- VB anonymous delegate expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Symbol of the anonymous function.
Body of the anonymous function.
Represents creation of an object instance.
Current usage:
- C# new expression
- VB New expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Constructor to be invoked on the created instance.
Object or collection initializer, if any.
Arguments of the object creation, excluding the instance argument. Arguments are in evaluation order.
If the invocation is in its expanded form, then params/ParamArray arguments would be collected into arrays.
Default values are supplied for optional arguments missing in source.
Represents a creation of a type parameter object, i.e. new T(), where T is a type parameter with new constraint.
Current usage:
- C# type parameter object creation expression
- VB type parameter object creation expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Object or collection initializer, if any.
Represents the creation of an array instance.
Current usage:
- C# array creation expression
- VB array creation expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Sizes of the dimensions of the created array instance.
Values of elements of the created array instance.
Represents an implicit/explicit reference to an instance.
Current usage:
- C# this or base expression
- VB Me, MyClass, or MyBase expression
- C# object or collection or 'with' expression initializers
- VB With statements, object or collection initializers
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The kind of reference that is being made.
Represents an operation that tests if a value is of a specific type.
Current usage:
- C# "is" operator expression
- VB "TypeOf" and "TypeOf IsNot" expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Value to test.
Type for which to test.
Flag indicating if this is an "is not" type expression.
True for VB "TypeOf ... IsNot ..." expression.
False, otherwise.
Represents an await operation.
Current usage:
- C# await expression
- VB await expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Awaited operation.
Represents a base interface for assignments.
Current usage:
- C# simple, compound and deconstruction assignment expressions
- VB simple and compound assignment expressions
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Target of the assignment.
Value to be assigned to the target of the assignment.
Represents a simple assignment operation.
Current usage:
- C# simple assignment expression
- VB simple assignment expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Is this a ref assignment
Represents a compound assignment that mutates the target with the result of a binary operation.
Current usage:
- C# compound assignment expression
- VB compound assignment expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Conversion applied to before the operation occurs.
Conversion applied to the result of the binary operation, before it is assigned back to
.
Kind of binary operation.
if this assignment contains a 'lifted' binary operation.
if overflow checking is performed for the arithmetic operation.
Operator method used by the operation, null if the operation does not use an operator method.
Type parameter which runtime type will be used to resolve virtual invocation of the , if any.
Null if is resolved statically, or is null.
Represents a parenthesized operation.
Current usage:
- VB parenthesized expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operand enclosed in parentheses.
Represents a binding of an event.
Current usage:
- C# event assignment expression
- VB Add/Remove handler statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Reference to the event being bound.
Handler supplied for the event.
True for adding a binding, false for removing one.
Represents a conditionally accessed operation. Note that is used to refer to the value
of within .
Current usage:
- C# conditional access expression (? or ?. operator)
- VB conditional access expression (? or ?. operator)
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operation that will be evaluated and accessed if non null.
Operation to be evaluated if is non null.
Represents the value of a conditionally-accessed operation within .
For a conditional access operation of the form someExpr?.Member, this operation is used as the InstanceReceiver for the right operation Member.
See https://github.com/dotnet/roslyn/issues/21279#issuecomment-323153041 for more details.
Current usage:
- C# conditional access instance expression
- VB conditional access instance expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an interpolated string.
Current usage:
(1) C# interpolated string expression.
(2) VB interpolated string expression.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Constituent parts of interpolated string, each of which is an .
Represents a creation of anonymous object.
Current usage:
- C# new { ... } expression
- VB New With { ... } expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Property initializers.
Each initializer is an , with an
as the target whose Instance is an with kind.
Represents an initialization for an object or collection creation.
Current usage:
-
C# object or collection initializer expression.
For example, object initializer { X = x } within object creation new Class() { X = x } and
collection initializer { x, y, 3 } within collection creation new MyList() { x, y, 3 }
- VB object or collection initializer expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Object member or collection initializers.
Represents an initialization of member within an object initializer with a nested object or collection initializer.
Current usage:
-
C# nested member initializer expression.
For example, given an object creation with initializer new Class() { X = x, Y = { x, y, 3 }, Z = { X = z } },
member initializers for Y and Z, i.e. Y = { x, y, 3 }, and Z = { X = z } are nested member initializers represented by this operation
- VB object or collection initializer expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Initialized member reference or an invalid operation for error cases.
Member initializer.
Obsolete interface that used to represent a collection element initializer. It has been replaced by
and , as appropriate.
Current usage:
None. This API has been obsoleted in favor of and .
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an operation that gets a string value for the name.
Current usage:
- C# nameof expression
- VB NameOf expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Argument to the name of operation.
Represents a tuple with one or more elements.
Current usage:
- C# tuple expression
- VB tuple expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Tuple elements.
Natural type of the tuple, or null if tuple doesn't have a natural type.
Natural type can be different from depending on the
conversion context, in which the tuple is used.
Represents an object creation with a dynamically bound constructor.
Current usage:
- C# new expression with dynamic argument(s)
- VB late bound New expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Object or collection initializer, if any.
Dynamically bound arguments, excluding the instance argument.
Represents a reference to a member of a class, struct, or module that is dynamically bound.
Current usage:
- C# dynamic member reference expression
- VB late bound member reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Instance receiver, if it exists.
Referenced member.
Type arguments.
The containing type of the referenced member, if different from type of the .
Represents a invocation that is dynamically bound.
Current usage:
- C# dynamic invocation expression
-
C# dynamic collection element initializer.
For example, in the following collection initializer: new C() { do1, do2, do3 } where
the doX objects are of type dynamic, we'll have 3 with do1, do2, and
do3 as their arguments
- VB late bound invocation expression
-
VB dynamic collection element initializer.
Similar to the C# example, New C() From {do1, do2, do3} will generate 3
nodes with do1, do2, and do3 as their arguments, respectively
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Dynamically or late bound operation.
Dynamically bound arguments, excluding the instance argument.
Represents an indexer access that is dynamically bound.
Current usage:
- C# dynamic indexer access expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Dynamically indexed operation.
Dynamically bound arguments, excluding the instance argument.
Represents an unrolled/lowered query operation.
For example, for a C# query expression "from x in set where x.Name != null select x.Name", the Operation tree has the following shape:
ITranslatedQueryExpression
IInvocationExpression ('Select' invocation for "select x.Name")
IInvocationExpression ('Where' invocation for "where x.Name != null")
IInvocationExpression ('From' invocation for "from x in set")
Current usage:
- C# query expression
- VB query expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Underlying unrolled operation.
Represents a delegate creation. This is created whenever a new delegate is created.
Current usage:
- C# delegate creation expression
- VB delegate creation expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The lambda or method binding that this delegate is created from.
Represents a default value operation.
Current usage:
- C# default value expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an operation that gets for the given .
Current usage:
- C# typeof expression
- VB GetType expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Type operand.
Represents an operation to compute the size of a given type.
Current usage:
- C# sizeof expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Type operand.
Represents an operation that creates a pointer value by taking the address of a reference.
Current usage:
- C# address of expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Addressed reference.
Represents an operation that tests if a value matches a specific pattern.
Current usage:
- C# is pattern expression. For example, x is int i
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Underlying operation to test.
Pattern.
Represents an or operation.
Note that this operation is different from an as it mutates the ,
while unary operator expression does not mutate it's operand.
Current usage:
- C# increment expression or decrement expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
if this is a postfix expression. if this is a prefix expression.
if this is a 'lifted' increment operator. When there
is an operator that is defined to work on a value type, 'lifted' operators are
created to work on the versions of those
value types.
if overflow checking is performed for the arithmetic operation.
Target of the assignment.
Operator method used by the operation, null if the operation does not use an operator method.
Type parameter which runtime type will be used to resolve virtual invocation of the , if any.
Null if is resolved statically, or is null.
Represents an operation to throw an exception.
Current usage:
- C# throw expression
- C# throw statement
- VB Throw statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Instance of an exception being thrown.
Represents a assignment with a deconstruction.
Current usage:
- C# deconstruction assignment expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a declaration expression operation. Unlike a regular variable declaration and , this operation represents an "expression" declaring a variable.
Current usage:
-
C# deconstruction assignment expression. For example:
- var (x, y) is a deconstruction declaration expression with variables x and y
- (var x, var y) is a tuple expression with two declaration expressions
- M(out var x); is an invocation expression with an out var x declaration expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Underlying expression.
Represents an argument value that has been omitted in an invocation.
Current usage:
- VB omitted argument in an invocation expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an initializer for a field, property, parameter or a local variable declaration.
Current usage:
- C# field, property, parameter or local variable initializer
- VB field(s), property, parameter or local variable initializer
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Local declared in and scoped to the .
Underlying initializer value.
Represents an initialization of a field.
Current usage:
- C# field initializer with equals value clause
- VB field(s) initializer with equals value clause or AsNew clause. Multiple fields can be initialized with AsNew clause in VB
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Initialized fields. There can be multiple fields for Visual Basic fields declared with AsNew clause.
Represents an initialization of a local variable.
Current usage:
- C# local variable initializer with equals value clause
- VB local variable initializer with equals value clause or AsNew clause
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents an initialization of a property.
Current usage:
- C# property initializer with equals value clause
- VB property initializer with equals value clause or AsNew clause. Multiple properties can be initialized with 'WithEvents' declaration with AsNew clause in VB
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Initialized properties. There can be multiple properties for Visual Basic 'WithEvents' declaration with AsNew clause.
Represents an initialization of a parameter at the point of declaration.
Current usage:
- C# parameter initializer with equals value clause
- VB parameter initializer with equals value clause
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Initialized parameter.
Represents the initialization of an array instance.
Current usage:
- C# array initializer
- VB array initializer
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Values to initialize array elements.
Represents a single variable declarator and initializer.
Current Usage:
- C# variable declarator
- C# catch variable declaration
- VB single variable declaration
- VB catch variable declaration
In VB, the initializer for this node is only ever used for explicit array bounds initializers. This node corresponds to
the VariableDeclaratorSyntax in C# and the ModifiedIdentifierSyntax in VB.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Symbol declared by this variable declaration
Optional initializer of the variable.
If this variable is in an , the initializer may be located
in the parent operation. Call
to check in all locations. It is only possible to have initializers in both locations in VB invalid code scenarios.
Additional arguments supplied to the declarator in error cases, ignored by the compiler. This only used for the C# case of
DeclaredArgumentSyntax nodes on a VariableDeclaratorSyntax.
Represents a declarator that declares multiple individual variables.
Current Usage:
- C# VariableDeclaration
- C# fixed declarations
- VB Dim statement declaration groups
- VB Using statement variable declarations
The initializer of this node is applied to all individual declarations in . There cannot
be initializers in both locations except in invalid code scenarios.
In C#, this node will never have an initializer.
This corresponds to the VariableDeclarationSyntax in C#, and the VariableDeclaratorSyntax in Visual Basic.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Individual variable declarations declared by this multiple declaration.
All will have at least 1 ,
even if the declaration group only declares 1 variable.
Optional initializer of the variable.
In C#, this will always be null.
Array dimensions supplied to an array declaration in error cases, ignored by the compiler. This is only used for the C# case of
RankSpecifierSyntax nodes on an ArrayTypeSyntax.
Represents an argument to a method invocation.
Current usage:
- C# argument to an invocation expression, object creation expression, etc.
- VB argument to an invocation expression, object creation expression, etc.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of argument.
Parameter the argument matches. This can be null for __arglist parameters.
Value supplied for the argument.
Information of the conversion applied to the argument value passing it into the target method. Applicable only to VB Reference arguments.
Information of the conversion applied to the argument value after the invocation. Applicable only to VB Reference arguments.
Represents a catch clause.
Current usage:
- C# catch clause
- VB Catch clause
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Optional source for exception. This could be any of the following operation:
1. Declaration for the local catch variable bound to the caught exception (C# and VB) OR
2. Null, indicating no declaration or expression (C# and VB)
3. Reference to an existing local or parameter (VB) OR
4. Other expression for error scenarios (VB)
Type of the exception handled by the catch clause.
Locals declared by the and/or clause.
Filter operation to be executed to determine whether to handle the exception.
Body of the exception handler.
Represents a switch case section with one or more case clauses to match and one or more operations to execute within the section.
Current usage:
- C# switch section for one or more case clause and set of statements to execute
- VB case block with a case statement for one or more case clause and set of statements to execute
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Clauses of the case.
One or more operations to execute within the switch section.
Locals declared within the switch case section scoped to the section.
Represents a case clause.
Current usage:
- C# case clause
- VB Case clause
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of the clause.
Label associated with the case clause, if any.
Represents a default case clause.
Current usage:
- C# default clause
- VB Case Else clause
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a case clause with a pattern and an optional guard operation.
Current usage:
(1) C# pattern case clause.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Label associated with the case clause.
Pattern associated with case clause.
Guard associated with the pattern case clause.
Represents a case clause with range of values for comparison.
Current usage:
- VB range case clause of the form Case x To y
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Minimum value of the case range.
Maximum value of the case range.
Represents a case clause with custom relational operator for comparison.
Current usage:
- VB relational case clause of the form Case Is op x
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Case value.
Relational operator used to compare the switch value with the case value.
Represents a case clause with a single value for comparison.
Current usage:
- C# case clause of the form case x
- VB case clause of the form Case x
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Case value.
Represents a constituent part of an interpolated string.
Current usage:
- C# interpolated string content
- VB interpolated string content
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a constituent string literal part of an interpolated string operation.
Current usage:
- C# interpolated string text
- VB interpolated string text
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Text content.
Represents a constituent interpolation part of an interpolated string operation.
Current usage:
- C# interpolation part
- VB interpolation part
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Expression of the interpolation.
Optional alignment of the interpolation.
Optional format string of the interpolation.
Represents a pattern matching operation.
Current usage:
- C# pattern
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The input type to the pattern-matching operation.
The narrowed type of the pattern-matching operation.
Represents a pattern with a constant value.
Current usage:
- C# constant pattern
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Constant value of the pattern operation.
Represents a pattern that declares a symbol.
Current usage:
- C# declaration pattern
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The type explicitly specified, or null if it was inferred (e.g. using in C#).
True if the pattern is of a form that accepts null.
For example, in C# the pattern `var x` will match a null input,
while the pattern `string x` will not.
Symbol declared by the pattern, if any.
Represents a comparison of two operands that returns a bool type.
Current usage:
- C# tuple binary operator expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of binary operation.
Left operand.
Right operand.
Represents a method body operation.
Current usage:
- C# method body
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Method body corresponding to BaseMethodDeclarationSyntax.Body or AccessorDeclarationSyntax.Body
Method body corresponding to BaseMethodDeclarationSyntax.ExpressionBody or AccessorDeclarationSyntax.ExpressionBody
Represents a method body operation.
Current usage:
- C# method body for non-constructor
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a constructor method body operation.
Current usage:
- C# method body for constructor declaration
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Local declarations contained within the .
Constructor initializer, if any.
Represents a discard operation.
Current usage:
- C# discard expressions
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The symbol of the discard operation.
Represents a coalesce assignment operation with a target and a conditionally-evaluated value:
- is evaluated for null. If it is null, is evaluated and assigned to target
- is conditionally evaluated if is null, and the result is assigned into
The result of the entire expression is , which is only evaluated once.
Current usage:
- C# null-coalescing assignment operation Target ??= Value
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a range operation.
Current usage:
- C# range expressions
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Left operand.
Right operand.
if this is a 'lifted' range operation. When there is an
operator that is defined to work on a value type, 'lifted' operators are
created to work on the versions of those
value types.
Factory method used to create this Range value. Can be null if appropriate
symbol was not found.
Represents the ReDim operation to re-allocate storage space for array variables.
Current usage:
- VB ReDim statement
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Individual clauses of the ReDim operation.
Modifier used to preserve the data in the existing array when you change the size of only the last dimension.
Represents an individual clause of an to re-allocate storage space for a single array variable.
Current usage:
- VB ReDim clause
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operand whose storage space needs to be re-allocated.
Sizes of the dimensions of the created array instance.
Represents a C# recursive pattern.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The type accepted for the recursive pattern.
The symbol, if any, used for the fetching values for subpatterns. This is either a Deconstruct
method, the type System.Runtime.CompilerServices.ITuple, or null (for example, in
error cases or when matching a tuple type).
This contains the patterns contained within a deconstruction or positional subpattern.
This contains the (symbol, property) pairs within a property subpattern.
Symbol declared by the pattern.
Represents a discard pattern.
Current usage:
- C# discard pattern
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a switch expression.
Current usage:
- C# switch expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Value to be switched upon.
Arms of the switch expression.
True if the switch expressions arms cover every possible input value.
Represents one arm of a switch expression.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The pattern to match.
Guard (when clause expression) associated with the switch arm, if any.
Result value of the enclosing switch expression when this arm matches.
Locals declared within the switch arm (e.g. pattern locals and locals declared in the guard) scoped to the arm.
Represents an element of a property subpattern, which identifies a member to be matched and the
pattern to match it against.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The member being matched in a property subpattern. This can be a
in non-error cases, or an in error cases.
The pattern to which the member is matched in a property subpattern.
Represents a standalone VB query Aggregate operation with more than one item in Into clause.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a C# fixed statement.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Locals declared.
Variables to be fixed.
Body of the fixed, over which the variables are fixed.
Represents a creation of an instance of a NoPia interface, i.e. new I(), where I is an embedded NoPia interface.
Current usage:
- C# NoPia interface instance creation expression
- VB NoPia interface instance creation expression
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Object or collection initializer, if any.
Represents a general placeholder when no more specific kind of placeholder is available.
A placeholder is an expression whose meaning is inferred from context.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a reference through a pointer.
Current usage:
- C# pointer indirection reference expression
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Pointer to be dereferenced.
Represents a of operations that are executed with implicit reference to the for member references.
Current usage:
- VB With statement
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Body of the with.
Value to whose members leading-dot-qualified references within the with body bind.
Represents using variable declaration, with scope spanning across the parent .
Current Usage:
- C# using declaration
- C# asynchronous using declaration
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The variables declared by this using declaration.
True if this is an asynchronous using declaration.
Represents a negated pattern.
Current usage:
- C# negated pattern
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The negated pattern.
Represents a binary ("and" or "or") pattern.
Current usage:
- C# "and" and "or" patterns
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Kind of binary pattern; either or .
The pattern on the left.
The pattern on the right.
Represents a pattern comparing the input with a given type.
Current usage:
- C# type pattern
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The type explicitly specified, or null if it was inferred (e.g. using in C#).
Represents a pattern comparing the input with a constant value using a relational operator.
Current usage:
- C# relational pattern
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The kind of the relational operator.
Constant value of the pattern operation.
Represents cloning of an object instance.
Current usage:
- C# with expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Operand to be cloned.
Clone method to be invoked on the value. This can be null in error scenarios.
With collection initializer.
Represents an interpolated string converted to a custom interpolated string handler type.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The construction of the interpolated string handler instance. This can be an for valid code, and
or for invalid code.
True if the last parameter of is an out parameter that will be checked before executing the code in
. False otherwise.
True if the AppendLiteral or AppendFormatted calls in nested return . When that is true, each part
will be conditional on the return of the part before it, only being executed when the Append call returns true. False otherwise.
when this is true and is true, then the first part in nested is conditionally
run. If this is true and is false, then the first part is unconditionally run.
Just because this is true or false does not guarantee that all Append calls actually do return boolean values, as there could be dynamic calls or errors.
It only governs what the compiler was expecting, based on the first calls it did see.
The interpolated string expression or addition operation that makes up the content of this string. This is either an
or an operation.
Represents an addition of multiple interpolated string literals being converted to an interpolated string handler type.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The interpolated string expression or addition operation on the left side of the operator. This is either an
or an operation.
The interpolated string expression or addition operation on the right side of the operator. This is either an
or an operation.
Represents a call to either AppendLiteral or AppendFormatted as part of an interpolated string handler conversion.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
If this interpolated string is subject to an interpolated string handler conversion, the construction of the interpolated string handler instance.
This can be an or for valid code, and for invalid code.
Represents an argument from the method call, indexer access, or constructor invocation that is creating the containing
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The index of the argument of the method call, indexer, or object creation containing the interpolated string handler conversion this placeholder is referencing.
-1 if is anything other than .
The component this placeholder represents.
Represents an invocation of a function pointer.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Invoked pointer.
Arguments of the invocation. Arguments are in evaluation order.
Represents a C# list pattern.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The Length or Count property that is used to fetch the length value.
Returns null if no such property is found.
The indexer that is used to fetch elements.
Returns null for an array input.
Returns subpatterns contained within the list pattern.
Symbol declared by the pattern, if any.
Represents a C# slice pattern.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The range indexer or the Slice method used to fetch the slice value.
The pattern that the slice value is matched with, if any.
Represents a reference to an implicit System.Index or System.Range indexer over a non-array type.
Current usage:
- C# implicit System.Index or System.Range indexer reference expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Instance of the type to be indexed.
System.Index or System.Range value.
The Length or Count property that might be used to fetch the length value.
Symbol for the underlying indexer or a slice method that is used to implement the implicit indexer.
Represents a UTF-8 encoded byte representation of a string.
Current usage:
- C# UTF-8 string literal expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The underlying string value.
Represents the application of an attribute.
Current usage:
- C# attribute application
- VB attribute application
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The operation representing the attribute. This can be a in non-error cases, or an in error cases.
Represents an element reference or a slice operation over an inline array type.
Current usage:
- C# inline array access
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Instance of the inline array type to be accessed.
System.Int32, System.Index or System.Range value.
Represents a collection expression.
Current usage:
- C# collection expression
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Method used to construct the collection.
If the collection type is an array, span, array interface, or type parameter, the method is null;
if the collection type has a [CollectionBuilder] attribute, the method is the builder method;
otherwise, the method is the collection type constructor.
Collection expression elements.
If the element is an expression, the entry is the expression, with a conversion to
the target element type if necessary;
otherwise, the entry is an ISpreadOperation.
Represents a collection expression spread element.
Current usage:
- C# spread element
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Collection being spread.
Type of the elements in the collection.
Conversion from the type of the collection element to the target element type
of the containing collection expression.
This creates a block that can be used for temporary, internal applications that require a block composed of
statements from another block. Blocks created by this API violate IOperation tree constraints and should
never be exposed from a public API.
Deep clone given IOperation
Represents a visitor that visits only the single IOperation
passed into its Visit method.
Represents a visitor that visits only the single IOperation
passed into its Visit method with an additional argument of the type specified by the
parameter and produces a value of the type specified by
the parameter.
The type of the additional argument passed to this visitor's Visit method.
The type of the return value of this visitor's Visit method.
Kinds of arguments.
Represents unknown argument kind.
Argument value is explicitly supplied.
Argument is a param array created by compilers for the matching C# params or VB ParamArray parameter.
Note, the value is an array creation expression that encapsulates all the elements, if any.
Argument is a default value supplied automatically by the compilers.
Argument is a param collection created by compilers for the matching C# params parameter.
Note, the value is a collection expression that encapsulates all the elements, if any.
Kind of binary operator.
Represents unknown or error operator kind.
Represents the '+' operator.
Represents the '-' operator.
Represents the '*' operator.
Represents the '/' operator.
Represents the VB '\' integer divide operator.
Represents the C# '%' operator and VB 'Mod' operator.
Represents the VB '^' exponentiation operator.
Represents the operator.
Represents the >']]> operator.
Represents the C# operator and VB 'And' operator.
Represents the C# operator and VB 'Or' operator.
Represents the C# '^' operator and VB 'Xor' operator.
Represents the C# operator and VB 'AndAlso' operator.
Represents the C# operator and VB 'OrElse' operator.
Represents the VB operator for string concatenation.
Represents the C# '==' operator and VB 'Is' operator and '=' operator for non-object typed operands.
Represents the VB '=' operator for object typed operands.
Represents the C# '!=' operator and VB 'IsNot' operator and ']]> operator for non-object typed operands.
Represents the VB ']]> operator for object typed operands.
Represents the operator.
Represents the operator.
Represents the =']]> operator.
Represents the ']]> operator.
Represents the VB 'Like' operator.
Represents the >>']]> operator.
Kind of the branch for an
Represents unknown branch kind.
Represents a continue branch kind.
Represents a break branch kind.
Represents a goto branch kind.
Kinds of cases.
Represents unknown case kind.
Indicates an in C# or VB.
Indicates an in VB.
Indicates an in VB.
Indicates an in C# or VB.
Indicates an in C#.
Represents the common, language-agnostic elements of a conversion.
We reserve the right to change this struct in the future.
Returns true if the conversion exists, as defined by the target language.
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 an identity conversion.
Returns true if the conversion is an nullable conversion.
Returns true if the conversion is a numeric conversion.
Returns true if the conversion is a reference conversion.
Returns true if the conversion is an implicit (C#) or widening (VB) conversion.
Returns true if the conversion is a user-defined conversion.
Returns the method used to perform the conversion for a user-defined conversion if is true.
Otherwise, returns null.
Type parameter which runtime type will be used to resolve virtual invocation of the , if any.
Null if is resolved statically, or is null.
Kind of reference for an .
Reference to an instance of the containing type. Used for this
and base
in C# code, and Me
,
MyClass
, MyBase
in VB code.
Reference to the object being initialized in C# or VB object or collection initializer,
anonymous type creation initializer, or to the object being referred to in a VB With statement,
or the C# 'with' expression initializer.
Reference to the value being matching in a property subpattern.
Reference to the interpolated string handler instance created as part of a parent interpolated string handler conversion.
Kind of placeholder for an .
This is a placeholder for an argument from the containing method call, indexer access, or object creation.
The corresponding argument index is accessed in .
This is a placeholder for the receiver of the containing method call, indexer access, or object creation.
This is a placeholder for the trailing bool out parameter of the interpolated string handler type. This bool
controls whether the conditional evaluation for the rest of the interpolated string should be run after the
constructor returns.
Element type of the collection
The conversion from the type of the to the .
The conversion from the to the iteration variable type.
Kinds of loop operations.
Represents unknown loop kind.
Represents an in C# or VB.
Indicates an in C#.
Indicates an in VB.
Indicates an in C# or VB.
Helper function to simplify the access to the function pointer signature of an FunctionPointerInvocationOperation
This will check whether context around the operation has any error such as syntax or semantic error
Returns all the descendant operations of the given in evaluation order.
Operation whose descendants are to be fetched.
Returns all the descendant operations of the given including the given in evaluation order.
Operation whose descendants are to be fetched.
Gets all the declared local variables in the given .
Variable declaration group
Gets all the declared local variables in the given .
Variable declaration
Gets the variable initializer for the given , checking to see if there is a parent initializer
if the single variable initializer is null.
Single variable declaration to retrieve initializer for.
Get an optional argument name for a named argument to the given at the given .
Dynamic or late bound operation.
Argument index.
Get an optional argument name for a named argument to the given at the given .
Dynamic or late bound operation.
Argument index.
Get an optional argument name for a named argument to the given at the given .
Dynamic or late bound operation.
Argument index.
Get an optional argument name for a named argument to the given at the given .
Dynamic or late bound operation.
Argument index.
Get an optional argument for an argument at the given to the given .
Returns a non-null argument for C#.
Always returns null for VB as cannot be specified for an argument in VB.
Dynamic or late bound operation.
Argument index.
Get an optional argument for an argument at the given to the given .
Returns a non-null argument for C#.
Always returns null for VB as cannot be specified for an argument in VB.
Dynamic or late bound operation.
Argument index.
Get an optional argument for an argument at the given to the given .
Returns a non-null argument for C#.
Always returns null for VB as cannot be specified for an argument in VB.
Dynamic or late bound operation.
Argument index.
Gets the root operation for the tree containing the given .
Operation whose root is requested.
Gets either a loop or a switch operation that corresponds to the given branch operation.
The branch operation for which a corresponding operation is looked up
The corresponding operation or null in case not found (e.g. no loop or switch syntax, or the branch is not a break or continue)
is null
The operation is a part of Control Flow Graph
Use this to create IOperation when we don't have proper specific IOperation yet for given language construct
Represents a that descends an entire tree
visiting each IOperation and its child IOperation nodes in depth-first order.
Represents a that descends an entire tree
visiting each IOperation and its child IOperation nodes in depth-first order. Returns null.
Kind of unary operator
Represents unknown or error operator kind.
Represents the C# '~' operator.
Represents the C# '!' operator and VB 'Not' operator.
Represents the unary '+' operator.
Represents the unary '-' operator.
Represents the C# 'true' operator and VB 'IsTrue' operator.
Represents the C# 'false' operator and VB 'IsFalse' operator.
Represents the C# '^' operator.
Gets symbol information about a syntax node.
The syntax node to get semantic information for.
A cancellation token that can be used to cancel the
process of obtaining the semantic info.
Binds the node 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 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 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 semantic 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 type information about a syntax node.
The syntax node to get semantic information for.
A cancellation token that can be used to cancel the
process of obtaining the semantic info.
If "nameSyntax" resolves to an alias name, return the IAliasSymbol corresponding
to A. Otherwise return null.
Name to get alias info for.
A cancellation token that can be used to cancel the
process of obtaining the alias information.
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".
Binds the node 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 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 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 semantic 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 symbol associated with a declaration syntax node.
A syntax node that is a declaration. This can be any type
derived from MemberDeclarationSyntax, TypeDeclarationSyntax, EnumDeclarationSyntax,
NamespaceDeclarationSyntax, ParameterSyntax, TypeParameterSyntax, or the alias part of a
UsingDirectiveSyntax
The cancellation token.
The symbol declared by the node or null if the node is not a declaration.
Gets a list of method or indexed property symbols for a syntax node.
The syntax node to get semantic information for.
The cancellation token.
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 part of a method body.
Analyze data-flow within a part of a method body.
note (for C#): ConstructorInitializerSyntax and PrimaryConstructorBaseTypeSyntax are treated by this API as regular statements
It is unknown if the is automatically generated.
The is not automatically generated.
The is marked as automatically generated.
Represents the set of symbols that are imported to a particular position in a source file. Each import has a
reference to the location the import directive was declared at. For the import, the
location can be found using either or on the itself. For
or the location is found through or respectively.
- Scopes returned will always have at least one non-empty property value in them.
- Symbols may be imported, but may not necessarily be available at that location (for example, an alias
symbol hidden by another symbol).
-
In C# there will be an for every containing namespace-declarations that include any
import directives. There will also be an for the containing compilation-unit if it
includes any import directives or if there are global import directives pulled in from other files.
-
In Visual Basic there will commonly be one or two s returned for any position. This will
commonly be a scope for the containing compilation unit if it includes any import directives. As well as a scope
representing any imports specified at the project level.
-
Elements of any property have no defined order. Even if they represent items from a single document, they are
not guaranteed to be returned in any specific file-oriented order.
- There is no guarantee that the same scope instances will be returned from successive calls to .
Aliases defined at this level of the chain. This corresponds to using X = TypeOrNamespace; in C# or
Imports X = TypeOrNamespace in Visual Basic. This will include global aliases if present for both
languages.
May be , will never be .
Extern aliases defined at this level of the chain. This corresponds to extern alias X; in C#. It
will be empty in Visual Basic.
May be , will never be .
Types or namespaces imported at this level of the chain. This corresponds to using Namespace; or
using static Type; in C#, or Imports TypeOrNamespace in Visual Basic. This will include
global namespace or type imports for both languages.
May be , will never be .
Xml namespaces imported at this level of the chain. This corresponds to Imports <xmlns:prefix =
"name"> in Visual Basic. It will be empty in C#.
May be , will never be .
Represents an that has been imported, and the location the import was
declared at. This corresponds to using Namespace; or using static Type; in C#, or Imports
TypeOrNamespace in Visual Basic.
Location in source where the using directive or Imports clause was declared. May be null for
Visual Basic for a project-level import directive, or for a C# global using provided directly through .
Represents an imported xml namespace name. This corresponds to Imports <xmlns:prefix = "name"> in
Visual Basic. It does not exist for C#.
Location in source where the Imports clause was declared. May be null for a project-level import
directive.
Simple POCO implementation of the import scope, usable by both C# and VB.
Represents the state of the nullable analysis at a specific point in a file. Bits one and
two correspond to whether the nullable feature is enabled. Bits three and four correspond
to whether the context was inherited from the global context.
Nullable warnings and annotations are explicitly turned off at this location.
Nullable warnings are enabled and will be reported at this file location.
Nullable annotations are enabled and will be shown when APIs defined at
this location are used in other contexts.
The nullable feature is fully enabled.
The nullable warning state is inherited from the project default.
The project default can change depending on the file type. Generated
files have nullable off by default, regardless of the project-level
default setting.
The nullable annotation state is inherited from the project default.
The project default can change depending on the file type. Generated
files have nullable off by default, regardless of the project-level
default setting.
The current state of both warnings and annotations are inherited from
the project default.
This flag is set by default at the start of all files.
The project default can change depending on the file type. Generated
files have nullable off by default, regardless of the project-level
default setting.
Returns whether nullable warnings are enabled for this context.
Returns whether nullable annotations are enabled for this context.
Returns whether the nullable warning state was inherited from the project default for this file type.
Returns whether the nullable annotation state was inherited from the project default for this file type.
Represents the default state of nullable analysis in this compilation.
The nullable analysis feature is disabled.
Nullable warnings are enabled and will be reported by default.
Nullable annotations are enabled and will be shown when APIs
defined in this project are used in other contexts.
The nullable analysis feature is fully enabled.
Returns whether nullable warnings are enabled.
Returns whether nullable annotations are enabled.
Determines the level of optimization of the generated code.
Disables all optimizations and instruments the generated code to improve debugging experience.
The compiler prefers debuggability over performance. Do not use for code running in a production environment.
- JIT optimizations are disabled via assembly level attribute ().
- Edit and Continue is enabled.
- Slots for local variables are not reused, lifetime of local variables is extended to make the values available during debugging.
Corresponds to command line argument /optimize-.
Enables all optimizations, debugging experience might be degraded.
The compiler prefers performance over debuggability. Use for code running in a production environment.
- JIT optimizations are enabled via assembly level attribute ().
- Edit and Continue is disabled.
- Sequence points may be optimized away. As a result it might not be possible to place or hit a breakpoint.
- User-defined locals might be optimized away. They might not be available while debugging.
Corresponds to command line argument /optimize+.
Represents parse options common to C# and VB.
Specifies whether to parse as regular code files, script files or interactive code.
Gets the specified source code kind, which is the value that was specified in
the call to the constructor, or modified using the method.
Gets a value indicating whether the documentation comments are parsed and analyzed.
Gets the source language ("C#" or "Visual Basic").
Errors collection related to an incompatible set of parse options
Creates a new options instance with the specified source code kind.
Performs validation of options compatibilities and generates diagnostics if needed
Creates a new options instance with the specified documentation mode.
Enable some experimental language features for testing.
Returns the experimental features.
Names of defined preprocessor symbols.
AnyCPU (default) compiles the assembly to run on any platform.
x86 compiles the assembly to be run by the 32-bit, x86-compatible common language runtime.
x64 compiles the assembly to be run by the 64-bit common language runtime on a computer that supports the AMD64 or EM64T instruction set.
Itanium compiles the assembly to be run by the 64-bit common language runtime on a computer with an Itanium processor.
Compiles your assembly to run on any platform. Your application runs in 32-bit mode on systems that support both 64-bit and 32-bit applications.
Compiles your assembly to run on a computer that has an Advanced RISC Machine (ARM) processor.
Compiles your assembly to run on a computer that has an Advanced RISC Machine 64 bit (ARM64) processor.
The symbol that was referred to by the identifier, if any.
Returns true if this preprocessing symbol is defined at the identifier position.
This represents the set of document names for the #line / #ExternalSource directives
that we need to emit into the PDB (in the order specified in the array).
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 SemanticModel caches local symbols and semantic information. Thus, it
is much more efficient to use a single instance of SemanticModel 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 AssemblySymbol of the Compilation), 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.
Gets the source language ("C#" or "Visual Basic").
The compilation this model was obtained from.
The compilation this model was obtained from.
The syntax tree this model was obtained from.
The syntax tree this model was obtained from.
Gets the operation corresponding to the expression or statement syntax node.
The expression or statement syntax node.
An optional cancellation token.
Returns true if this is a SemanticModel that ignores accessibility rules when answering semantic questions.
Gets symbol information about a syntax node.
The syntax node to get semantic information for.
A cancellation token that can be used to cancel the
process of obtaining the semantic info.
Gets symbol information about a syntax node.
The syntax node to get semantic information for.
A cancellation token that can be used to cancel the
process of obtaining the semantic info.
Binds the node 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 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 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 semantic 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".
Binds the node 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 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 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 semantic 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".
Binds the node 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 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 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 semantic 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".
Binds the node 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 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 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 semantic 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 type information about a syntax node.
The syntax node to get semantic information for.
A cancellation token that can be used to cancel the
process of obtaining the semantic info.
Gets type information about a syntax node.
The syntax node to get semantic information for.
A cancellation token that can be used to cancel the
process of obtaining the semantic info.
If "nameSyntax" resolves to an alias name, return the IAliasSymbol corresponding
to A. Otherwise return null.
Name to get alias info for.
A cancellation token that can be used to cancel the
process of obtaining the alias information.
If "nameSyntax" resolves to an alias name, return the IAliasSymbol corresponding
to A. Otherwise return null.
Name to get alias info for.
A cancellation token that can be used to cancel the
process of obtaining the alias information.
Returns true if this is a speculative semantic model created with any of the TryGetSpeculativeSemanticModel methods.
If this is a speculative semantic model, returns the original position at which the speculative model was created.
Otherwise, returns 0.
If this is a speculative semantic model, then returns its parent semantic model.
Otherwise, returns null.
If this is a speculative semantic model, then returns its parent semantic model.
Otherwise, returns null.
If this is an instance of semantic model that cannot be exposed to external consumers, then returns the containing public semantic model.
Otherwise, returns this instance of the semantic model.
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".
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".
Get all of the syntax errors within the syntax tree associated with this
object. Does not get errors involving declarations or compiling method bodies or initializers.
Optional span within the syntax tree for which to get diagnostics.
If no argument is specified, then diagnostics for the entire tree are returned.
A cancellation token that can be used to cancel the
process of obtaining the diagnostics.
Get all of the declaration errors within the syntax tree associated with this
object. Does not get errors involving incorrect syntax, compiling method bodies or initializers.
Optional span within the syntax tree for which to get diagnostics.
If no argument is specified, then diagnostics for the entire tree are returned.
A cancellation token that can be used to cancel the
process of obtaining the diagnostics.
The declaration errors for a syntax tree are cached. The first time this method
is called, all declarations are analyzed for diagnostics. Calling this a second time
will return the cached diagnostics.
Get all of the method body and initializer errors within the syntax tree associated with this
object. Does not get errors involving incorrect syntax or declarations.
Optional span within the syntax tree for which to get diagnostics.
If no argument is specified, then diagnostics for the entire tree are returned.
A cancellation token that can be used to cancel the
process of obtaining the diagnostics.
The method body errors for a syntax tree are not cached. The first time this method
is called, all method bodies are analyzed for diagnostics. Calling this a second time
will repeat this work.
Get all the errors within the syntax tree associated with this object. Includes errors
involving compiling method bodies or initializers, in addition to the errors returned by
GetDeclarationDiagnostics.
Optional span within the syntax tree for which to get diagnostics.
If no argument is specified, then diagnostics for the entire tree are returned.
A cancellation token that can be used to cancel the
process of obtaining the diagnostics.
Because this method must semantically bind all method bodies and initializers to check
for diagnostics, it may take a significant amount of time. Unlike
GetDeclarationDiagnostics, diagnostics for method bodies and initializers are not
cached, any semantic information used to obtain the diagnostics is discarded.
Gets the symbol associated with a declaration syntax node.
A syntax node that is a declaration. This can be any type
derived from MemberDeclarationSyntax, TypeDeclarationSyntax, EnumDeclarationSyntax,
NamespaceDeclarationSyntax, ParameterSyntax, TypeParameterSyntax, or the alias part of a
UsingDirectiveSyntax
The cancellation token.
The symbol declared by the node or null if the node is not a declaration.
Gets the symbol associated with a declaration syntax node.
A syntax node that is a declaration. This can be any type
derived from MemberDeclarationSyntax, TypeDeclarationSyntax, EnumDeclarationSyntax,
NamespaceDeclarationSyntax, ParameterSyntax, TypeParameterSyntax, or the alias part of a
UsingDirectiveSyntax
The cancellation token.
The symbol declared by the node or null if the node is not a declaration.
Gets the symbols associated with a declaration syntax node. Unlike ,
this method returns all symbols declared by a given declaration syntax node. Specifically:
- in the case of field declaration syntax nodes, which can declare multiple symbols, this method returns
all declared symbols.
- in the case of type declarations with a primary constructor, both the
for the type, and the for the primary constructor will be returned.
A syntax node that is a declaration. This can be any type
derived from MemberDeclarationSyntax, TypeDeclarationSyntax, EnumDeclarationSyntax,
NamespaceDeclarationSyntax, ParameterSyntax, TypeParameterSyntax, or the alias part of a
UsingDirectiveSyntax
The cancellation token.
The symbols declared by the node.
Gets the symbols associated with a declaration syntax node. Unlike ,
this method returns all symbols declared by a given declaration syntax node. Specifically:
- in the case of field declaration syntax nodes, which can declare multiple symbols, this method returns
all declared symbols.
- in the case of type declarations with a primary constructor, both the
for the type, and the for the primary constructor will be returned.
A syntax node that is a declaration. This can be any type
derived from MemberDeclarationSyntax, TypeDeclarationSyntax, EnumDeclarationSyntax,
NamespaceDeclarationSyntax, ParameterSyntax, TypeParameterSyntax, or the alias part of a
UsingDirectiveSyntax
The cancellation token.
The symbols declared by the node.
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 .
Backing implementation 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.
Backing implementation of .
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.
Essentially the same as filtering instance members out of the results of an analogous call.
Backing implementation of .
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 INamespaceOrTypeSymbol, because there could be aliases.
Backing implementation of .
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.
Backing implementation of .
Analyze control-flow within a part of a method body.
The first node to be included within the analysis.
The last node to be included within the analysis.
An object that can be used to obtain the result of the control flow analysis.
The span is not with a method
body.
The first and last nodes must be fully inside the same method body.
Analyze control-flow within a part of a method body.
The first node to be included within the analysis.
The last node to be included within the analysis.
An object that can be used to obtain the result of the control flow analysis.
The span is not with a method
body.
The first and last nodes must be fully inside the same method body.
Analyze control-flow within a part of a method body.
The statement to be analyzed.
An object that can be used to obtain the result of the control flow analysis.
The span is not with a method
body.
The statement must be fully inside the same method body.
Analyze control-flow within a part of a method body.
The statement to be analyzed.
An object that can be used to obtain the result of the control flow analysis.
The span is not with a method
body.
The statement must be fully inside the same method body.
Analyze data-flow within a part of a method body.
The first node to be included within the analysis.
The last node to be included within the analysis.
An object that can be used to obtain the result of the data flow analysis.
The span is not with a method
body.
The first and last nodes must be fully inside the same method body.
Analyze data-flow within a part of a method body.
The first node to be included within the analysis.
The last node to be included within the analysis.
An object that can be used to obtain the result of the data flow analysis.
The span is not with a method
body.
The first and last nodes must be fully inside the same method body.
Analyze data-flow within a part of a method body.
The statement or expression to be analyzed. A ConstructorInitializerSyntax / PrimaryConstructorBaseTypeSyntax is treated here as a regular statement.
An object that can be used to obtain the result of the data flow analysis.
The statement or expression is not with a method
body or field or property initializer.
The statement or expression must be fully inside a method body.
Analyze data-flow within a part of a method body.
The statement or expression to be analyzed.
An object that can be used to obtain the result of the data flow analysis.
The statement or expression is not with a method
body or field or property initializer.
The statement or expression must be fully inside a method body.
If the node provided has a constant value an Optional value will be returned with
HasValue set to true and with Value set to the constant. If the node does not have an
constant value, an Optional will be returned with HasValue set to false.
If the node provided has a constant value an Optional value will be returned with
HasValue set to true and with Value set to the constant. If the node does not have an
constant value, an Optional will be returned with HasValue set to false.
When getting information for a symbol that resolves to a method group or property group,
from which a method is then chosen; the chosen method or property is present in Symbol;
all methods in the group that was consulted are placed in this property.
When getting information for a symbol that resolves to a method group or property group,
from which a method is then chosen; the chosen method or property is present in Symbol;
all methods in the group that was consulted are placed in this property.
Given a position in the SyntaxTree for this SemanticModel returns the innermost Symbol
that the position is considered inside of.
Given a position in the SyntaxTree for this SemanticModel returns the innermost Symbol
that the position is considered inside of.
Given a position in the SyntaxTree for this SemanticModel returns the s at that
point. Scopes are ordered from closest to the passed in to the furthest. See
for a deeper description of what information is available for each scope.
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.
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.
Always false for VB events.
Field-like events can be used as fields in types that can access private
members of the declaring type of the event.
Always false for VB events.
If is an identifier name syntax node, return the corresponding
to it.
The nameSyntax node to get semantic information for.
If is an identifier name syntax node, return the corresponding
to it.
The nameSyntax node to get semantic information for.
Gets the for all the declarations whose span overlaps with the given .
Span to get declarations.
Flag indicating whether should be computed for the returned declaration infos.
If false, then is always null.
Builder to add declarations.
Cancellation token.
Takes a node and returns a set of declarations that overlap the node's span.
Gets a filter that determines whether or not a given syntax node and its descendants should be analyzed for the given
declared node and declared symbol. We have scenarios where certain syntax nodes declare multiple symbols,
for example record declarations, and we want to avoid duplicate syntax node callbacks for such nodes.
Note that the predicate returned by this method filters out both the node and all its descendants from analysis.
If you wish to skip analysis just for a specific node, but not its descendants, then add the required logic in
.
Determines if the given syntax node with the given containing symbol should be analyzed or not.
Note that only the given syntax node will be filtered out from analysis, this API will be invoked separately
for each of its descendants. If you wish to skip analysis of the node and all its descendants, then add the required
logic to .
Takes a Symbol and syntax for one of its declaring syntax reference and returns the topmost syntax node to be used by syntax analyzer.
Root of this semantic model
Root of this semantic model
Gets the at a position in the file.
The position to get the context for.
Provides semantic models for syntax trees in a compilation.
This provider can be attached to a compilation, see .
Gets a for the given that belongs to the given .
Resolves references to source documents specified in the source.
Normalizes specified source path with respect to base file path.
The source path to normalize. May be absolute or relative.
Path of the source file that contains the (may also be relative), or null if not available.
Normalized path, or null if can't be normalized. The resulting path doesn't need to exist.
Resolves specified path with respect to base file path.
The path to resolve. May be absolute or relative.
Path of the source file that contains the (may also be relative), or null if not available.
Normalized path, or null if the file can't be resolved.
Opens a that allows reading the content of the specified file.
Path returned by .
is null.
is not a valid absolute path.
Error reading file . See for details.
Reads the contents of and returns a .
Path returned by .
Describes the kind of binding to be performed in one of the SemanticModel
speculative binding methods.
Binds the given expression using the normal expression binding rules
that would occur during normal binding of expressions.
Binds the given expression as a type or namespace only. If this option
is selected, then the given expression must derive from TypeSyntax.
Represents subsystem version, see /subsystemversion command line
option for details and valid values.
The following table lists common subsystem versions of Windows.
Windows version Subsystem version
- Windows 2000 5.00
- Windows XP 5.01
- Windows Vista 6.00
- Windows 7 6.01
- Windows 8 Release Preview 6.02
Major subsystem version
Minor subsystem version
Subsystem version not specified
Subsystem version: Windows 2000
Subsystem version: Windows XP
Subsystem version: Windows Vista
Subsystem version: Windows 7
Subsystem version: Windows 8
Try parse subsystem version in "x.y" format. Note, no spaces are allowed in string representation.
String to parse
the value if successfully parsed or None otherwise
true if parsed successfully, false otherwise
Create a new instance of subsystem version with specified major and minor values.
major subsystem version
minor subsystem version
subsystem version with provided major and minor
Subsystem version default for the specified output kind and platform combination
Output kind
Platform
Subsystem version
True if the subsystem version has a valid value
Indicate what kinds of declaration symbols will be included
None
include namespace symbols
include type symbols
include member symbols such as method, event, property, field
include type and member
include all namespace, type and member
Array of potential candidate symbols if did not bind successfully. Note: all code in
this type should prefer referencing instead of this so that they uniformly
only see an non- array.
The symbol that was referred to by the syntax node, if any. Returns null if the given expression did not
bind successfully to a single symbol. If null is returned, it may still be that case that we have one or
more "best guesses" as to what symbol was intended. These best guesses are available via the property.
If the expression did not successfully resolve to a symbol, but there were one or more symbols that may have
been considered but discarded, this property returns those symbols. The reason that the symbols did not
successfully resolve to a symbol are available in the property. For example,
if the symbol was inaccessible, ambiguous, or used in the wrong context.
Will never return a array.
If the expression did not successfully resolve to a symbol, but there were one or more symbols that may have
been considered but discarded, this property describes why those symbol or symbols were not considered
suitable.
Get whether the given tree is generated.
Get diagnostic severity setting for a given diagnostic identifier in a given tree.
Get diagnostic severity set globally for a given diagnostic identifier
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, then
an IErrorTypeSymbol is returned.
The top-level nullability information of the expression represented by the syntax node.
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.
The top-level nullability of the expression after it has undergone an implicit conversion.
For most expressions, this will be the same as the type. It can change in situations such
as implicit user-defined conversions that have a nullable return type.
Resolves references to XML documents specified in source code.
Resolves specified XML reference with respect to base file path.
The reference path to resolve. May be absolute or relative path.
Path of the source file that contains the (may also be relative), or null if not available.
Path to the XML artifact, or null if the file can't be resolved.
Opens a that allows reading the content of the specified file.
Path returned by .
is null.
is not a valid absolute path.
Error reading file . See for details.
The IEEE floating-point spec doesn't specify which bit pattern an implementation
is required to use when producing NaN values. Indeed, the spec does recommend
"diagnostic" information "left to the implementerโs discretion" be placed in the
undefined bits. It is therefore likely that NaNs produced on different platforms
will differ even for the same arithmetic such as 0.0 / 0.0. To ensure that the
compiler behaves in a deterministic way, we force NaN values to use the
IEEE "canonical" form with the diagnostic bits set to zero and the sign bit set
to one. Conversion of this value to float produces the corresponding
canonical NaN of the float type (IEEE Std 754-2008 section 6.2.3).
Some string constant values can have large costs to realize. To compensate, we realize
constant values lazily, and hold onto a weak reference. If the next time we're asked for the constant
value the previous one still exists, we can avoid rerealizing it. But we don't want to root the constant
value if it's not being used.
Parses .RES a file into its constituent resource elements.
Mostly translated from cvtres.cpp.
Assume that 3 WORDs preceded this string and that they began 32-bit aligned.
Given the string length compute the number of bytes that should be written to end
the buffer on a 32-bit boundary
assuming the length of bytes submitted began on a 32-bit boundary,
round up this length as necessary so that it ends at a 32-bit boundary.
compute number of chars needed to end up on a 32-bit boundary assuming that three
WORDS preceded this string.
Policy to be used when matching assembly reference to an assembly definition across platforms.
Converts to .
Major, minor, build or revision number are less than 0 or greater than 0xFFFF.
Assembly portability policy, usually provided through an app.config file.
Loads information from XML with app.config schema.
The stream doesn't contain a well formed XML.
is null.
Tries to find supportPortability elements in the given XML:
]]>
Keeps the stream open.
Returns true if the identity is a Framework 4.5 or lower assembly.
Represents a non source code file.
Path to the text.
Returns a with the contents of this file, or null if
there were errors reading the file.
Provides custom values associated with instances using the given computeValue delegate.
Provides custom values associated with instances using the given .
Delegate to compute the value associated with a given instance.
Optional equality comparer to determine equivalent instances that have the same value.
If no comparer is provided, then is used by default.
this hold onto analyzer executor context which will be used later to put context information in analyzer exception if it occurs.
Stores the results of analyzer execution:
1. Local and non-local diagnostics, per-analyzer.
2. Analyzer execution times, if requested.
Analyzers corresponding to this analysis result.
Syntax diagnostics reported by the .
Semantic diagnostics reported by the .
Diagnostics in additional files reported by the .
Compilation diagnostics reported by the .
Analyzer telemetry info (register action counts and execution times).
Gets all the diagnostics reported by the given .
Gets all the diagnostics reported by all the .
Stores the results of analyzer execution:
1. Local and non-local diagnostics, per-analyzer.
2. Analyzer execution times, if requested.
Filters down the given to only retain the analyzers which have
not completed execution. If the is non-null, then return
the analyzers which have not fully exected on the filterScope. Otherwise, return the analyzers
which have not fully executed on the entire compilation.
Analyzers to be filtered.
Optional scope for filtering.
Analyzers which have not fully executed on the given , if non-null,
or the entire compilation, if is null.
Scope for analyzer execution.
This scope could either be the entire compilation for all analyzers (command line build) or
could be scoped to a specific tree/span and/or a subset of analyzers (CompilationWithAnalyzers).
Original filter file for the input analysis scope.
Normally, this is the same as ,
except for SymbolStart/End action execution where original input
file/span for diagnostic request can require analyzing other files/spans
which have partial definitions for the symbol being analyzed.
This property is used to ensure that SymbolStart action and SymbolEnd
action both receive this same original filter file.
Original filter span for the input analysis scope.
Normally, this is the same as ,
except for SymbolStart/End action execution where original input
file/span for diagnostic request can require analyzing other files/spans
which have partial definitions for the symbol being analyzed.
This property is used to ensure that SymbolStart action and SymbolEnd
action both receive this same original filter span.
Syntax trees on which we need to perform syntax analysis.
Non-source files on which we need to perform analysis.
True if we need to perform only syntax analysis for a single source or additional file.
True if we need to perform analysis for a single source or additional file.
Flag indicating if this analysis scope contains all analyzers from the corresponding ,
i.e. is the same set as .
This flag is used to improve the performance for check for
batch compilation scenario, where this flag is always true.
True if we are performing syntactic or semantic analysis for a single source file with a single analyzer in scope,
which is a .
True if we are performing semantic analysis for a single source file with a single analyzer in scope,
which is a .
Contains the counts of registered actions for an analyzer.
Count of registered compilation start actions.
Count of registered compilation end actions.
Count of registered compilation actions.
Count of registered syntax tree actions.
Count of registered additional file actions.
Count of registered semantic model actions.
Count of registered symbol actions.
Count of registered symbol start actions.
Count of registered symbol end actions.
Count of registered syntax node actions.
Count of code block start actions.
Count of code block end actions.
Count of code block actions.
Count of Operation actions.
Count of Operation block start actions.
Count of Operation block end actions.
Count of Operation block actions.
Returns true if there are any actions that need to run on executable code.
Returns true if there are any analyzer action callbacks that are driven by compilation events,
such as , , etc.
Many callbacks into the diagnostics analyzers are driven in the
by compilation events added to the . For these callbacks to be executed,
the analyzer driver host needs to force complete the events in the relevant part of the compilation,
i.e. relevant tree(s) or entire compilation. This force complete operation incurs a performance cost,
which can be avoided if the analyzer(s) to be executed, such as syntax-only analyzers, do not register any
actions which are driven by compilation events.
Note that is an exception as it is *always* generated as soon as the
is created. Any action callbacks driven off
do not need any force completion and hence do not need to be accounted by this boolean flag.
This flag is primarily intended for performance improvements in certain analyzer execution code paths.
Gets a value indicating whether the analyzer supports concurrent execution.
Contains telemetry info for a specific analyzer, such as count of registered actions, the total execution time, etc.
Count of registered compilation start actions.
Count of registered compilation end actions.
Count of registered compilation actions.
Count of registered syntax tree actions.
Count of registered additional file actions.
Count of registered semantic model actions.
Count of registered symbol actions.
Count of registered symbol start actions.
Count of registered symbol end actions.
Count of registered syntax node actions.
Count of registered code block start actions.
Count of registered code block end actions.
Count of registered code block actions.
Count of registered operation actions.
Count of registered operation block start actions.
Count of registered operation block end actions.
Count of registered operation block actions.
Count of registered suppression actions.
This is the same as count of s as each suppressor
has a single suppression action, i.e. .
Total execution time.
Gets a value indicating whether the analyzer supports concurrent execution.
Create telemetry info for a specific analyzer, such as count of registered actions, the total execution time, etc.
Comparer that should be used for all analyzer config keys. This is a case-insensitive comparison based
on Unicode case sensitivity rules for identifiers.
Get an analyzer config value for the given key, using the .
Enumerates unique keys of all available options in no specific order.
Not implemented by the derived type.
Provide options from an analyzer config file keyed on a source file.
Gets global options that do not apply to any specific file
Get options for a given .
Get options for a given
Driver to execute diagnostic analyzers for a given compilation.
It uses a of s to drive its analysis.
Set of diagnostic suppressions that are suppressed via analyzer suppression actions.
Set of diagnostics that have already been processed for application of programmatic suppressions.
Flag indicating if the include any
which can suppress reported analyzer/compiler diagnostics.
Filtered diagnostic severities in the compilation, i.e. diagnostics with effective severity from this set should not be reported.
PERF: If all supported diagnostics for an analyzer are from this set, we completely skip executing the analyzer.
Unsuppressed analyzers that need to be executed.
Cache of additional analyzer actions to be executed per symbol per analyzer, which are registered in symbol start actions.
We cache the tuple:
1. myActions: analyzer actions registered in the symbol start actions of containing namespace/type, which are to be executed for this symbol
2. childActions: analyzer actions registered in this symbol's start actions, which are to be executed for member symbols.
Default analysis mode for generated code.
This mode should always guarantee that analyzer action callbacks are enabled for generated code, i.e. is set.
However, the default diagnostic reporting mode is liable to change in future.
Map from non-concurrent analyzers to the gate guarding callback into the analyzer.
Map from analyzers to their setting.
The set of registered analyzer actions.
Set of unsuppressed analyzers that report non-configurable or custom configurable diagnostics that cannot be suppressed with end user configuration.
Set of analyzers that have registered symbol start analyzer actions.
True if all analyzers need to analyze and report diagnostics in generated code - we can assume all code to be non-generated code.
True if no analyzer needs generated code analysis - we can skip all analysis on a generated code symbol/tree.
Lazily populated dictionary indicating whether a source file is a generated code file or not - we populate it lazily to avoid realizing all syntax trees in the compilation upfront.
Lazily populated dictionary from tree to declared symbols with GeneratedCodeAttribute.
Lazily populated dictionary from tree to analyzers that are suppressed on the entire tree.
Lazily populated set of diagnostic IDs which are suppressed for some part of the compilation (tree/folder/entire compilation),
but the analyzer reporting the diagnostic is itself not suppressed for the entire compilation, i.e. the analyzer
belongs to .
Lazily populated dictionary from symbol to a bool indicating if it is a generated code symbol.
Lazily populated dictionary indicating whether a source file has any hidden regions - we populate it lazily to avoid realizing all syntax trees in the compilation upfront.
Symbol for .
Driver task which initializes all analyzers.
This task is initialized and executed only once at start of analysis.
Flag to indicate if the was successfully started.
Primary driver task which processes all events, runs analyzer actions and signals completion of at the end.
Number of worker tasks processing compilation events and executing analyzer actions.
Events queue for analyzer execution.
that is fed the diagnostics as they are computed.
Create an analyzer driver.
The set of analyzers to include in the analysis
AnalyzerManager to manage analyzers for analyzer host's lifetime.
Filtered diagnostic severities in the compilation, i.e. diagnostics with effective severity from this set should not be reported.
Delegate to identify if the given trivia is a comment.
Initializes the and related actions maps for the analyzer driver.
It kicks off the task for initialization.
Note: This method must be invoked exactly once on the driver.
Returns true if all analyzers need to analyze and report diagnostics in generated code - we can assume all code to be non-generated code.
Attaches a pre-populated event queue to the driver and processes all events in the queue.
Compilation events to analyze.
Scope of analysis.
Cancellation token to abort analysis.
Driver must be initialized before invoking this method, i.e. method must have been invoked and must be non-null.
Attaches event queue to the driver and start processing all events pertaining to the given analysis scope.
Compilation events to analyze.
Scope of analysis.
Boolean flag indicating whether we should only process the already populated events or wait for .
Cancellation token to abort analysis.
Driver must be initialized before invoking this method, i.e. method must have been invoked and must be non-null.
Create an and attach it to the given compilation.
The compilation to which the new driver should be attached.
The set of analyzers to include in the analysis.
Options that are passed to analyzers.
AnalyzerManager to manage analyzers for the lifetime of analyzer host.
Delegate to add diagnostics generated for exceptions from third party analyzers.
Report additional information related to analyzers, such as analyzer execution time.
Filtered diagnostic severities in the compilation, i.e. diagnostics with effective severity from this set should not be reported.
Track diagnostic ids which are suppressed through options.
The new compilation with the analyzer driver attached.
A cancellation token that can be used to abort analysis.
A newly created analyzer driver
Note that since a compilation is immutable, the act of creating a driver and attaching it produces
a new compilation. Any further actions on the compilation should use the new compilation.
Returns all diagnostics computed by the analyzers since the last time this was invoked.
If has been completed with all compilation events, then it waits for
task for the driver to finish processing all events and generate remaining analyzer diagnostics.
Returns an array of s for all
along with to be logged by the .
Return a task that completes when the driver is initialized.
Return a task that completes when the driver is done producing diagnostics.
Tries to execute symbol action, symbol start/end actions and declaration actions for the given symbol.
indicating the current state of processing of the given compilation event.
Returns true if all the diagnostics that can be produced by this analyzer are suppressed through options.
GetSyntax() for the given SyntaxReference.
Topmost declaration node for analysis.
All member declarations within the declaration.
All descendant nodes for syntax node actions.
Flag indicating if this is a partial analysis.
Used to represent state of processing of a .
Subset of processed analyzers.
NOTE: This property is only non-null for .
Driver to execute diagnostic analyzers for a given compilation.
It uses a of s to drive its analysis.
Create an analyzer driver.
The set of analyzers to include in the analysis
A delegate that returns the language-specific kind for a given syntax node
AnalyzerManager to manage analyzers for the lifetime of analyzer host.
Filtered diagnostic severities in the compilation, i.e. diagnostics with effective severity from this set should not be reported.
Delegate to identify if the given trivia is a comment.
Execute syntax node, code block and operation actions for all declarations for the given symbol.
Execute syntax node, code block and operation actions for the given declaration.
grouped by , and possibly other entities, such as , , etc.
Contains the core execution logic for callbacks into analyzers.
Pooled object that carries the info needed to process
a reported diagnostic from a syntax node action.
An optional filter span, which if non-null, indicates that diagnostics reported within this span
are considered local diagnostics, and those reported outside this span are considered non-local.
NOTE: is a pooled type that is always used from a single
thread, hence it is safe to expose a public mutable field.
The values in this map convert to using .
Creates to execute analyzer actions with given arguments
Compilation to be used in the analysis.
Analyzer options.
Optional delegate to add non-categorized analyzer diagnostics.
Delegate which is invoked when an analyzer throws an exception.
Delegate can do custom tasks such as report the given analyzer exception diagnostic, report a non-fatal watson for the exception, etc.
Optional delegate which is invoked when an analyzer throws an exception as an exception filter.
Delegate can do custom tasks such as crash hosting process to create a dump.
Delegate to determine if the given analyzer is compiler analyzer.
We need to special case the compiler analyzer at few places for performance reasons.
Analyzer manager to fetch supported diagnostics.
Delegate to fetch the gate object to guard all callbacks into the analyzer.
It should return a unique gate object for the given analyzer instance for non-concurrent analyzers, and null otherwise.
All analyzer callbacks for non-concurrent analyzers will be guarded with a lock on the gate.
Delegate to get a semantic model for the given syntax tree which can be shared across analyzers.
for analysis.
Delegate to identify if analysis should be skipped on generated code.
Delegate to identify if diagnostic reported while analyzing generated code should be suppressed.
Delegate to identify if the given location is in generated code.
Delegate to identify if the given analyzer is suppressed for the given tree.
Flag indicating whether we need to log analyzer execution time.
Optional delegate to add categorized local analyzer diagnostics.
Optional delegate to add categorized non-local analyzer diagnostics.
Optional thread-safe delegate to add diagnostic suppressions from suppressors.
Executes the for the given analyzer.
Session scope to store register session wide analyzer actions.
Severity filter for analysis.
Cancellation token.
Note that this API doesn't execute any registered by the Initialize invocation.
Use API
to get execute these actions to get the per-compilation analyzer actions.
Executes the compilation start actions.
whose compilation start actions are to be executed.
Compilation scope to store the analyzer actions.
Cancellation token.
Executes the symbol start actions.
Symbol whose symbol start actions are to be executed.
whose symbol start actions are to be executed.
Symbol scope to store the analyzer actions.
Flag indicating if the symbol being analyzed is generated code.
Cancellation token.
Executes the given diagnostic suppressor.
Suppressor to be executed.
Reported analyzer/compiler diagnostics that can be suppressed.
Cancellation token.
Executes compilation actions or compilation end actions.
Compilation actions to be executed.
Analyzer whose actions are to be executed.
Compilation event.
Cancellation token.
Execute the symbol actions on the given symbol.
Symbol actions to be executed.
Analyzer whose actions are to be executed.
Symbol event to be analyzed.
Delegate to get topmost declaration node for a symbol declaration reference.
Flag indicating if this is a generated code symbol.
Cancellation token.
Execute the symbol end actions on the given namespace or type containing symbol for the process member symbol for the given analyzer.
Symbol whose actions are to be executed.
Completed member symbol.
Analyzer whose actions are to be executed.
Delegate to get topmost declaration node for a symbol declaration reference.
Optional filter span for analysis.
Flag indicating if the containing symbol being analyzed is generated code.
Tries to execute the symbol end actions on the given symbol for the given analyzer.
Symbol actions to be executed.
Analyzer whose actions are to be executed.
Symbol event to be analyzed.
Delegate to get topmost declaration node for a symbol declaration reference.
Optional filter span for analysis.
Flag indicating if the symbol being analyzed is generated code.
Cancellation token.
True, if successfully executed the actions for the given analysis scope OR all the actions have already been executed for the given analysis scope.
False, if there are some pending actions.
Execute the semantic model actions on the given semantic model.
Semantic model actions to be executed.
Analyzer whose actions are to be executed.
Semantic model to analyze.
Optional filter span for analysis.
Flag indicating if the syntax tree being analyzed is generated code.
Cancellation token.
Execute the syntax tree actions on the given syntax tree.
Syntax tree actions to be executed.
Analyzer whose actions are to be executed.
Syntax tree to analyze.
Optional filter span within the for analysis.
Flag indicating if the syntax tree being analyzed is generated code.
Cancellation token.
Execute the additional file actions.
Actions to be executed.
Analyzer whose actions are to be executed.
Additional file to analyze.
Optional filter span within the for analysis.
Cancellation token.
Execute code block actions for the given analyzer for the given declaration.
Execute operation block actions for the given analyzer for the given declaration.
Execute syntax node actions for the given analyzer for the given declaration.
Execute operation actions for the given analyzer for the given declaration.
True, if successfully executed the actions for the given analysis scope OR all the actions have already been executed for the given analysis scope.
False, if there are some pending actions that are currently being executed on another thread.
Represents analyzers stored in an analyzer assembly file.
Analyzer are read from the file, owned by the reference, and doesn't change
since the reference is accessed until the reference object is garbage collected.
If you need to manage the lifetime of the analyzer reference (and the file stream) explicitly use .
Creates an AnalyzerFileReference with the given and .
Full path of the analyzer assembly.
Loader for obtaining the from the
Adds the of defined in this assembly reference of given .
Adds the of defined in this assembly reference of given .
Opens the analyzer dll with the metadata reader and builds a map of language -> analyzer type names.
The PE image format is invalid.
IO error reading the metadata.
Represents an in-memory analyzer reference image.
If a specific analyzer failed to load the namespace-qualified name of its type, null otherwise.
Error message.
Error code.
Exception that was thrown while loading the analyzer. May be null.
If is , returns the compiler version referenced by the analyzer assembly. Otherwise, returns null.
Manages properties of analyzers (such as registered actions, supported diagnostics) for analyzer host's lifetime
and executes the callbacks into the analyzers.
It ensures the following for the lifetime of analyzer host:
1) is invoked only once per-analyzer.
2) is invoked only once per-analyzer.
3) registered during Initialize are invoked only once per-compilation per-analyzer and analyzer options.
Cached mapping of localizable strings in this descriptor to any exceptions thrown while obtaining them.
Map from (symbol, analyzer) to count of its member symbols whose symbol declared events are not yet processed.
Symbol declared events for symbols with pending symbol end analysis for given analyzer.
Task to compute HostSessionStartAnalysisScope for session wide analyzer actions, i.e. AnalyzerActions registered by analyzer's Initialize method.
These are run only once per every analyzer.
Task to compute HostCompilationStartAnalysisScope for per-compilation analyzer actions, i.e. AnalyzerActions registered by analyzer's CompilationStartActions.
Task to compute HostSymbolStartAnalysisScope for per-symbol analyzer actions, i.e. AnalyzerActions registered by analyzer's SymbolStartActions.
Supported diagnostic descriptors for diagnostic analyzer, if any.
Supported suppression descriptors for diagnostic suppressor, if any.
Compute and exception handler for the given .
Get all the analyzer actions to execute for the given analyzer against a given compilation.
The returned actions include the actions registered during method as well as
the actions registered during for the given compilation.
Get the per-symbol analyzer actions to be executed by the given analyzer.
These are the actions registered during the various RegisterSymbolStartAction method invocations for the given symbol on different analysis contexts.
Returns true if the given analyzer has enabled concurrent execution by invoking .
Returns for the given analyzer.
If an analyzer hasn't configured generated code analysis, returns .
Return of given .
Return of given .
Returns true if all the diagnostics that can be produced by this analyzer are suppressed through options.
Returns true if all the diagnostics that can be produced by this analyzer are suppressed through options.
Options passed to .
A set of additional non-code text files that can be used by analyzers.
A set of options keyed to or .
Creates analyzer options to be passed to .
A set of additional non-code text files that can be used by analyzers.
A set of per-tree options that can be used by analyzers.
Creates analyzer options to be passed to .
A set of additional non-code text files that can be used by analyzers.
Returns analyzer options with the given .
Tries to get configured severity for the given
for the given from bulk configuration analyzer config options, i.e.
'dotnet_analyzer_diagnostic.category-%RuleCategory%.severity = %severity%'
or
'dotnet_analyzer_diagnostic.severity = %severity%'
Represents an analyzer assembly reference that contains diagnostic analyzers.
Represents a logical location of the analyzer reference, not the content of the reference.
The content might change in time. A snapshot is taken when the compiler queries the reference for its analyzers.
Full path describing the location of the analyzer reference, or null if the reference has no location.
Path or name used in error messages to identity the reference.
Should not be null.
A unique identifier for this analyzer reference.
Should not be null.
Note that this and serve different purposes. An analyzer reference may not
have a path, but it always has an ID. Further, two analyzer references with different paths may
represent two copies of the same analyzer, in which case the IDs should also be the same.
Gets all the diagnostic analyzers defined in this assembly reference, irrespective of the language supported by the analyzer.
Use this method only if you need all the analyzers defined in the assembly, without a language context.
In most instances, either the analyzer reference is associated with a project or is being queried for analyzers in a particular language context.
If so, use method.
Gets all the diagnostic analyzers defined in this assembly reference for the given .
Language name.
Gets all the source generators defined in this assembly reference.
Gets all the generators defined in this assembly reference for the given .
Language name.
A queue whose enqueue and dequeue operations can be performed in parallel.
The type of values kept by the queue.
The number of unconsumed elements in the queue.
Adds an element to the tail of the queue. This method will throw if the queue
is completed.
The queue is already completed.
The value to add.
Tries to add an element to the tail of the queue. This method will return false if the queue
is completed.
The value to add.
Attempts to dequeue an existing item and return whether or not it was available.
Gets a value indicating whether the queue has completed.
Signals that no further elements will be enqueued. All outstanding and future
Dequeue Task will be cancelled.
The queue is already completed.
Same operation as except it will not
throw if the queue is already completed.
Whether or not the operation succeeded.
Gets a task that transitions to a completed state when or
is called. This transition will not happen synchronously.
This Task will not complete until it has completed all existing values returned
from .
Gets a task whose result is the element at the head of the queue. If the queue
is empty, the returned task waits for an element to be enqueued. If
is called before an element becomes available, the returned task is cancelled.
Gets a task whose result is the element at the head of the queue. If the queue
is empty, the returned task waits for an element to be enqueued. If
is called before an element becomes available, the returned task is completed and
will be .
Cancels a if a given is canceled.
The type of value returned by a successfully completed .
The to cancel.
The .
A state object for tracking cancellation and a TaskCompletionSource.
The type of value returned from a task.
We use this class so that we only allocate one object to support all continuations
required for cancellation handling, rather than a special closure and delegate for each one.
Initializes a new instance of the class.
The task completion source.
The cancellation token.
Gets the cancellation token.
Gets the Task completion source.
Gets or sets the cancellation token registration.
Provider that caches semantic models for requested trees, with a strong reference to the model.
Clients using this provider are responsible for maintaining the lifetime of the entries in this cache,
and should invoke and to clear entries when appropriate.
For example, uses this provider to ensure that semantic model instances
are shared between the compiler and analyzers for improved analyzer execution performance. The underlying
executing analyzers clears per-tree entries in the cache whenever a
has been processed, indicating all relevant analyzers have executed on the corresponding syntax tree for the event.
Similarly, it clears the entire compilation wide cache whenever a has been processed,
indicating all relevant analyzers have executed on the entire compilation.
Wrapper over the core which holds a strong reference to key-value pairs for the lifetime of a compilation that this provider is associated with.
This ensures that values are never re-computed for equivalent keys while analyzing each compilation, improving overall analyzer performance.
The last event placed into a compilation's event queue.
The first event placed into a compilation's event queue.
Optional filter span for a synthesized CompilationUnitCompletedEvent generated for span-based semantic diagnostic computation.
Such synthesized events are used primarily for performance improvements when running compiler analyzer in span-based mode in the IDE,
such as computing diagnostics for the lightbulb for the current line.
Note that such a synthesized CompilationUnitCompletedEvent with non-null FilterSpan is not a true
compilation unit completed event, but just a stub event to drive span-based semantic model action callbacks
for analyzer execution. This event will eventually be followed by a true CompilationUnitCompletedEvent
with null FilterSpan when the entire compilation unit has actually completed.
See https://github.com/dotnet/roslyn/issues/56843 for details.
Builder for storing current, possibly partial, analysis results:
1. Diagnostics reported by analyzers.
2. AnalyzerTelemetryInfo.
Set of exception diagnostics reported for exceptions thrown by the analyzers.
Underlying with a non-null , used to drive analyzer execution.
Analyzers to execute on the compilation.
Options to configure analyzer execution.
An optional cancellation token which can be used to cancel analysis.
Note: This token is only used if the API invoked to get diagnostics doesn't provide a cancellation token.
Creates a new compilation by attaching diagnostic analyzers to an existing compilation.
The original compilation.
The set of analyzers to include in future analyses.
Options that are passed to analyzers.
Creates a new compilation by attaching diagnostic analyzers to an existing compilation.
The original compilation.
The set of analyzers to include in future analyses.
Options to configure analyzer execution.
Returns diagnostics produced by all .
Returns diagnostics produced by all .
Returns diagnostics produced by given .
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Executes all and returns the corresponding with all diagnostics and telemetry info.
Executes the given and returns the corresponding with all diagnostics and telemetry info.
Analyzers whose analysis results are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns all diagnostics produced by compilation and by all .
Returns all diagnostics produced by compilation and by all .
Returns diagnostics produced by compilation actions of all .
Returns diagnostics produced by compilation actions of given .
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns syntax diagnostics produced by all from analyzing the given .
Depending on analyzers' behavior, returned diagnostics can have locations outside the tree,
and some diagnostics that would be reported for the tree by an analysis of the complete compilation
can be absent.
Syntax tree to analyze.
Cancellation token.
Returns syntax diagnostics produced by all from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, returned diagnostics can have locations outside the tree or filter span,
and some diagnostics that would be reported for the tree by an analysis of the complete compilation
can be absent.
Syntax tree to analyze.
Optional filter span to analyze within the tree.
Cancellation token.
Returns syntax diagnostics produced by given from analyzing the given .
Depending on analyzers' behavior, returned diagnostics can have locations outside the tree,
and some diagnostics that would be reported for the tree by an analysis of the complete compilation
can be absent.
Syntax tree to analyze.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns syntax diagnostics produced by given from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, returned diagnostics can have locations outside the tree or filter span,
and some diagnostics that would be reported for the tree by an analysis of the complete compilation
can be absent.
Syntax tree to analyze.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Optional filter span to analyze within the tree.
Cancellation token.
Returns an populated with produced by all from analyzing the given .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Syntax tree to analyze.
Cancellation token.
Returns an populated with produced by all
from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Syntax tree to analyze.
Optional filter span to analyze within the tree.
Cancellation token.
Returns an populated with produced by given from analyzing the given .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Syntax tree to analyze.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns an populated with produced by given
from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Syntax tree to analyze.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Optional filter span to analyze within the tree.
Cancellation token.
Returns an populated with produced by all from analyzing the given additional .
The given must be part of for the for this CompilationWithAnalyzers instance.
Depending on analyzers' behavior, some diagnostics that would be reported for the file by an analysis of the complete compilation can be absent.
Additional file to analyze.
Cancellation token.
Returns an populated with produced by given from analyzing the given additional .
The given must be part of for the for this CompilationWithAnalyzers instance.
Depending on analyzers' behavior, some diagnostics that would be reported for the file by an analysis of the complete compilation can be absent.
Additional file to analyze.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns an populated with produced by all from analyzing the given additional ,
optionally scoped to a .
The given must be part of for the for this CompilationWithAnalyzers instance.
Depending on analyzers' behavior, some diagnostics that would be reported for the file by an analysis of the complete compilation can be absent.
Additional file to analyze.
Optional filter span to analyze within the .
Cancellation token.
Returns an populated with produced by given from analyzing the given additional ,
optionally scoped to a .
The given must be part of for the for this CompilationWithAnalyzers instance.
Depending on analyzers' behavior, some diagnostics that would be reported for the file by an analysis of the complete compilation can be absent.
Additional file to analyze.
Optional filter span to analyze within the .
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns semantic diagnostics produced by all from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Semantic model representing the syntax tree to analyze.
An optional span within the tree to scope analysis.
Cancellation token.
Returns semantic diagnostics produced by the given from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Semantic model representing the syntax tree to analyze.
An optional span within the tree to scope analysis.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Returns an populated with produced by all from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Semantic model representing the syntax tree to analyze.
An optional span within the tree to scope analysis.
Cancellation token.
Returns an populated with produced by the given from analyzing the given , optionally scoped to a .
Depending on analyzers' behavior, some diagnostics that would be reported for the tree by an analysis of the complete compilation can be absent.
Semantic model representing the syntax tree to analyze.
An optional span within the tree to scope analysis.
Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of .
Cancellation token.
Core method to compute analyzer diagnostics for the given .
This method is used to compute diagnostics for the entire compilation or a specific file.
It executes the required analyzers and stores the reported analyzer diagnostics into
.
PERF: We re-use the underlying for the below cases:
1. If the given analysis scope only includes the .
2. If we are only computing syntax diagnostics.
For rest of the cases, we always fork the underlying with a
new compilation event queue, execute the analyzers on this forked compilation and then
discard this compilation. Using a forked compilation allows us to avoid performing expensive
partial analysis state tracking for analyzer execution. It is the responsibility of the
CompilationWithAnalyzers host to club the analyzer diagnostics requests into minimal number of
calls into CompilationWithAnalyzers to get the optimum performance by minimize compilation forking.
See https://github.com/dotnet/roslyn/issues/66714 for more details.
Given a set of compiler or generated , returns the effective diagnostics after applying the below filters:
1) specified for the given .
2) specified for the given .
3) Diagnostic suppression through applied .
4) Pragma directives for the given .
Given a set of compiler or generated , returns the effective diagnostics after applying the below filters:
1) specified for the given .
2) specified for the given .
3) Diagnostic suppression through applied .
4) Pragma directives for the given .
Returns true if all the diagnostics that can be produced by this analyzer are suppressed through options.
Analyzer to be checked for suppression.
Compilation options.
Optional delegate which is invoked when an analyzer throws an exception.
Delegate can do custom tasks such as report the given analyzer exception diagnostic, report a non-fatal watson for the exception, etc.
This method should be invoked when the analyzer host is disposing off the given .
It clears the cached internal state (supported descriptors, registered actions, exception handlers, etc.) for analyzers.
Analyzers whose state needs to be cleared.
Gets telemetry info for the given analyzer, such as count of registered actions, the total execution time (if is true), etc.
Gets the count of registered actions for the analyzer.
Gets the execution time for the given analyzer.
Options to configure analyzer execution within .
Options passed to s.
An optional delegate to be invoked when an analyzer throws an exception.
An optional delegate to be invoked when an analyzer throws an exception as an exception filter.
Flag indicating whether analysis can be performed concurrently on multiple threads.
Flag indicating whether analyzer execution time should be logged.
Flag indicating whether analyzer diagnostics with should be reported.
Creates a new .
Options that are passed to analyzers.
Action to invoke if an analyzer throws an exception.
Flag indicating whether analysis can be performed concurrently on multiple threads.
Flag indicating whether analyzer execution time should be logged.
Creates a new .
Options that are passed to analyzers.
Action to invoke if an analyzer throws an exception.
Flag indicating whether analysis can be performed concurrently on multiple threads.
Flag indicating whether analyzer execution time should be logged.
Flag indicating whether analyzer diagnostics with should be reported.
Creates a new .
Options that are passed to analyzers.
Action to invoke if an analyzer throws an exception.
Action to invoke if an analyzer throws an exception as an exception filter.
Flag indicating whether analysis can be performed concurrently on multiple threads.
Flag indicating whether analyzer execution time should be logged.
Flag indicating whether analyzer diagnostics with should be reported.
DiagnosticAnalyzer for compiler's syntax/semantic/compilation diagnostics.
Per-compilation DiagnosticAnalyzer for compiler's syntax/semantic/compilation diagnostics.
Context for initializing an analyzer.
Analyzer initialization can use an to register actions to be executed at any of:
-
compilation start,
-
compilation end,
-
completion of parsing a code document,
-
completion of semantic analysis of a code document,
-
completion of semantic analysis of a symbol,
-
start of semantic analysis of a method body or an expression appearing outside a method body,
-
completion of semantic analysis of a method body or an expression appearing outside a method body, or
-
completion of semantic analysis of a syntax node.
Register an action to be executed at compilation start.
A compilation start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Action to be executed at compilation start.
Register an action to be executed for a complete compilation.
A compilation action reports s about the .
Action to be executed at compilation end.
Register an action to be executed at completion of semantic analysis of a document,
which will operate on the of the document. A semantic model action
reports s about the model.
Action to be executed for a document's .
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
A symbol action reports s about s.
Action to be executed for an .
Action will be executed only if an 's Kind matches one of the values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
A symbol action reports s about s.
Action to be executed for an .
Action will be executed only if an 's Kind matches one of the values.
Register an action to be executed at start of semantic analysis of an and its members with an appropriate Kind.
Action to be executed.
Action will be executed only if an 's Kind matches the given .
Register an action to be executed at the start of semantic analysis of a method body or an expression appearing outside a method body.
A code block start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at the start of semantic analysis of a code block.
Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body.
A code block action reports s about code blocks.
Action to be executed for a code block.
Register an action to be executed at completion of parsing of a code document.
A syntax tree action reports s about the of a document.
Action to be executed at completion of parsing of a document.
Register an action to be executed for each non-code document.
An additional file action reports s about the of a document.
Action to be executed for each non-code document.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at the start of semantic analysis of a method body or an expression appearing outside a method body.
An operation block start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Action to be executed at the start of semantic analysis of an operation block.
Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body.
An operation block action reports s about operation blocks.
Action to be executed for an operation block.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or code block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or code block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Enable concurrent execution of analyzer actions registered by this analyzer.
An analyzer that registers for concurrent execution can have better performance than a non-concurrent analyzer.
However, such an analyzer must ensure that its actions can execute correctly in parallel.
Even when an analyzer registers for concurrent execution, certain related actions are *never* executed concurrently.
For example, end actions registered on any analysis unit (compilation, code block, operation block, etc.) are by definition semantically dependent on analysis from non-end actions registered on the same analysis unit.
Hence, end actions are never executed concurrently with non-end actions operating on the same analysis unit.
Configure analysis mode of generated code for this analyzer.
Non-configured analyzers will default to an appropriate default mode for generated code.
It is recommended for the analyzer to invoke this API with the required setting.
Indicates the minimum reported diagnostic severity for this analysis context.
Analyzer diagnostics with severity lesser than this severity are not reported.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Flags to configure mode of generated code analysis.
Disable analyzer action callbacks and diagnostic reporting for generated code.
Analyzer driver will not make callbacks into the analyzer for entities (source files, symbols, etc.) that it classifies as generated code.
Additionally, any diagnostic reported by the analyzer with location in generated code will not be reported.
Enable analyzer action callbacks for generated code.
Analyzer driver will make callbacks into the analyzer for all entities (source files, symbols, etc.) in the compilation, including generated code.
Enable reporting diagnostics on generated code.
Analyzer driver will not suppress any analyzer diagnostic based on whether or not it's location is in generated code.
Context for a compilation start action.
A compilation start action can use a to register actions to be executed at any of:
-
compilation end,
-
completion of parsing a code document,
-
completion of semantic analysis of a code document,
-
completion of semantic analysis of a symbol,
-
start of semantic analysis of a method body or an expression appearing outside a method body,
-
completion of semantic analysis of a method body or an expression appearing outside a method body, or
-
completion of semantic analysis of a syntax node.
that is the subject of the analysis.
Options specified for the analysis.
Token to check for requested cancellation of the analysis.
Register an action to be executed at compilation end.
A compilation end action reports s about the .
Action to be executed at compilation end.
Register an action to be executed at completion of semantic analysis of a document,
which will operate on the of the document. A semantic model action
reports s about the model.
Action to be executed for a document's .
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
A symbol action reports s about s.
Action to be executed for an .
Action will be executed only if an 's Kind matches one of the values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
A symbol action reports s about s.
Action to be executed for an .
Action will be executed only if an 's Kind matches one of the values.
Register an action to be executed at start of semantic analysis of an and its members with an appropriate Kind.
Action to be executed.
Action will be executed only if an 's Kind matches the given .
Register an action to be executed at the start of semantic analysis of a method body or an expression appearing outside a method body.
A code block start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at the start of semantic analysis of a code block.
Register an action to be executed at the end of semantic analysis of a method body or an expression appearing outside a method body.
A code block action reports s about code blocks.
Action to be executed for a code block.
Register an action to be executed at the start of semantic analysis of a method body or an expression appearing outside a method body.
An operation block start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Action to be executed at the start of semantic analysis of an operation block.
Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body.
An operation block action reports s about operation blocks.
Action to be executed for an operation block.
Register an action to be executed at completion of parsing of a code document.
A syntax tree action reports s about the of a document.
Action to be executed at completion of parsing of a document.
Register an action to be executed for each non-code document.
An additional file action reports s about the of a document.
Action to be executed for each non-code document.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or code block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or code block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
instance for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
instance for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Context for a compilation action or compilation end action.
A compilation action or compilation end action can use a to report s about a .
that is the subject of the analysis.
Options specified for the analysis.
Token to check for requested cancellation of the analysis.
Report a about a .
to be reported.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Attempts to compute or get the cached value provided by the given for the given .
Note that the pair {, } acts as the key.
Reusing the same instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
The type of the value associated with the key.
for which the value is queried.
Provider that computes the underlying value.
Value associated with the key.
Returns true on success, false otherwise.
Context for a semantic model action.
A semantic model action operates on the of a code document, and can use a to report s about the model.
that is the subject of the analysis.
Options specified for the analysis.
Token to check for requested cancellation of the analysis.
Syntax tree for the being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the underlying is generated code.
Report a about a .
to be reported.
Context for a symbol action.
A symbol action can use a to report s about an .
that is the subject of the analysis.
containing the .
Options specified for the analysis.
Optional filter tree being analyzed.
if we are analyzing the entire compilation.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
This property is guaranteed to be if is .
Token to check for requested cancellation of the analysis.
Indicates if the is generated code.
Report a about an .
to be reported.
Context for a symbol start action to analyze a symbol and its members.
A symbol start/end action can use a to report s about code within a and its members.
that is the subject of the analysis.
containing the .
Options specified for the analysis.
Indicates if the is generated code.
Optional filter tree being analyzed.
if we are analyzing the entire compilation.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
This property is guaranteed to be if is .
Token to check for requested cancellation of the analysis.
Register an action to be executed at end of semantic analysis of an and its members.
A symbol end action reports s about the code within a and its members.
Action to be executed at compilation end.
Register an action to be executed at the start of semantic analysis of a method body or an expression appearing outside a method body.
A code block start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at the start of semantic analysis of a code block.
Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body.
A code block action reports s about code blocks.
Action to be executed for a code block.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Enum type giving the syntax node kinds of the source language for which the action applies.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at the start of semantic analysis of a method body or an expression appearing outside a method body.
An operation block start action can register other actions and/or collect state information to be used in diagnostic analysis,
but cannot itself report any s.
Action to be executed at the start of semantic analysis of an operation block.
Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body.
An operation block action reports s about operation blocks.
Action to be executed for an operation block.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or code block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or code block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Context for a code block start action.
A code block start action can use a to register actions to be executed
at any of:
-
completion of semantic analysis of a method body or an expression appearing outside a method body, or
-
completion of semantic analysis of a syntax node.
Method body or expression subject to analysis.
for which the code block provides a definition or value.
that can provide semantic information about the s in the code block.
Options specified for the analysis.
Syntax tree corresponding to the code block being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Register an action to be executed at the end of semantic analysis of a method body or an expression appearing outside a method body.
A code block end action reports s about code blocks.
Action to be executed at the end of semantic analysis of a code block.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Register an action to be executed at completion of semantic analysis of a with an appropriate Kind.
A syntax node action can report s about s, and can also collect
state information to be used by other syntax node actions or code block end actions.
Action to be executed at completion of semantic analysis of a .
Action will be executed only if a 's Kind matches one of the syntax kind values.
Context for a code block action or code block end action.
A code block action or code block end action can use a to report s about a code block.
Code block that is the subject of the analysis.
for which the code block provides a definition or value.
that can provide semantic information about the s in the code block.
Options specified for the analysis.
Syntax tree for the code block being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Report a about a code block.
to be reported.
Context for an operation block start action.
An operation block start action can use an to register actions to be executed
at any of:
-
completion of semantic analysis of a method body or an expression appearing outside a method body, or
-
completion of semantic analysis of an operation.
One or more operation blocks that are the subject of the analysis.
This includes all blocks associated with the ,
such as method body, field/property/constructor/parameter initializer(s), attributes, etc.
Note that the operation blocks are not in any specific order.
for which the provides a definition or value.
containing the .
Options specified for the analysis.
Syntax tree for the being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Register an action to be executed at the end of semantic analysis of a method body or an expression appearing outside a method body.
A code block end action reports s about code blocks.
Action to be executed at the end of semantic analysis of a code block.
Register an action to be executed at completion of semantic analysis of an operation with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or operation block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Register an action to be executed at completion of semantic analysis of an with an appropriate Kind.
An operation action can report s about s, and can also collect
state information to be used by other operation actions or operation block end actions.
Action to be executed at completion of semantic analysis of an .
Action will be executed only if an 's Kind matches one of the operation kind values.
Gets a for a given from this analysis context's .
Operation block.
Context for an operation block action or operation block end action.
An operation block action or operation block end action can use an to report s about an operation block.
One or more operation blocks that are the subject of the analysis.
This includes all blocks associated with the ,
such as method body, field/property/constructor/parameter initializer(s), attributes, etc.
Note that the operation blocks are not in any specific order.
for which the provides a definition or value.
containing the .
Options specified for the analysis.
Syntax tree for the being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Report a about a code block.
to be reported.
Gets a for a given from this analysis context's .
Operation block.
Context for a syntax tree action.
A syntax tree action can use a to report s about a for a code document.
that is the subject of the analysis.
Options specified for the analysis.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Report a about a .
to be reported.
Context for an additional file action.
An additional file action can use an to report s about a non-source document.
that is the subject of the analysis.
Options specified for the analysis.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Token to check for requested cancellation of the analysis.
Compilation being analyzed.
Report a diagnostic for the given .
A diagnostic in a non-source document should be created with a non-source ,
which can be created using API.
Context for a syntax node action.
A syntax node action can use a to report s for a .
that is the subject of the analysis.
for the declaration containing the syntax node.
that can provide semantic information about the .
containing the .
Options specified for the analysis.
Syntax tree for the being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Report a about a .
to be reported.
Context for an operation action.
An operation action can use an to report s for an .
that is the subject of the analysis.
for the declaration containing the operation.
containing the .
Options specified for the analysis.
Syntax tree for the being analyzed.
Optional filter span within the for which to compute diagnostics.
if we are analyzing the entire
or the entire compilation.
Indicates if the is generated code.
Token to check for requested cancellation of the analysis.
Report a about a .
to be reported.
Gets a for the operation block containing the .
Context for suppressing analyzer and/or compiler non-error diagnostics reported for the compilation.
Analyzer and/or compiler non-error diagnostics reported for the compilation.
Each only receives diagnostics whose IDs were declared suppressible in its .
This may be a subset of the full set of reported diagnostics, as an optimization for
supporting incremental and partial analysis scenarios.
A diagnostic is considered suppressible by a DiagnosticSuppressor if *all* of the following conditions are met:
1. Diagnostic is not already suppressed in source via pragma/suppress message attribute.
2. Diagnostic's is not .
3. Diagnostic is not tagged with custom tag.
for the context.
Options specified for the analysis.
Token to check for requested cancellation of the analysis.
Report a for a reported diagnostic.
Gets a for the given , which is shared across all analyzers.
The base type for diagnostic analyzers.
Returns a set of descriptors for the diagnostics that this analyzer is capable of producing.
Called once at session start to register actions in the analysis context.
Place this attribute onto a type to cause it to be considered a diagnostic analyzer.
The source languages to which this analyzer applies. See .
Attribute constructor used to specify automatic application of a diagnostic analyzer.
One language to which the analyzer applies.
Additional languages to which the analyzer applies. See .
Returns a new compilation with attached diagnostic analyzers.
Compilation to which analyzers are to be added.
The set of analyzers to include in future analyses.
Options that are passed to analyzers.
Returns a new compilation with attached diagnostic analyzers.
Compilation to which analyzers are to be added.
The set of analyzers to include in future analyses.
Options to configure analyzer execution within .
Queue to store analyzer diagnostics on the .
Simple diagnostics queue: maintains all diagnostics reported by all analyzers in a single queue.
Categorized diagnostics queue: maintains separate set of simple diagnostic queues for local semantic, local syntax and non-local diagnostics for every analyzer.
Scope for setting up analyzers for an entire session, automatically associating actions with analyzers.
Scope for setting up analyzers for a compilation, automatically associating actions with analyzers.
Scope for setting up analyzers for code within a symbol and its members.
Scope for setting up analyzers for a code block, automatically associating actions with analyzers.
Scope for setting up analyzers for an operation block, automatically associating actions with analyzers.
Scope for setting up analyzers for an entire session, capable of retrieving the actions.
Scope for setting up analyzers for an entire session, capable of retrieving the actions.
Scope for setting up analyzers for a compilation, capable of retrieving the actions.
Scope for setting up analyzers for analyzing a symbol and its members.
Scope for setting up analyzers for analyzing a symbol and its members.
Scope for setting up analyzers for a code block, capable of retrieving the actions.
Scope for setting up analyzers for a code block, capable of retrieving the actions.
Actions registered by a particular analyzer.
Append analyzer actions from to actions from this instance.
Analyzer actions to append.
The base type for diagnostic suppressors that can programmatically suppress analyzer and/or compiler non-error diagnostics.
Returns a set of descriptors for the suppressions that this suppressor is capable of producing.
Suppress analyzer and/or compiler non-error diagnostics reported for the compilation.
This may be a subset of the full set of reported diagnostics, as an optimization for
supporting incremental and partial analysis scenarios.
A diagnostic is considered suppressible by a DiagnosticSuppressor if *all* of the following conditions are met:
1. Diagnostic is not already suppressed in source via pragma/suppress message attribute.
2. Diagnostic's is not .
3. Diagnostic is not tagged with custom tag.
Represents a source file or an additional file.
For source files, is non-null and is null.
For additional files, is non-null and is null.
Provides custom values associated with instances using the given computeValue delegate.
Provides custom values associated with instances using the given .
Delegate to compute the value associated with a given instance.
Optional equality comparer to determine equivalent instances that have the same value.
If no comparer is provided, then is used by default.
Programmatic suppression of a by a .
Creates a suppression of a with the given .
Descriptor for the suppression, which must be from
for the creating this suppression.
to be suppressed, which must be from
for the suppression context in which this suppression is being created.
Descriptor for this suppression.
Diagnostic suppressed by this suppression.
Attempts to resolve the "Target" argument of the global SuppressMessageAttribute to symbols in compilation.
Indicates if resolved "Target" argument is in Roslyn's format.
Resolved symbols for the the "Target" argument of the global SuppressMessageAttribute.
An event for each declaration in the program (namespace, type, method, field, parameter, etc).
Note that some symbols may have multiple declarations (namespaces, partial types) and may therefore
have multiple events.
Provides custom values associated with instances using the given computeValue delegate.
Provides values associated with instances using the given .
Delegate to compute the value associated with a given instance.
Optional equality comparer to determine equivalent instances that have the same value.
If no comparer is provided, then is used by default.
Represents an analyzer reference that can't be resolved.
For error reporting only, can't be used to reference an analyzer assembly.
Contains information about the source of a programmatic diagnostic suppression produced by an .
Represents a set of filtered diagnostic severities.
Currently, we only support filtering out Hidden and Info severities during build.
Contains information about the source of diagnostic suppression.
of the suppressed diagnostic.
If the diagnostic was suppressed by an attribute, then returns that attribute.
Otherwise, returns null.
If the diagnostic was suppressed by one or more programmatic suppressions by (s),
then returns the corresponding s, in no specific order.
Otherwise, returns an empty array.
Is this an that the loader considers to be part of the hosting
process. Either part of the compiler itself or the process hosting the compiler.
For a given return the location it was originally added
from. This will return null for any value that was not directly added through the
loader.
The base implementation for . This type provides caching and tracking of inputs given
to .
This type generally assumes that files on disk aren't changing, since it ensure that two calls to
will always return the same thing, per that interface's contract.
Loads analyzer assemblies from their original locations in the file system.
Assemblies will only be loaded from the locations specified when the loader
is instantiated.
This type is meant to be used in scenarios where it is OK for the analyzer
assemblies to be locked on disk for the lifetime of the host; for example,
csc.exe and vbc.exe. In scenarios where support for updating or deleting
the analyzer on disk is required a different loader should be used.
Set of analyzer dependencies original full paths to the data calculated for that path
Access must be guarded by
Mapping of analyzer dependency original full path and culture to the real satellite
assembly path. If the satellite assembly doesn't exist for the original analyzer and
culture, the real path value stored will be null.
Access must be guarded by
Maps analyzer dependency simple names to the set of original full paths it was loaded from. This _only_
tracks the paths provided to the analyzer as it's a place to look for indirect loads.
Access must be guarded by
A collection of s that can be used to override the assembly resolution process.
When multiple resolvers are present they are consulted in-order, with the first resolver to return a non-null
winning.
Whether or not we're disposed. Once disposed, all functionality on this type should throw.
The implementation needs to load an with the specified . The
parameter is the original path. It may be different than
as that is empty on .NET Core.
This method should return an instance or throw.
Determines if the satisfies the request for
. This is partial'd out as each runtime has a different
definition of matching name.
Get the and the path it should be loaded from for the given original
analyzer path
This is used in the implementation of the loader instead of
because we only want information for registered paths. Using unregistered paths inside the
implementation should result in errors.
Get the path a satellite assembly should be loaded from for the given original
analyzer path and culture
This is used during assembly resolve for satellite assemblies to determine the
path from where the satellite assembly should be loaded for the specified culture.
This method calls to ensure this path
contains the satellite assembly.
Return the best (original, real) path information for loading an assembly with the specified .
When overridden in a derived class, allows substituting an assembly path after we've
identified the context to load an assembly in, but before the assembly is actually
loaded from disk. This is used to substitute out the original path with the shadow-copied version.
When overridden in a derived class, allows substituting a satellite assembly path after we've
identified the context to load a satellite assembly in, but before the satellite assembly is actually
loaded from disk. This is used to substitute out the original path with the shadow-copied version.
When is overridden this returns the most recent
real path calculated for the
Iterates the if any, to see if any of them can resolve
the given to an .
The name of the assembly to resolve
An if one of the resolvers is successful, or
The default implementation is to simply load in place.
The default implementation is to simply load in place.
Return an which does not lock assemblies on disk that is
most appropriate for the current platform.
A shadow copy path will be created on Windows and this value
will be the base directory where shadow copy assemblies are stored.
Handles loading analyzer assemblies and their dependencies.
Before an analyzer assembly is loaded with ,
its location and the location of all of its dependencies must first be specified
by calls to .
To the extent possible, implementations should remain consistent in the face
of exceptions and allow the caller to handle them. This allows the caller to
decide how to surface issues to the user and whether or not they are fatal. For
example, if asked to load an a non-existent or inaccessible file a command line
tool may wish to exit immediately, while an IDE may wish to keep going and give
the user a chance to correct the issue.
Given the full path to an assembly on disk, loads and returns the
corresponding object.
Multiple calls with the same path should return the same
instance.
is null.
is not a full path.
Adds a file to consider when loading an analyzer or its dependencies.
is null.
is not a full path.
Allows a host to override how assembly resolution is performed by the .
Attempts to resolve an assembly by name.
The assembly to resolve
The resolved assembly, or
The base directory for shadow copies. Each instance of
gets its own
subdirectory under this directory. This is also the starting point
for scavenge operations.
The directory where this instance of
will shadow-copy assemblies, and the mutex created to mark that the owner of it is still active.
Abstracts the ability to classify and load messages for error codes. Allows the error
infrastructure to be reused between C# and VB.
Caches the return values for .
Given an error code, get the severity (warning or error) of the code.
Load the message for the given error code. If the message contains
"fill-in" placeholders, those should be expressed in standard string.Format notation
and be in the string.
Get an optional localizable title for the given diagnostic code.
Get an optional localizable description for the given diagnostic code.
Get a localizable message format string for the given diagnostic code.
Get an optional help link for the given diagnostic code.
Get the diagnostic category for the given diagnostic code.
Default category is .
Get the text prefix (e.g., "CS" for C#) used on error messages.
Get the warning level for warnings (e.g., 1 or greater for C#). VB does not have warning
levels and always uses 1. Errors should return 0.
Type that defines error codes. For testing purposes only.
Create a simple language specific diagnostic for given error code.
Create a simple language specific diagnostic with no location for given info.
Create a simple language specific diagnostic for given error code.
Given a message identifier (e.g., CS0219), severity, warning as error and a culture,
get the entire prefix (e.g., "error CS0219: Warning as Error:" for C# or "error BC42024:" for VB) used on error messages.
Convert given symbol to string representation.
Given an error code (like 1234) return the identifier (CS1234 or BC1234).
Produces the filtering action for the diagnostic based on the options passed in.
A new with new effective severity based on the options or null if the
diagnostic has been suppressed.
Filter a based on the compilation options so that /nowarn and /warnaserror etc. take effect.options
A with effective severity based on option or null if suppressed.
Takes an exception produced while writing to a file stream and produces a diagnostic.
Represents a diagnostic, such as a compiler error or a warning, along with the location where it occurred.
A diagnostic (such as a compiler error or a warning), along with the location where it occurred.
The default warning level, which is also used for non-error diagnostics.
The warning level used for hidden and info diagnostics. Because these diagnostics interact with other editor features, we want them to always be produced unless /warn:0 is set.
The maximum warning level represented by a large value of 9999.
Creates a instance.
A describing the diagnostic
An optional primary location of the diagnostic. If null, will return .
Arguments to the message of the diagnostic
The instance.
Creates a instance.
A describing the diagnostic.
An optional primary location of the diagnostic. If null, will return .
An optional set of name-value pairs by means of which the analyzer that creates the diagnostic
can convey more detailed information to the fixer. If null, will return
.
Arguments to the message of the diagnostic.
The instance.
Creates a instance.
A describing the diagnostic.
An optional primary location of the diagnostic. If null, will return .
An optional set of additional locations related to the diagnostic.
Typically, these are locations of other items referenced in the message.
If null, will return an empty list.
Arguments to the message of the diagnostic.
The instance.
Creates a instance.
A describing the diagnostic.
An optional primary location of the diagnostic. If null, will return .
An optional set of additional locations related to the diagnostic.
Typically, these are locations of other items referenced in the message.
If null, will return an empty list.
An optional set of name-value pairs by means of which the analyzer that creates the diagnostic
can convey more detailed information to the fixer. If null, will return
.
Arguments to the message of the diagnostic.
The instance.
Creates a instance.
A describing the diagnostic.
An optional primary location of the diagnostic. If null, will return .
Effective severity of the diagnostic.
An optional set of additional locations related to the diagnostic.
Typically, these are locations of other items referenced in the message.
If null, will return an empty list.
An optional set of name-value pairs by means of which the analyzer that creates the diagnostic
can convey more detailed information to the fixer. If null, will return
.
Arguments to the message of the diagnostic.
The instance.
Creates a instance which is localizable.
An identifier for the diagnostic. For diagnostics generated by the compiler, this will be a numeric code with a prefix such as "CS1001".
The category of the diagnostic. For diagnostics generated by the compiler, the category will be "Compiler".
The diagnostic message text.
The diagnostic's effective severity.
The diagnostic's default severity.
True if the diagnostic is enabled by default
The warning level, greater than 0 if severity is ; otherwise 0.
An optional short localizable title describing the diagnostic.
An optional longer localizable description for the diagnostic.
An optional hyperlink that provides more detailed information regarding the diagnostic.
An optional primary location of the diagnostic. If null, will return .
An optional set of additional locations related to the diagnostic.
Typically, these are locations of other items referenced in the message.
If null, will return an empty list.
An optional set of custom tags for the diagnostic. See for some well known tags.
If null, will return an empty list.
An optional set of name-value pairs by means of which the analyzer that creates the diagnostic
can convey more detailed information to the fixer. If null, will return
.
The instance.
Creates a instance which is localizable.
An identifier for the diagnostic. For diagnostics generated by the compiler, this will be a numeric code with a prefix such as "CS1001".
The category of the diagnostic. For diagnostics generated by the compiler, the category will be "Compiler".
The diagnostic message text.
The diagnostic's effective severity.
The diagnostic's default severity.
True if the diagnostic is enabled by default
The warning level, greater than 0 if severity is ; otherwise 0.
Flag indicating whether the diagnostic is suppressed by a source suppression.
An optional short localizable title describing the diagnostic.
An optional longer localizable description for the diagnostic.
An optional hyperlink that provides more detailed information regarding the diagnostic.
An optional primary location of the diagnostic. If null, will return .
An optional set of additional locations related to the diagnostic.
Typically, these are locations of other items referenced in the message.
If null, will return an empty list.
An optional set of custom tags for the diagnostic. See for some well known tags.
If null, will return an empty list.
An optional set of name-value pairs by means of which the analyzer that creates the diagnostic
can convey more detailed information to the fixer. If null, will return
.
The instance.
Gets the diagnostic descriptor, which provides a description about a .
Gets the diagnostic identifier. For diagnostics generated by the compiler, this will be a numeric code with a prefix such as "CS1001".
Gets the category of diagnostic. For diagnostics generated by the compiler, the category will be "Compiler".
Get the culture specific text of the message.
Gets the default of the diagnostic's .
To get the effective severity of the diagnostic, use .
Gets the effective of the diagnostic.
To get the default severity of diagnostic's , use .
To determine if this is a warning treated as an error, use .
Gets the warning level. This is 0 for diagnostics with severity ,
otherwise an integer greater than zero.
Returns true if the diagnostic has a source suppression, i.e. an attribute or a pragma suppression.
Gets the for suppressed diagnostics, i.e. = true.
Otherwise, returns null.
Returns true if this diagnostic is enabled by default by the author of the diagnostic.
Returns true if this is a warning treated as an error; otherwise false.
True implies =
and = .
Gets the primary location of the diagnostic, or if no primary location.
Gets an array of additional locations related to the diagnostic.
Typically these are the locations of other items referenced in the message.
Gets custom tags for the diagnostic.
Gets property bag for the diagnostic. it will return
if there is no entry. This can be used to put diagnostic specific information you want
to pass around. for example, to corresponding fixer.
Create a new instance of this diagnostic with the Location property changed.
Create a new instance of this diagnostic with the Severity property changed.
Create a new instance of this diagnostic with the suppression info changed.
Create a new instance of this diagnostic with the given programmatic suppression info.
Returns true if the diagnostic location (or any additional location) is within the given tree and intersects with the filterSpanWithinTree, if non-null.
Gets the default warning level for a diagnostic severity. Warning levels are used with the /warn:N
command line option to suppress diagnostics over a severity of interest. When N is 0, only error severity
messages are produced by the compiler. Values greater than 0 indicated that warnings up to and including
level N should also be included.
and are treated as warning
level 1. In other words, these diagnostics which typically interact with editor features are enabled unless
the special /warn:0 option is set.
A value.
The default compiler warning level for .
Returns true if a diagnostic is not configurable, i.e. cannot be suppressed or filtered or have its severity changed.
For example, compiler errors are always non-configurable.
Returns true if this is an error diagnostic which cannot be suppressed and is guaranteed to break the build.
Only diagnostics which have default severity error and are tagged as NotConfigurable fall in this bucket.
This includes all compiler error diagnostics and specific analyzer error diagnostics that are marked as not configurable by the analyzer author.
Returns true if this is a unsuppressed diagnostic with an effective error severity.
This type is attached to diagnostics for required language version and should only be used
on such diagnostics, as they are recognized by .
Represents a mutable bag of diagnostics. You can add diagnostics to the bag,
and also get all the diagnostics out of the bag (the bag implements
IEnumerable<Diagnostics>. Once added, diagnostics cannot be removed, and no ordering
is guaranteed.
It is ok to Add diagnostics to the same bag concurrently on multiple threads.
It is NOT ok to Add concurrently with Clear or Free operations.
The bag is optimized to be efficient when containing zero errors.
Return true if the bag is completely empty - not even containing void diagnostics.
This exists for short-circuiting purposes. Use
to get a resolved Tuple(Of NamedTypeSymbol, ImmutableArray(Of Diagnostic)) (i.e. empty after eliminating void diagnostics).
Returns true if the bag has any diagnostics with DefaultSeverity=Error. Does not consider warnings or informationals
or warnings promoted to error via /warnaserror.
Resolves any lazy diagnostics in the bag.
Generally, this should only be called by the creator (modulo pooling) of the bag (i.e. don't use bags to communicate -
if you need more info, pass more info).
Returns true if the bag has any non-lazy diagnostics with DefaultSeverity=Error. Does not consider warnings or informationals
or warnings promoted to error via /warnaserror.
Does not resolve any lazy diagnostics in the bag.
Generally, this should only be called by the creator (modulo pooling) of the bag (i.e. don't use bags to communicate -
if you need more info, pass more info).
Add a diagnostic to the bag.
Add multiple diagnostics to the bag.
Add multiple diagnostics to the bag.
Add another DiagnosticBag to the bag.
Add another DiagnosticBag to the bag and free the argument.
Seal the bag so no further errors can be added, while clearing it and returning the old set of errors.
Return the bag to the pool.
Generally, this should only be called by the creator (modulo pooling) of the bag (i.e. don't use bags to communicate -
if you need more info, pass more info).
Using an iterator to avoid copying the list. If perf is a problem,
create an explicit enumerator type.
Get the underlying concurrent storage, creating it on demand if needed.
NOTE: Concurrent Adding to the bag is supported, but concurrent Clearing is not.
If one thread adds to the bug while another clears it, the scenario is
broken and we cannot do anything about it here.
NOTE: Concurrent Adding to the bag is supported, but concurrent Clearing is not.
If one thread adds to the bug while another clears it, the scenario is
broken and we cannot do anything about it here.
Provides a description about a
An unique identifier for the diagnostic.
Choose an appropriate diagnostic ID such that it is unique.
A short localizable title describing the diagnostic.
An optional longer localizable description for the diagnostic.
An optional hyperlink that provides more detailed information regarding the diagnostic.
A localizable format message string, which can be passed as the first argument to when creating the diagnostic message with this descriptor.
The category of the diagnostic (like Design, Naming etc.)
The default severity of the diagnostic.
Returns true if the diagnostic is enabled by default.
Custom tags for the diagnostic.
Create a DiagnosticDescriptor, which provides description about a .
NOTE: For localizable , and/or ,
use constructor overload .
A unique identifier for the diagnostic. For example, code analysis diagnostic ID "CA1001".
A short title describing the diagnostic. For example, for CA1001: "Types that own disposable fields should be disposable".
A format message string, which can be passed as the first argument to when creating the diagnostic message with this descriptor.
For example, for CA1001: "Implement IDisposable on '{0}' because it creates members of the following IDisposable types: '{1}'."
The category of the diagnostic (like Design, Naming etc.). For example, for CA1001: "Microsoft.Design".
Default severity of the diagnostic.
True if the diagnostic is enabled by default.
An optional longer description of the diagnostic.
An optional hyperlink that provides a more detailed description regarding the diagnostic.
Optional custom tags for the diagnostic. See for some well known tags.
Choose an appropriate diagnostic ID such that it is unique.
Create a DiagnosticDescriptor, which provides description about a .
A unique identifier for the diagnostic. For example, code analysis diagnostic ID "CA1001".
A short localizable title describing the diagnostic. For example, for CA1001: "Types that own disposable fields should be disposable".
A localizable format message string, which can be passed as the first argument to when creating the diagnostic message with this descriptor.
For example, for CA1001: "Implement IDisposable on '{0}' because it creates members of the following IDisposable types: '{1}'."
The category of the diagnostic (like Design, Naming etc.). For example, for CA1001: "Microsoft.Design".
Default severity of the diagnostic.
True if the diagnostic is enabled by default.
An optional longer localizable description of the diagnostic.
An optional hyperlink that provides a more detailed description regarding the diagnostic.
Optional custom tags for the diagnostic. See for some well known tags.
Example descriptor for rule CA1001:
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
new LocalizableResourceString(nameof(FxCopRulesResources.TypesThatOwnDisposableFieldsShouldBeDisposable), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources)),
new LocalizableResourceString(nameof(FxCopRulesResources.TypeOwnsDisposableFieldButIsNotDisposable), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources)),
FxCopDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: "http://msdn.microsoft.com/library/ms182172.aspx",
customTags: DiagnosticCustomTags.Microsoft);
Choose an appropriate diagnostic ID such that it is unique.
Gets the effective severity of diagnostics created based on this descriptor and the given .
Compilation options
Returns true if diagnostic descriptor is not configurable, i.e. cannot be suppressed or filtered or have its severity changed.
For example, compiler errors are always non-configurable.
Returns true if diagnostic descriptor is custom configurable, i.e. analyzer supports custom
ways for configuring diagnostic severity that may not be understood by the compiler.
Returns true if diagnostic descriptor is a built-in compiler diagnostic or is not configurable
or is custom configurable.
Formats messages.
Formats the message using the optional .
The diagnostic.
The formatter; or null to use the default formatter.
The formatted message.
A DiagnosticInfo object has information about a diagnostic, but without any attached location information.
More specialized diagnostics with additional information (e.g., ambiguity errors) can derive from this class to
provide access to additional information about the error, such as what symbols were involved in the ambiguity.
The error code, as an integer.
Returns the effective severity of the diagnostic: whether this diagnostic is informational, warning, or error.
If IsWarningsAsError is true, then this returns , while returns .
Returns whether this diagnostic is informational, warning, or error by default, based on the error code.
To get diagnostic's effective severity, use .
Gets the warning level. This is 0 for diagnostics with severity ,
otherwise an integer greater than zero.
Returns true if this is a warning treated as an error.
True implies = and
= .
Get the diagnostic category for the given diagnostic code.
Default category is .
If a derived class has additional information about other referenced symbols, it can
expose the locations of those symbols in a general way, so they can be reported along
with the error.
Get the message id (for example "CS1001") for the message. This includes both the error number
and a prefix identifying the source.
Get the text of the message in the given language.
For a DiagnosticInfo that is lazily evaluated, this method evaluates it
and returns a non-lazy DiagnosticInfo.
Describes how severe a diagnostic is.
Something that is an issue, as determined by some authority,
but is not surfaced through normal means.
There may be different mechanisms that act on these issues.
Information that does not indicate a problem (i.e. not prescriptive).
Something suspicious but allowed.
Something not allowed by the rules of the language or other authority.
Values for severity that are used internally by the compiler but are not exposed.
An unknown severity diagnostic is something whose severity has not yet been determined.
If an unknown diagnostic is resolved and found to be unnecessary then it is
treated as a "Void" diagnostic
Values for ErrorCode/ERRID that are used internally by the compiler but are not exposed.
The code has yet to be determined.
The code was lazily determined and does not need to be reported.
A diagnostic (such as a compiler error or a warning), along with the location where it occurred.
Get the information about the diagnostic: the code, severity, message, etc.
True if the DiagnosticInfo for this diagnostic requires (or required - this property
is immutable) resolution.
Usage is unexpected unless is true.
A program location in source code.
Represents a span of text in a source code file in terms of file name, line number, and offset within line.
However, the file is actually whatever was passed in when asked to parse; there may not really be a file.
Path, or null if the span represents an invalid value.
Path may be if not available.
Gets the span.
True if the is a mapped path.
A mapped path is a path specified in source via #line (C#) or #ExternalSource (VB) directives.
Initializes the instance.
The file identifier - typically a relative or absolute path.
The start line position.
The end line position.
is null.
Initializes the instance.
The file identifier - typically a relative or absolute path.
The span.
is null.
Gets the of the start of the span.
Gets the of the end of the span.
Returns true if the span represents a valid location.
Determines if two FileLinePositionSpan objects are equal.
The path is treated as an opaque string, i.e. a case-sensitive comparison is used.
Determines if two FileLinePositionSpan objects are equal.
Serves as a hash function for FileLinePositionSpan.
The hash code.
The path is treated as an opaque string, i.e. a case-sensitive hash is calculated.
Returns a that represents .
The string representation of .
Path: (0,0)-(5,6)
A localizable resource string that may possibly be formatted differently depending on culture.
Creates a localizable resource string with no formatting arguments.
nameof the resource that needs to be localized.
for the calling assembly.
Type handling assembly's resource management. Typically, this is the static class generated for the resources file from which resources are accessed.
Creates a localizable resource string that may possibly be formatted differently depending on culture.
nameof the resource that needs to be localized.
for the calling assembly.
Type handling assembly's resource management. Typically, this is the static class generated for the resources file from which resources are accessed.
Optional arguments for formatting the localizable resource string.
A string that may possibly be formatted differently depending on culture.
NOTE: Types implementing must be serializable.
FixedLocalizableString representing an empty string.
Fired when an exception is raised by any of the public methods of .
If the exception handler itself throws an exception, that exception is ignored.
Formats the value of the current instance using the optionally specified format.
Formats the value of the current instance using the optionally specified format.
Provides the implementation of ToString. ToString will provide a default value
if this method throws an exception.
Provides the implementation of GetHashCode. GetHashCode will provide a default value
if this method throws an exception.
Provides the implementation of Equals. Equals will provide a default value
if this method throws an exception.
Flag indicating if any methods on this type can throw exceptions from public entrypoints.
A program location in source code.
Location kind (None/SourceFile/MetadataFile).
Returns true if the location represents a specific location in a source code file.
Returns true if the location is in metadata.
The syntax tree this location is located in or null if not in a syntax tree.
Returns the metadata module the location is associated with or null if the module is not available.
Might return null even if returns true. The module symbol might not be available anymore,
for example, if the location is serialized and deserialized.
The location within the syntax tree that this location is associated with.
If returns False this method returns an empty which starts at position 0.
Gets the location in terms of path, line and column.
that contains path, line and column information.
Returns an invalid span (see ) if the information is not available.
The values are not affected by line mapping directives (#line in C# or #ExternalSource in VB).
Gets the location in terms of path, line and column after applying source line mapping directives
(#line in C# or #ExternalSource in VB).
that contains file, line and column information,
or an invalid span (see ) if not available.
A location of kind LocationKind.None.
Creates an instance of a for a span in a .
Creates an instance of a for a span in a file.
Creates an instance of a for a span in a file with a mapped file and span.
Specifies the kind of location (source vs. metadata).
Unspecified location.
The location represents a position in a source file.
The location represents a metadata file.
The location represents a position in an XML file.
The location in some external file.
A program location in metadata.
A class that represents no location at all. Useful for errors in command line options, for example.
Describes how to report a warning diagnostic.
Report a diagnostic by default.
Report a diagnostic as an error.
Report a diagnostic as a warning even though /warnaserror is specified.
Report a diagnostic as an info.
Report a diagnostic as hidden.
Suppress a diagnostic.
A program location in source code.
Provides a description about a programmatic suppression of a by a .
An unique identifier for the suppression.
Identifier of the suppressed diagnostic, i.e. .
A localizable justification about the suppression.
Create a SuppressionDescriptor, which provides a justification about a programmatic suppression of a .
NOTE: For localizable ,
use constructor overload .
A unique identifier for the suppression. For example, suppression ID "SP1001".
Identifier of the suppressed diagnostic, i.e. . For example, compiler warning Id "CS0649".
Justification for the suppression. For example: "Suppress CS0649 on fields marked with YYY attribute as they are implicitly assigned.".
Create a SuppressionDescriptor, which provides a localizable justification about a programmatic suppression of a .
A unique identifier for the suppression. For example, suppression ID "SP1001".
Identifier of the suppressed diagnostic, i.e. . For example, compiler warning Id "CS0649".
Justification for the suppression. For example: "Suppress CS0649 on fields marked with YYY attribute as they are implicitly assigned.".
Returns a flag indicating if the suppression is disabled for the given .
Compilation options
Indicates that the diagnostic is related to some unnecessary source code.
Indicates that the diagnostic is related to edit and continue.
Indicates that the diagnostic is related to build.
Indicates that the diagnostic is reported by the compiler.
Indicates that the diagnostic can be used for telemetry
Indicates that the diagnostic is not configurable, i.e. it cannot be suppressed or filtered or have its severity changed.
Indicates that the analyzer reporting the diagnostic supports custom severity configuration mechanism(s)
to allow end users to configure effective severity of the diagnostic.
Such analyzers are always considered to be enabled by the compiler and always receive analyzer callbacks.
Additionally, severity of the diagnostics reported with this custom tag is not altered by analyzer config options
to configure severity, i.e. 'dotnet_diagnostic' and 'dotnet_analyzer_diagnostic' entries.
See https://github.com/dotnet/roslyn/issues/52991 for further details.
Indicates that the diagnostic is related to an exception thrown by a .
Indicates that the diagnostic is an obsolete diagnostic with a custom ID
specified by the 'DiagnosticId' property on 'ObsoleteAttribute'.
Indicates that the diagnostic is a compilation end diagnostic reported
from a compilation end action.
A program location in an XML file.
APIs for constructing documentation comment id's, and finding symbols that match ids.
Creates an id string used by external documentation comment files to identify declarations of types,
namespaces, methods, properties, etc.
If is .
The documentation comment Id for this symbol, if it can be created. if it cannot be.
Creates an id string used to reference type symbols (not strictly declarations, includes arrays, pointers,
type parameters, etc.).
If is .
Gets all declaration symbols that match the declaration id string
Try to get all the declaration symbols that match the declaration id string.
Returns true if at least one symbol matches.
Gets the first declaration symbol that matches the declaration id string, order undefined.
Gets the symbols that match the reference id string.
Try to get all symbols that match the reference id string.
Returns true if at least one symbol matches.
Gets the first symbol that matches the reference id string, order undefined.
Callers should only call into and should check to see if it failed (in the case of an arbitrary symbol) or that it produced an expected
value (in the case a known symbol type was used).
This will always succeed for a or . It may not
succeed for other symbols.
Once used, an instance of this visitor should be discarded. Specifically it is stateful, and will
stay in the failed state once it transitions there.
If we hit anything we don't know about, indicate failure.
If we hit anything we don't know about, indicate failure.
WARN: This is a test hook - do not take a dependency on this.
A class used to provide XML documentation to the compiler for members from metadata. A
custom implementation of this class should be returned from a DocumentationResolver to provide XML
documentation comments from custom caches or locations.
Fetches a documentation comment for the given member ID.
The documentation member ID of the item to fetch.
The preferred culture to receive a comment in. Null if
there is no preference. This is a preference only, and providers may choose to provide
results from another culture if the preferred culture was unavailable.
A cancellation token for the search.
A DocumentationComment.
DocumentationProviders are compared when determining whether an AssemblySymbol can be reused.
Hence, if multiple instances can represent the same documentation, it is imperative that
Equals (and GetHashCode) be overridden to capture this fact. Otherwise, it is possible to end
up with multiple AssemblySymbols for the same assembly, which plays havoc with the type hierarchy.
DocumentationProviders are compared when determining whether an AssemblySymbol can be reused.
Hence, if multiple instances can represent the same documentation, it is imperative that
GetHashCode (and Equals) be overridden to capture this fact. Otherwise, it is possible to end
up with multiple AssemblySymbols for the same assembly, which plays havoc with the type hierarchy.
A trivial DocumentationProvider which never returns documentation.
Used by the DocumentationCommentCompiler(s) to check doc comments for XML parse errors.
As a performance optimization, this class tries to re-use the same underlying instance
when possible.
Current text to validate.
We use to validate XML doc comments. Unfortunately it cannot be reset and thus can't be pooled.
Each time we need to validate a fragment of XML we "append" it to the underlying text reader, implemented by this class,
and advance the reader. By the end of the fragment validation, we keep the reader open in a state
that is ready for the next fragment validation unless the fragment was invalid, in which case we need to create a new XmlReader.
That is why pretends that the stream has extra spaces
at the end. That should be sufficient for to not reach the end of this reader before the next
fragment is appended, unless the current fragment is malformed in one way or another.
Specifies the different documentation comment processing modes.
Order matters: least processing to most processing.
Treats documentation comments as regular comments.
Parses documentation comments as structured trivia, but do not report any diagnostics.
Parses documentation comments as structured trivia and report diagnostics.
Represents text to be embedded in a PDB.
The maximum number of bytes in to write out uncompressed.
This prevents wasting resources on compressing tiny files with little to negative gain
in PDB file size.
Chosen as the point at which we start to see > 10% blob size reduction using all
current source files in corefx and roslyn as sample data.
The path to the file to embed.
See remarks of
Empty file paths are disallowed, as the debugger finds source by looking up files by their name (and then verifying their signature)
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
The hash of the uncompressed bytes
that's saved to the PDB.
The content that will be written to the PDB.
Internal since this is an implementation detail. The only public
contract is that you can pass EmbeddedText instances to Emit.
It just so happened that doing this up-front was most practical
and efficient, but we don't want to be tied to it.
For efficiency, the format of this blob is exactly as it is written
to the PDB,which prevents extra copies being made during emit.
The first 4 bytes (little endian int32) indicate the format:
0: data that follows is uncompressed
Positive: data that follows is deflate compressed and value is original, uncompressed size
Negative: invalid at this time, but reserved to mark a different format in the future.
Constructs a for embedding the given .
The file path (pre-normalization) to use in the PDB.
The source text to embed.
is null.
is null.
empty.
cannot be embedded (see ).
Constructs an from stream content.
The file path (pre-normalization) to use in the PDB.
The stream.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
is null.
is null.
is empty.
doesn't support reading or seeking.
is not supported.
An I/O error occurs.
Reads from the beginning of the stream. Leaves the stream open.
Constructs an from bytes.
The file path (pre-normalization) to use in the PDB.
The bytes.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
is default-initialized.
is null.
is empty.
is not supported.
An I/O error occurs.
Reads from the beginning of the stream. Leaves the stream open.
is null.
is empty.
Creates the blob to be saved to the PDB.
Encoding to use when there is no byte order mark (BOM) on the stream. This encoder may throw a
if the stream contains invalid UTF-8 bytes.
Encoding to use when UTF-8 fails. We try to find the following, in order, if available:
1. The default ANSI codepage
2. CodePage 1252.
3. Latin1.
Initializes an instance of from the provided stream. This version differs
from in two ways:
1. It attempts to minimize allocations by trying to read the stream into a byte array.
2. If is null, it will first try UTF-8 and, if that fails, it will
try CodePage 1252. If CodePage 1252 is not available on the system, then it will try Latin1.
The stream containing encoded text.
Specifies an encoding to be used if the actual encoding can't be determined from the stream content (the stream doesn't start with Byte Order Mark).
If not specified auto-detect heuristics are used to determine the encoding. If these heuristics fail the decoding is assumed to be Encoding.Default.
Note that if the stream starts with Byte Order Mark the value of is ignored.
Indicates if the file can be embedded in the PDB.
Hash algorithm used to calculate document checksum.
The stream content can't be decoded using the specified , or
is null and the stream appears to be a binary file.
An IO error occurred while reading from the stream.
Try to create a from the given stream using the given encoding.
The input stream containing the encoded text. The stream will not be closed.
The expected encoding of the stream. The actual encoding used may be different if byte order marks are detected.
The checksum algorithm to use.
Throw if binary (non-text) data is detected.
Indicates if the text can be embedded in the PDB.
The decoded from the stream.
The decoder was unable to decode the stream with the given encoding.
Error reading from stream.
Some streams are easily represented as bytes.
The stream
The bytes, if available.
True if the stream's bytes could easily be read, false otherwise.
Read the contents of a FileStream into a byte array.
The FileStream with encoded text.
A byte array filled with the contents of the file.
True if a byte array could be created.
A composite of a sequence of s.
Validates the arguments passed to against the published contract.
True if should bother to proceed with copying.
Reduces the number of segments toward the target number of segments,
if the number of segments is deemed to be too large (beyond the maximum).
Determines the segment size to use for call to CombineSegments, that will result in the segment count
being reduced to less than or equal to the target segment count.
Determines the segment count that would result if the segments of size less than or equal to
the specified segment size were to be combined.
Combines contiguous segments with lengths that are each less than or equal to the specified segment size.
Compute total text length and total size of storage buffers held
Trim excessive inaccessible text.
Delegates to SourceTexts within the CompositeText to determine line information.
The starting line number for the correspondingly indexed SourceTexts in _compositeText.Segments.
Multiple consecutive entries could indicate the same line number if the corresponding
segments don't contain newline characters.
This will be of the same length as _compositeText.Segments
Determines the line number of a position in this CompositeText
A optimized for very large sources. The text is stored as
a list of chunks (char arrays).
internal for unit testing
Called from to initialize the . Thereafter,
the collection is cached.
A new representing the individual text lines.
Append chunk to writer (may reuse char array)
Immutable representation of a line number and position within a SourceText instance.
A that represents position 0 at line 0.
Initializes a new instance of a with the given line and character.
The line of the line position. The first line in a file is defined as line 0 (zero based line numbering).
The character position in the line.
or is less than zero.
The line number. The first line in a file is defined as line 0 (zero based line numbering).
The character position within the line.
Determines whether two are the same.
Determines whether two are different.
Determines whether two are the same.
The object to compare.
Determines whether two are the same.
The object to compare.
Provides a hash function for .
Provides a string representation for .
0,10
Immutable span represented by a pair of line number and index within the line.
Creates .
Start position.
End position.
precedes .
Gets the start position of the span.
Gets the end position of the span.
Provides a string representation for .
(0,0)-(5,6)
Specifies a hash algorithms used for hashing source files.
No algorithm specified.
Secure Hash Algorithm 1.
Secure Hash Algorithm 2 with a hash size of 256 bits.
Hash algorithms supported by the debugger used for source file checksums stored in the PDB.
Defines a source hash algorithm constant we can re-use when creating source texts for open documents.
This ensures that both LSP and documents opened as a text buffer are created with the same checksum algorithm
so that we can compare their contents using checksums later on.
An abstraction of source text.
Backing store of
Constructs a from text in a string.
Text.
Encoding of the file that the was read from or is going to be saved to.
null if the encoding is unspecified.
If the encoding is not specified the resulting isn't debuggable.
If an encoding-less is written to a file a shall be used as a default.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
is null.
is not supported.
Constructs a from text in a string.
TextReader
length of content from
Encoding of the file that the was read from or is going to be saved to.
null if the encoding is unspecified.
If the encoding is not specified the resulting isn't debuggable.
If an encoding-less is written to a file a shall be used as a default.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
is null.
is not supported.
Constructs a from stream content.
Stream. The stream must be seekable.
Data encoding to use if the stream doesn't start with Byte Order Mark specifying the encoding.
if not specified.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
If the decoded text contains at least two consecutive NUL
characters, then an is thrown.
True if the text can be passed to and be embedded in a PDB.
is null.
doesn't support reading or seeking.
is not supported.
If the given encoding is set to use a throwing decoder as a fallback
Two consecutive NUL characters were detected in the decoded text and was true.
An I/O error occurs.
Reads from the beginning of the stream. Leaves the stream open.
Constructs a from a byte array.
The encoded source buffer.
The number of bytes to read from the buffer.
Data encoding to use if the encoded buffer doesn't start with Byte Order Mark.
if not specified.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
If the decoded text contains at least two consecutive NUL
characters, then an is thrown.
The decoded text.
True if the text can be passed to and be embedded in a PDB.
The is null.
The is negative or longer than the .
is not supported.
If the given encoding is set to use a throwing decoder as a fallback
Two consecutive NUL characters were detected in the decoded text and was true.
Decode text from a stream.
The stream containing encoded text.
The encoding to use if an encoding cannot be determined from the byte order mark.
The actual encoding used.
The decoded text.
If the given encoding is set to use a throwing decoder as a fallback
Decode text from a byte array.
The byte array containing encoded text.
The count of valid bytes in .
The encoding to use if an encoding cannot be determined from the byte order mark.
The actual encoding used.
The decoded text.
If the given encoding is set to use a throwing decoder as a fallback
Check for occurrence of two consecutive NUL (U+0000) characters.
This is unlikely to appear in genuine text, so it's a good heuristic
to detect binary files.
internal for unit testing
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
Encoding of the file that the text was read from or is going to be saved to.
null if the encoding is unspecified.
If the encoding is not specified the source isn't debuggable.
If an encoding-less is written to a file a shall be used as a default.
The length of the text in characters.
The size of the storage representation of the text (in characters).
This can differ from length when storage buffers are reused to represent fragments/subtext.
Indicates whether this source text can be embedded in the PDB.
If this text was constructed via or
, then the canBeEmbedded arg must have
been true.
Otherwise, must be non-null.
If the text was created from a stream or byte[] and canBeEmbedded argument was true,
this provides the embedded text blob that was precomputed using the original stream
or byte[]. The precomputation was required in that case so that the bytes written to
the PDB match the original bytes exactly (and match the checksum of the original
bytes).
Returns a character at given position.
The position to get the character from.
The character.
When position is negative or
greater than .
Copy a range of characters from this SourceText to a destination array.
The container of this .
Gets a that contains the characters in the specified span of this text.
Returns a that has the contents of this text including and after the start position.
Write this to a text writer.
Write a span of text to a text writer.
Cryptographic checksum determined by . Computed using the original bytes
that were used to produce this (if any of the From methods were used that
take a byte[] or ). Otherwise, computed by writing this
back to a (using the provided ), and computing the hash off of
that.
Two different instances with the same content (see ) may
have different results for this method. This is because different originating bytes may end up with the
same final content. For example, a utf8 stream with a byte-order-mark will produce the same contents as a
utf8 stream without one. However, these preamble bytes will be part of the checksum, leading to different
results.
Similarly, two different instances with different contents can have the
same checksum in normal scenarios. This is because the use of the can lead
to different characters being mapped to the same sequence of encoded bytes.
As such, this function should only be used by clients who need to know the exact SHA hash from the original
content bytes, and for no other purposes.
Produces a hash of this based solely on the contents it contains. Two different
instances that are will have the same content hash. Two
instances of with different content are virtually certain to not have the same
hash. This hash can be used for fingerprinting of text instances, but does not provide cryptographic
guarantees.
This hash is safe to use across platforms and across processes, as long as the same version of Roslyn is
used in all those locations. As such, it is safe to use as a fast proxy for comparing text instances in
different memory spaces. Different versions of Roslyn may produce different content hashes.
Provides a string representation of the SourceText.
Gets a string containing the characters in specified span.
When given span is outside of the text range.
Constructs a new SourceText from this text with the specified changes.
Constructs a new SourceText from this text with the specified changes.
Changes do not have to be in sorted order. However, will
perform better if they are.
If any changes are not in bounds of this .
If any changes overlap other changes.
Returns a new SourceText with the specified span of characters replaced by the new text.
Returns a new SourceText with the specified range of characters replaced by the new text.
Gets the set of that describe how the text changed
between this text an older version. This may be multiple detailed changes
or a single change encompassing the entire text.
Gets the set of that describe how the text changed
between this text and an older version. This may be multiple detailed changes
or a single change encompassing the entire text.
The collection of individual text lines.
Called from to initialize the . Thereafter,
the collection is cached.
A new representing the individual text lines.
Compares the content with content of another .
Implements equality comparison of the content of two different instances of .
Detect an encoding by looking for byte order marks.
A buffer containing the encoded text.
The length of valid data in the buffer.
The length of any detected byte order marks.
The detected encoding or null if no recognized byte order mark was present.
Get maximum char count needed to decode the entire stream.
Stream is so big that max char count can't fit in .
An object that contains an instance of a SourceText and raises events when its current instance
changes.
The current text instance.
Raised when the current text instance changes.
A read-only, non-seekable over a .
Implementation of based on a input
Underlying string on which this SourceText instance is based
Underlying string which is the source of this SourceText instance
The length of the text represented by .
Returns a character at given position.
The position to get the character from.
The character.
When position is negative or
greater than .
Provides a string representation of the StringBuilderText located within given span.
When given span is outside of the text range.
Implementation of SourceText based on a input
Underlying string which is the source of this instance
The length of the text represented by .
Returns a character at given position.
The position to get the character from.
The character.
When position is negative or
greater than .
Provides a string representation of the StringText located within given span.
When given span is outside of the text range.
A that represents a subrange of another .
Delegates to the SubText's to determine line information.
Determines the line number of a position in this SubText
Describes a single change when a particular span is replaced with a new text.
The original span of the changed text.
The new text.
Initializes a new instance of
The original span of the changed text.
The new text.
Provides a string representation for .
Converts a to a .
An empty set of changes.
Represents state for a TextChanged event.
Initializes an instance of .
The text before the change.
The text after the change.
A set of ranges for the change.
Initializes an instance of .
The text before the change.
The text after the change.
A set of ranges for the change.
Gets the text before the change.
Gets the text after the change.
Gets the set of ranges for the change.
Represents the change to a span of text.
The span of text before the edit which is being changed
Width of the span after the edit. A 0 here would represent a delete
Initializes a new instance of .
Compares current instance of to another.
Compares current instance of to another.
Provides hash code for current instance of .
Determines if two instances of are same.
Determines if two instances of are different.
An empty set of changes.
Collapse a set of s into a single encompassing range. If
the set of ranges provided is empty, an empty range is returned.
Information about the character boundaries of a single line of text.
Creates a instance.
The source text.
The span of the line.
An instance of .
The span does not represent a text line.
Gets the source text.
Gets the zero-based line number.
Gets the start position of the line.
Gets the end position of the line not including the line break.
Gets the end position of the line including the line break.
Gets the line span not including the line break.
Gets the line span including the line break.
Abstract base class for collections.
The count of items in the collection
Gets the item at the specified index.
The index of the TextLine that encompasses the character position.
Gets a that encompasses the character position.
Gets a corresponding to a character position.
Convert a to a .
Convert a to a position.
Convert a to .
Immutable abstract representation of a span of text. For example, in an error diagnostic that reports a
location, it could come from a parsed string, text from a tool editor buffer, etc.
Creates a TextSpan instance beginning with the position Start and having the Length
specified with .
Start point of the span.
End of the span.
Length of the span.
Determines whether or not the span is empty.
Determines whether the position lies within the span.
The position to check.
true if the position is greater than or equal to Start and strictly less
than End, otherwise false.
Determines whether falls completely within this span.
The span to check.
true if the specified span falls completely within this span, otherwise false.
Determines whether overlaps this span. Two spans are considered to overlap
if they have positions in common and neither is empty. Empty spans do not overlap with any
other span.
The span to check.
true if the spans overlap, otherwise false.
Returns the overlap with the given span, or null if there is no overlap.
The span to check.
The overlap of the spans, or null if the overlap is empty.
Determines whether intersects this span. Two spans are considered to
intersect if they have positions in common or the end of one span
coincides with the start of the other span.
The span to check.
true if the spans intersect, otherwise false.
Determines whether intersects this span.
A position is considered to intersect if it is between the start and
end positions (inclusive) of this span.
The position to check.
true if the position intersects, otherwise false.
Returns the intersection with the given span, or null if there is no intersection.
The span to check.
The intersection of the spans, or null if the intersection is empty.
Creates a new from and positions as opposed to a position and length.
The returned TextSpan contains the range with inclusive,
and exclusive.
Determines if two instances of are the same.
Determines if two instances of are different.
Determines if current instance of is equal to another.
Determines if current instance of is equal to another.
Produces a hash code for .
Provides a string representation for .
This representation uses "half-open interval" notation, indicating the endpoint character is not included.
Example: [10..20), indicating the text starts at position 10 and ends at position 20 not included.
Compares current instance of with another.
Holder for common Text Utility functions and values
Return startLineBreak = index-1, lengthLineBreak = 2 if there is a \r\n at index-1
Return startLineBreak = index, lengthLineBreak = 1 if there is a 1-char newline at index
Return startLineBreak = index+1, lengthLineBreak = 0 if there is no newline at index.
Determine if the character in question is any line break character
Generate a ConstantValue of the same integer type as the argument
and offset by the given non-negative amount. Return ConstantValue.Bad
if the generated constant would be outside the valid range of the type.
A structure meant to represent a union of and values
Emit the IL for the compilation into the specified stream.
Compilation.
Path of the file to which the compilation 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.
Initializes a new instance of the class.
An ordered set of fully qualified
paths which are searched when resolving assembly names.
Directory used when resolving relative paths.
Represents that an intermediate result is being captured.
This node is produced only as part of a .
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
An id used to match references to the same intermediate result.
Value to be captured.
Represents a point of use of an intermediate result captured earlier.
The fact of capturing the result is represented by .
This node is produced only as part of a .
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
An id used to match references to the same intermediate result.
True if this reference to the capture initializes the capture. Used when the capture is being initialized by being passed as an parameter.
Represents result of checking whether the is null.
For reference types this checks if the is a null reference,
for nullable types this checks if the doesnโt have a value.
The node is produced as part of a flow graph during rewrite of
and nodes.
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Value to check.
Represents a exception instance passed by an execution environment to an exception filter or handler.
This node is produced only as part of a .
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents the check during initialization of a VB static local that is initialized on the first call of the function, and never again.
If the semaphore operation returns true, the static local has not yet been initialized, and the initializer will be run. If it returns
false, then the local has already been initialized, and the static local initializer region will be skipped.
This node is produced only as part of a .
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The static local variable that is possibly initialized.
Represents an anonymous function operation in context of a .
Current usage:
- C# lambda expression
- VB anonymous delegate expression
A for the body of the anonymous function is available from
the enclosing .
This node is associated with the following operation kinds:
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Symbol of the anonymous function.
Represents a basic block in a with a sequence of .
Once a basic block is entered, all operations in it are always executed.
Optional , if non-null, is evaluated after the .
Control flow leaves the basic block by taking either the branch or
the branch.
Basic block kind (entry, block, or exit).
Sequence of operations in the basic block.
Optional branch value, which if non-null, is evaluated after .
For conditional branches, this value is used to represent the condition which determines if
is taken or not.
For non-conditional branches, this value is used to represent the return or throw value associated
with the .
Indicates the condition kind for the branch out of the basic block.
Optional fall through branch executed at the end of the basic block.
This branch is null for exit block, and non-null for all other basic blocks.
Optional conditional branch out of the basic block.
If non-null, this branch may be taken at the end of the basic block based
on the and .
List of basic blocks which have a control flow branch ( or )
into this basic block.
Unique ordinal for each basic block in a ,
which can be used to index into array.
Indicates if control flow can reach this basic block from the entry block of the graph.
Enclosing region.
kind.
Indicates an entry block for a ,
which is always the first block in .
Indicates an exit block for a ,
which is always the last block in .
Indicates an intermediate block for a .
Capture Id is an opaque identifier to represent an intermediate result from an .
Compares s.
Represents a control flow branch from a basic block to a
basic block in a .
Source basic block of this branch.
Destination basic block of this branch.
Semantics associated with this branch (such as "regular", "return", "throw", etc).
Indicates if this branch represents of the basic block.
Regions exited if this branch is taken.
Ordered from the innermost region to the outermost region.
Regions entered if this branch is taken.
Ordered from the outermost region to the innermost region.
The finally regions the control goes through if this branch is taken.
Ordered in the sequence by which the finally regions are executed.
Semantics associated with a .
Represents a with no associated semantics.
Represents a regular from a source basic block to a non-null destination basic block.
Represents a to the exit block, i.e. the destination block has .
Represents a with special structured exception handling semantics:
1. The source basic block is the last block of an enclosing finally or filter region.
2. The destination basic block is null.
Represents a to indicate flow transfer to the end of program execution.
The destination basic block is null for this branch.
Represents a generated for an with an explicit thrown exception.
The destination basic block is null for this branch.
Represents a generated for an with in implicit rethrown exception.
The destination basic block is null for this branch.
Represents a generated for error cases.
Represents kind of conditional branch from a .
Indicates no conditional branch from a .
Associated is null.
Indicates a conditional branch from a ,
with a non-null and .
If evaluates to false
,
then the branch is taken.
Indicates a conditional branch from a ,
with a non-null and .
If evaluates to true
,
then the branch is taken.
Control flow graph representation for a given executable code block .
This graph contains a set of s, with an entry block, zero
or more intermediate basic blocks and an exit block.
Each basic block contains zero or more and
explicit (s) to other basic block(s).
Creates a for the given executable code block root .
Root syntax node for an executable code block.
Semantic model for the syntax tree containing the .
Optional cancellation token.
Returns null if returns null for the given and .
Otherwise, returns a for the executable code block.
Creates a for the given executable code block .
Root operation block, which must have a null parent.
Optional cancellation token.
Creates a for the given executable code block .
Root field initializer operation, which must have a null parent.
Optional cancellation token.
Creates a for the given executable code block .
Root property initializer operation, which must have a null parent.
Optional cancellation token.
Creates a for the given executable code block .
Root parameter initializer operation, which must have a null parent.
Optional cancellation token.
Creates a for the given executable code block .
Root attribute operation, which must have a null parent.
Optional cancellation token.
Creates a for the given executable code block .
Root constructor body operation, which must have a null parent.
Optional cancellation token.
Creates a for the given executable code block .
Root method body operation, which must have a null parent.
Optional cancellation token.
Original operation, representing an executable code block, from which this control flow graph was generated.
Note that in the control flow graph are not in the same operation tree as
the original operation.
Optional parent control flow graph for this graph.
Non-null for a control flow graph generated for a local function or a lambda.
Null otherwise.
Basic blocks for the control flow graph.
Root () region for the graph.
Local functions declared within .
Creates a control flow graph for the given .
Creates a control flow graph for the given .
Some basic concepts:
- Basic blocks are sequences of statements/operations with no branching. The only branching
allowed is at the end of the basic block.
- Regions group blocks together and represent the lifetime of locals and captures, loosely similar to scopes in C#.
There are different kinds of regions, .
- converts values on the stack into captures.
- Error scenarios from initial binding need to be handled.
Represents the stack s of a tree of conditional accesses. The top of the stack is the
deepest node, and except in error conditions it should contain a that will be visited
when visiting this node. This is the basic recursion that ensures that the operations are visited at the correct time.
The basic block to branch to if the top of the stack is null.
This structure is meant to capture a snapshot of the state
that is needed to build graphs for lambdas and local functions.
Holds the current object being initialized if we're visiting an object initializer.
Or the current anonymous type object being initialized if we're visiting an anonymous type object initializer.
Or the target of a VB With statement.
Do a pass to eliminate blocks without statements that can be merged with predecessor(s) and
to eliminate regions that can be merged with parents.
Merge content of into its enclosing region and free it.
Do a pass to eliminate blocks without statements that can be merged with predecessor(s).
Returns true if any blocks were eliminated
Deal with labeled blocks that were not added to the graph because labels were never found
Either visits a single operation, or a using and all subsequent statements
The statement to visit
All statements in the block containing this node
The current statement being visited in
True if this visited all of the statements
The operation being visited is not necessarily equal to statements[startIndex].
When traversing down a set of labels, we set operation to the label.Operation and recurse, but statements[startIndex] still refers to the original parent label
as we haven't actually moved down the original statement list
This class captures information about beginning of stack frame
and corresponding if one was allocated to
track s used by the stack spilling, etc.
Do not create instances of this type manually, use
helper instead. Also, do not assign explicitly.
Let the builder machinery do this when appropriate.
This function does not change the current region. The stack should be spilled before calling it.
Returns converted test expression.
Caller is responsible for spilling the stack and pushing a stack frame before calling this helper.
Recursively push nexted values onto the stack for visiting
Recursively pop nested tuple values off the stack after visiting
Holds the current object being initialized if we're visiting an object initializer.
Or the current anonymous type object being initialized if we're visiting an anonymous type object initializer.
Or the target of a VB With statement.
Holds the current object instance being initialized if we're visiting an object initializer.
Holds the current anonymous type instance being initialized if we're visiting an anonymous object initializer.
Holds the captured values for initialized anonymous type properties in an anonymous object initializer.
Gets or creates a control flow graph for the given defined in
the given or any of it's parent control flow graphs.
Gets or creates a control flow graph for the given defined in
the given or any of it's parent control flow graphs.
Encapsulates information about regions of s in a .
Regions can overlap, but never cross each other boundaries.
Region's kind
Enclosing region. Null for
Target exception type for , ,
Ordinal () of the first within the region.
Ordinal () of the last within the region.
Regions nested within this region.
Locals for which this region represent the life-time.
Local functions declared within the region.
Capture Ids used for intermediate results within the region.
Defines kinds of regions that can be present in a
A root region encapsulating all s in a
Region with the only purpose to represent the life-time of locals, intermediate results, and nested methods (local functions, lambdas).
The lifetime of a local variable is the portion of program execution during which storage is guaranteed to be reserved for it.
The lifetime of a nested method is the portion of program execution within which the method can be referenced.
The lifetime of an intermediate result (capture) is the portion of program execution within which the result can be referenced.
Region representing a try region. For example,
Region representing
Region representing
Region representing a union of a and the corresponding catch regions.
Doesn't contain any s directly.
Region representing a union of a and all corresponding catch
and regions. Doesn't contain any s directly.
Region representing
Region representing a union of a and corresponding finally
region. Doesn't contain any s directly.
An that has a set of and a
at the same time is mapped to a region with region inside its region.
Region representing the initialization for a VB Static
local variable. This region will only be executed
the first time a function is called.
Region representing erroneous block of code that is unreachable from the entry block.
All of the kinds of operations, including statements and expressions.
Indicates an for a construct that is not implemented yet.
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . This is further differentiated by .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . This has yield break semantics.
Indicates an .
Indicates an .
Indicates an .
Indicates an . This has yield return semantics.
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . Use instead.
Indicates an .
Indicates an . Use instead.
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . This is used as an increment operator
Indicates an .
Indicates an . This is used as a decrement operator
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . This is further differentiated by .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . Use instead.
Indicates an .
Indicates an . Use instead.
Indicates an .
Indicates an . Use instead.
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an . This append is of a literal component
Indicates an . This append is of an interpolation component
Indicates an . This append is invalid
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Indicates an .
Specifies the Ids of types that are expected to be defined in core library.
Unlike ids in enum, these ids are not meant for public consumption
and are meant for internal usage in compilers.
Indicates that the type is from the COR library.
Check for this special type cannot be used to find the "canonical" definition of
since it is fully legal for it to come from sources other than the COR library, e.g. from `System.Memory` package.
The should be used for that purpose instead
This entry mostly exists so that compiler can tell this type apart when resolving other members of the COR library
Indicates that the type is from the COR library.
Check for this special type cannot be used to find the "canonical" definition of
since it is fully legal for it to come from sources other than the COR library.
The should be used for that purpose instead
This entry mostly exists so that compiler can tell this type apart when resolving other members of the COR library
Indicates that the type is from the COR library.
Check for this special type cannot be used to find the "canonical" definition of
since it is fully legal for it to come from sources other than the COR library.
The should be used for that purpose instead
This entry mostly exists so that compiler can tell this type apart when resolving other members of the COR library
Indicates that the type is from the COR library.
Check for this special type cannot be used to find the "canonical" definition of
since it is fully legal for it to come from sources other than the COR library.
The should be used for that purpose instead
This entry mostly exists so that compiler can tell this type apart when resolving other members of the COR library
This item should be kept last and it doesn't represent any specific type.
Cache with a fixed size that evicts the least recently used members.
Thread-safe.
Create cache from an array. The cache capacity will be the size
of the array. All elements of the array will be added to the
cache. If any duplicate keys are found in the array a
will be thrown.
For testing. Very expensive.
Expects non-empty cache. Does not lock.
Doesn't lock.
Doesn't lock.
A pre-created delegate to assign to if needed.
Dumps the stack trace of the exception and the handler to the console. This is useful
for debugging unit tests that hit a fatal exception
Checks for the given ; if the is true,
immediately terminates the process without running any pending finally blocks or finalizers
and causes a crash dump to be collected (if the system is configured to do so).
Otherwise, the process continues normally.
The conditional expression to evaluate.
An optional message to be recorded in the dump in case of failure. Can be null.
Thrown when async code must cancel the current execution but does not have access to the of the passed to the code.
Should be used in very rare cases where the is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
Set by the host to handle an error report; this may crash the process or report telemetry.
A handler that will not crash the process when called. Used when calling
Same as setting the Handler property except that it avoids the assert. This is useful in
test code which needs to verify the handler is called in specific cases and will continually
overwrite this value.
Copies the handler in this instance to the linked copy of this type in this other assembly.
This file is in linked into multiple layers, but we want to ensure that all layers have the same copy.
This lets us copy the handler in this instance into the same in another instance.
Use in an exception filter to report an error without catching the exception.
The error is reported by calling .
to avoid catching the exception.
Use in an exception filter to report an error (by calling ), unless the
operation has been cancelled. The exception is never caught.
to avoid catching the exception.
Use in an exception filter to report an error (by calling ), unless the
operation has been cancelled at the request of . The exception is
never caught.
Cancellable operations are only expected to throw if the
applicable indicates cancellation is requested by setting
. Unexpected cancellation, i.e. an
which occurs without
requesting cancellation, is treated as an error by this method.
This method does not require to match
, provided cancellation is expected per the previous
paragraph.
A which will have
set if cancellation is expected.
to avoid catching the exception.
Report an error.
Calls and doesn't pass the exception through (the method returns true).
This is generally expected to be used within an exception filter as that allows us to
capture data at the point the exception is thrown rather than when it is handled.
However, it can also be used outside of an exception filter. If the exception has not
already been thrown the method will throw and catch it itself to ensure we get a useful
stack trace.
True to catch the exception.
Used to report a non-fatal-watson (when possible) to report an exception. The exception is not caught. Does
nothing if no non-fatal error handler is registered. See the second argument to .
The severity of the error, see the enum members for a description of when to use each. This is metadata that's included
in a non-fatal fault report, which we can take advantage of on the backend to automatically triage bugs. For example,
a critical severity issue we can open with a lower bug count compared to a low priority one.
The severity hasn't been categorized. Don't use this in new code.
Something failed, but the user is unlikely to notice. Especially useful for background things that we can silently recover
from, like bugs in caching systems.
Something failed, and the user might notice, but they're still likely able to carry on. For example, if the user
asked for some information from the IDE (find references, completion, etc.) and we were able to give partial results.
Something failed, and the user likely noticed. For example, the user pressed a button to do an action, and
we threw an exception so we completely failed to do that in an unrecoverable way. This may also be used
for back-end systems where a failure is going to result in a highly broken experience, for example if parsing a file
catastrophically failed.
A Span-compatible version of .
Very cheap trivial comparer that never matches the keys,
should only be used in empty dictionaries.
Defines diagnostic info for Roslyn experimental APIs.
Ensures that the remaining stack space is large enough to execute
the average function.
how many times the calling function has recursed
The available stack space is insufficient to execute
the average function.
Represents an optional bool as a single byte.
Used to devirtualize ConcurrentDictionary for EqualityComparer{T}.Default and ReferenceEquals
This type is to enable fast-path devirtualization in the Jit. Dictionary{K, V}, HashTable{T}
and ConcurrentDictionary{K, V} will devirtualize (and potentially inline) the IEquatable{T}.Equals
method for a struct when the Comparer is unspecified in .NET Core, .NET 5; whereas specifying
a Comparer will make .Equals and GetHashcode slower interface calls.
The result of
This indicates that friend access should be granted.
This indicates that friend access should be granted for the purposes of error recovery,
but the program is wrong.
That's because this indicates that a strong-named assembly has referred to a weak-named assembly
which has extended friend access to the strong-named assembly. This will ultimately
result in an error because strong-named assemblies may not refer to weak-named assemblies.
In Roslyn we give a new error, CS7029, before emit time. In the dev10 compiler we error at
emit time.
This indicates that friend access should not be granted because the other assembly grants
friend access to a strong-named assembly, and either this assembly is weak-named, or
it is strong-named and the names don't match.
This indicates that friend access should not be granted because the other assembly
does not name this assembly as a friend in any way whatsoever.
Structure that describes a member of a type.
Id/token of containing type, usually value from some enum.
For example from SpecialType enum.
I am not using SpecialType as the type for this field because
VB runtime types are not part of SpecialType.
So, the implication is that any type ids we use outside of the SpecialType
(either for the VB runtime classes, or types like System.Task etc.) will need
to use IDs that are all mutually disjoint.
Signature of the field or method, similar to metadata signature,
but with the following exceptions:
1) Truncated on the left, for methods starts at [ParamCount], for fields at [Type]
2) Type tokens are not compressed
3) BOOLEAN | CHAR | I1 | U1 | I2 | U2 | I4 | U4 | I8 | U8 | R4 | R8 | I | U | Void types are encoded by
using VALUETYPE+typeId notation.
4) array bounds are not included.
5) modifiers are not included.
6) (CLASS | VALUETYPE) are omitted after GENERICINST
Applicable only to properties and methods, throws otherwise.
The type Id may be:
(1) encoded in a single byte (for types below 255)
(2) encoded in two bytes (255 + extension byte) for types below 512
Read a type Id from the stream and copy it into the builder.
This may copy one or two bytes depending on the first one.
Helper class to match signatures in format of
MemberDescriptor.Signature to members.
Returns true if signature matches signature of the field.
Signature should be in format described in MemberDescriptor.
Returns true if signature matches signature of the property.
Signature should be in format described in MemberDescriptor.
Returns true if signature matches signature of the method.
Signature should be in format described in MemberDescriptor.
Does pretty much the same thing as MetadataDecoder.DecodeType only instead of
producing a type symbol it compares encoded type to the target.
Signature should be in format described in MemberDescriptor.
Read a type Id from the signature.
This may consume one or two bytes, and therefore increment the position correspondingly.
Should return null in case of error.
Should return null in case of error.
Should only accept Pointer types.
Should return null in case of error.
Should return null in case of error.
Should only accept multi-dimensional arrays.
Should only accept multi-dimensional arrays.
Should return null in case of error.
If the encoded type is invalid.
An exception from metadata reader.
If the encoded type is invalid.
An exception from metadata reader.
If the encoded type is invalid.
An exception from metadata reader.
An exception from metadata reader.
If the encoded type is invalid.
An exception from metadata reader.
If the encoded local variable type is invalid.
An exception from metadata reader.
If the encoded local variable type is invalid.
An exception from metadata reader.
Used to decode signatures of local constants returned by SymReader.
Returns the local info for all locals indexed by slot.
If the encoded parameter type is invalid.
An exception from metadata reader.
Decodes attribute argument type from attribute blob (called FieldOrPropType in the spec).
If the encoded argument type is invalid.
An exception from metadata reader.
If the encoded attribute argument is invalid.
An exception from metadata reader.
If the encoded attribute argument is invalid.
An exception from metadata reader.
If the encoded attribute argument is invalid.
An exception from metadata reader.
If the given is invalid.
An exception from metadata reader.
If the encoded named argument is invalid.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
Find the methods that a given method explicitly overrides.
Methods may be on class or interfaces.
Containing classes/interfaces will be supertypes of the implementing type.
TypeDef handle of the implementing type.
MethodDef handle of the implementing method.
The type symbol for the implementing type.
Array of implemented methods.
Search for the corresponding to the given MethodDef token. Search amongst
the supertypes (classes and interfaces) of a designated type.
Generally, the type will be a type that explicitly implements an interface and the method will be the
implemented method (i.e. on the interface).
TypeDef token of the type from which the search should begin.
MethodDef token of the target method.
Corresponding or null, if none is found.
Enqueue the interfaces implemented and the type extended by a given TypeDef.
Queue of TypeDefs to search.
Queue of TypeSymbols (representing typeRefs to search).
Handle of the TypeDef for which we want to enqueue supertypes.
An exception from metadata reader.
Helper method for enqueuing a type token in the right queue.
Def -> typeDefsToSearch
Ref -> typeSymbolsToSearch
null -> neither
Enqueue the interfaces implemented and the type extended by a given TypeDef.
Queue of TypeDefs to search.
Queue of TypeSymbols (representing typeRefs to search).
Symbol for which we want to enqueue supertypes.
Enqueue the given type as either a def or a ref.
Queue of TypeDefs to search.
Queue of TypeSymbols (representing typeRefs to search).
Symbol to enqueue.
Search the members of a TypeSymbol to find the one that matches a given MethodDef token.
Type to search for method.
MethodDef handle of the method to find.
The corresponding MethodSymbol or null.
Search the members of a TypeSymbol to find the one that matches a given FieldDef token.
Type to search for field.
FieldDef handle of the field to find.
The corresponding FieldSymbol or null.
Given a MemberRef token for a method, we can find a corresponding MethodSymbol by
searching for the name and signature.
A MemberRef token for a method.
Scope the search to supertypes of the implementing type.
True to only return method symbols, null if the token resolves to a field.
The corresponding MethodSymbol or null.
Given a method symbol, return the MethodDef token, if it is defined in
this module, or a nil token, otherwise.
The method symbol for which to return a MethodDef token.
A MethodDef token or nil.
Returns a symbol that given token resolves to or null of the token represents an entity that isn't represented by a symbol,
such as vararg MemberRef.
Given a MemberRef token, return the TypeSymbol for its Class field.
Checks whether signatures match where the signatures are either from a property
and an accessor or two accessors. When comparing a property or getter to setter, the
setter signature must be the second argument and 'comparingToSetter' must be true.
Signature of the property containing the accessor, or the getter (type, then parameters).
Signature of the accessor when comparing property and accessor,
or the setter when comparing getter and setter (return type and then parameters).
True when comparing a property or getter to a setter, false otherwise.
True if differences in IsByRef for parameters should be treated as significant.
True if differences in return type (or value parameter for setter) should be treated as significant.
True if the accessor signature is appropriate for the containing property.
Check whether an event accessor has an appropriate signature.
Type of the event containing the accessor.
Signature of the accessor (return type and then parameters).
True if the accessor signature is appropriate for the containing event.
Rank equal 0 is used to denote an SzArray, rank equal 1 denotes multi-dimensional array of rank 1.
Decodes a serialized type name in its canonical form. The canonical name is its full type name, followed
optionally by the assembly where it is defined, its version, culture and public key token. If the assembly
name is omitted, the type name is in the current assembly otherwise it is in the referenced assembly. The
full type name is the fully qualified metadata type name.
Decodes a type name. A type name is a string which is terminated by the end of the string or one of the
delimiters '+', ',', '[', ']'. '+' separates nested classes. '[' and ']'
enclosed generic type arguments. ',' separates types.
Decodes a generic name. This is a type name followed optionally by a type parameter count
Rank equal 0 is used to denote an SzArray, rank equal 1 denotes multi-dimensional array of rank 1.
An ImmutableArray representing the single string "System"
Calculates information about types and namespaces immediately contained within a namespace.
Is current namespace a global namespace?
Length of the fully-qualified name of 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 in case-sensitive manner.
Key of each IGrouping is a fully-qualified namespace name, which starts with the name of
this namespace. There could be multiple groups for each fully-qualified namespace name.
The groups must be sorted by the keys in a manner consistent with comparer passed in as
nameComparer. Therefore, all types immediately contained within THIS namespace, if any,
must be in several IGrouping at the very beginning of the sequence.
Equality comparer to compare namespace names.
Output parameter, never null:
A sequence of groups of TypeDef row ids for types immediately contained within this namespace.
Output parameter, never null:
A sequence with information about namespaces immediately contained within this namespace.
For each pair:
Key - contains simple name of a child namespace.
Value - contains a sequence similar to the one passed to this function, but
calculated for the child namespace.
Extract a simple name of a top level child namespace from potentially qualified namespace name.
Parent namespace name length plus the dot.
Fully qualified namespace name.
Simple name of a top level child namespace, the left-most name following parent namespace name
in the fully qualified name.
Determines whether given string can be used as a non-empty metadata identifier (a NUL-terminated UTF-8 string).
True if the string doesn't contain incomplete surrogates.
Checks that the specified name is a valid metadata String and a file name.
The specification isn't entirely consistent and complete but it mentions:
22.19.2: "Name shall index a non-empty string in the String heap. It shall be in the format {filename}.{extension} (e.g., 'goo.dll', but not 'c:\utils\goo.dll')."
22.30.2: "The format of Name is {file name}.{file extension} with no path or drive letter; on POSIX-compliant systems Name contains no colon, no forward-slash, no backslash."
As Microsoft specific constraint.
A reasonable restriction seems to be a valid UTF-8 non-empty string that doesn't contain '\0', '\', '/', ':' characters.
Determine if the given namespace and type names combine to produce the given fully qualified name.
The namespace part of the split name.
The type name part of the split name.
The fully qualified name to compare with.
true if the combination of and equals the fully-qualified name given by
Given an input string changes it to be acceptable as a part of a type name.
Specifies what symbols to import from metadata.
Only import public and protected symbols.
Import public, protected and internal symbols.
Import all symbols.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
Helper structure to encapsulate/cache various information about metadata name of a type and
name resolution options.
Also, allows us to stop using strings in the APIs that accept only metadata names,
making usage of them less bug prone.
Full metadata name of a type, includes namespace name for top level types.
Namespace name for top level types.
version of . Preferred when possible to avoid
the copy of the portion of used for .
Name of the type without namespace prefix, but possibly with generic arity mangling present.
version of . Preferred when possible to avoid
the copy of the portion of used for .
Name of the type without namespace prefix and without generic arity mangling.
Arity of the type inferred based on the name mangling. It doesn't have to match the actual
arity of the type.
While resolving the name, consider only types with this arity.
(-1) means allow any arity.
If forcedArity >= 0 and useCLSCompliantNameArityEncoding, lookup may
fail because forcedArity doesn't match the one encoded in the name.
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.
TODO: PERF: Encode this field elsewhere to save 4 bytes
Individual parts of qualified namespace name.
version of . Preferred when possible to
avoid the copies of the portions of used for .
Full metadata name of a type, includes namespace name for top level types.
Namespace name for top level types, empty string for nested types.
Name of the type without namespace prefix, but possibly with generic arity mangling present.
Name of the type without namespace prefix and without generic arity mangling.
Arity of the type inferred based on the name mangling. It doesn't have to match the actual
arity of the type.
Does name include arity mangling suffix.
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.
While resolving the name, consider only types with this arity.
(-1) means allow any arity.
If ForcedArity >= 0 and UseCLSCompliantNameArityEncoding, lookup may
fail because ForcedArity doesn't match the one encoded in the name.
Individual parts of qualified namespace name.
A digest of MetadataTypeName's fully qualified name which can be used as the key in a dictionary
Returns true if the field should be imported. Visibility
and the value of are considered
Returns true if the flags represent a field that should be imported.
Visibility and the value of are considered
Returns true if the method should be imported. Returns false for private methods that are not
explicit interface implementations. For other methods, visibility and the value of
are considered.
Returns 0 if method name doesn't represent a v-table gap.
Otherwise, returns the gap size.
All assemblies this assembly references.
A concatenation of assemblies referenced by each module in the order they are listed in .
The number of assemblies referenced by each module in .
Assembly identity read from Assembly table, or null if the table is empty.
Using for atomicity.
We need to store reference to the assembly metadata to keep the metadata alive while
symbols have reference to PEAssembly.
A set of helpers for extracting elements from metadata.
This type is not responsible for managing the underlying storage
backing the PE image.
We need to store reference to the module metadata to keep the metadata alive while
symbols have reference to PEModule.
This is a tuple for optimization purposes. In valid cases, we need to store
only one assembly index per type. However, if we found more than one, we
keep a second one as well to use it for error reporting.
We use -1 in case there was no forward.
Case-insensitive version of , only populated if case-insensitive search is
requested. We only keep the first instance of a type name, regardless of case, as this is only used for error recovery purposes
in VB.
Using as a type for atomicity.
If bitmap is not null, each bit indicates whether a TypeDef
with corresponding RowId has been checked if it is a NoPia
local type. If the bit is 1, local type will have an entry
in m_lazyTypeDefToTypeIdentifierMap.
For each TypeDef that has 1 in m_lazyNoPiaLocalTypeCheckBitMap,
this map stores corresponding TypeIdentifier AttributeInfo.
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).
An exception from metadata reader.
Returns the names of linked managed modules.
An exception from metadata reader.
Returns names of referenced modules.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
The function groups types defined in the module by their fully-qualified namespace name.
The case-sensitivity of the grouping depends upon the provided StringComparer.
The sequence is sorted by name by using provided comparer. Therefore, if there are multiple
groups for a namespace name (e.g. because they differ in case), the groups are going to be
adjacent to each other.
Empty string is used as namespace name for types in the Global namespace. Therefore, all types
in the Global namespace, if any, should be in the first group (assuming a reasonable StringComparer).
Comparer to sort the groups.
A sorted list of TypeDef row ids, grouped by fully-qualified namespace name.
An exception from metadata reader.
Groups together the RowIds of types in a given namespaces. The types considered are
those defined in this module.
An exception from metadata reader.
Supplements the namespace-to-RowIDs map with the namespaces of forwarded types.
These types will not have associated row IDs (represented as null, for efficiency).
These namespaces are important because we want lookups of missing forwarded types
to succeed far enough that we can actually find the type forwarder and provide
information about the target assembly.
For example, consider the following forwarded type:
.class extern forwarder Namespace.Type {}
If this type is referenced in source as "Namespace.Type", then dev10 reports
error CS1070: The type name 'Namespace.Name' could not be found. This type has been
forwarded to assembly 'pe2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Consider adding a reference to that assembly.
If we did not include "Namespace" as a child of the global namespace of this module
(the forwarding module), then Roslyn would report that the type "Namespace" was not
found and say nothing about "Name" (because of the diagnostic already attached to
the qualifier).
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
Returns a collection of interfaces implemented by given type.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
Should be kept in sync with
Indicates whether the first attribute should be prioritized over the second one.
Same order of priority as
Find the MemberNotNull attribute(s) and extract the list of referenced member names
Find the MemberNotNullWhen attribute(s) and extract the list of referenced member names
Gets the well-known optional named properties on ObsoleteAttribute, if present.
Both 'diagnosticId' and 'urlFormat' may be present, or only one, or neither.
Failure to find any of these properties does not imply failure to decode the ObsoleteAttribute,
so we don't return a value indicating success or failure.
An exception from metadata reader.
Determine if custom attribute application is
NoPia TypeIdentifier.
An index of the target constructor signature in
signaturesOfTypeIdentifierAttribute array, -1 if
this is not NoPia TypeIdentifier.
Determines if a custom attribute matches a namespace and name.
Handle of the custom attribute.
The custom attribute's namespace in metadata format (case sensitive)
The custom attribute's type name in metadata format (case sensitive)
Constructor of the custom attribute.
Should case be ignored for name comparison?
true if match is found
Determines if a custom attribute matches a namespace and name.
The metadata reader.
Handle of the custom attribute.
The custom attribute's namespace in metadata format (case sensitive)
The custom attribute's type name in metadata format (case sensitive)
Constructor of the custom attribute.
Should case be ignored for name comparison?
true if match is found
Returns MetadataToken for assembly ref matching name
The assembly name in metadata format (case sensitive)
Matching assembly ref token or nil (0)
Returns MetadataToken for type ref matching resolution scope and name
The resolution scope token
The namespace name in metadata format (case sensitive)
The type name in metadata format (case sensitive)
Matching type ref token or nil (0)
An exception from metadata reader.
Determine if custom attribute matches the target attribute.
Handle of the custom attribute.
The attribute to match.
An index of the target constructor signature in
signatures array, -1 if
this is not the target attribute.
Determine if custom attribute matches the target attribute.
The metadata reader.
Handle of the custom attribute.
The attribute to match.
The custom attribute matched the target attribute namespace and type.
An index of the target constructor signature in
signatures array, -1 if
this is not the target attribute.
Given a token for a constructor, return the token for the constructor's type and the blob containing the
constructor's signature.
True if the function successfully returns the type and signature.
Given a token for a constructor, return the token for the constructor's type and the blob containing the
constructor's signature.
True if the function successfully returns the type and signature.
Given a token for a type, return the type's name and namespace. Only works for top level types.
namespaceHandle will be NamespaceDefinitionHandle for defs and StringHandle for refs.
True if the function successfully returns the name and namespace.
Given a token for a type, return the type's name and namespace. Only works for top level types.
namespaceHandle will be NamespaceDefinitionHandle for defs and StringHandle for refs.
True if the function successfully returns the name and namespace.
For testing purposes only!!!
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
An exception from metadata reader.
Returns true if method IL can be retrieved from the module.
Returns true if the full image of the module is available.
Invalid metadata.
Produce unbound generic type symbol if the type is a generic type.
Produce constructed type symbol.
Symbol for generic type.
Generic type arguments, including those for containing types.
Flags for arguments. Each item indicates whether corresponding argument refers to NoPia local types.
Extracts information from TypeDef flags.
Returns 0 if the value is invalid.
Lookup a type defined in this module.
Lookup a type defined in referenced assembly.
Given the identity of an assembly referenced by this module, finds
the index of that assembly in the list of assemblies referenced by
the current module.
Represents an identity of an assembly as defined by CLI metadata specification.
May represent assembly definition or assembly reference identity.
Represents an identity of an assembly as defined by CLI metadata specification.
May represent assembly definition or assembly reference identity.
Constructs an from its constituent parts.
The simple name of the assembly.
The version of the assembly.
The name of the culture to associate with the assembly.
Specify null, , or "neutral" (any casing) to represent .
The name can be an arbitrary string that doesn't contain NUL character, the legality of the culture name is not validated.
The public key or public key token of the assembly.
Indicates whether represents a public key.
Indicates whether the assembly is retargetable.
Specifies the binding model for how this object will be treated in comparisons.
If is null, empty or contains a NUL character.
If contains a NUL character.
is not a value of the enumeration.
contains values that are not greater than or equal to zero and less than or equal to ushort.MaxValue.
is true and is not set.
is false and
contains a value that is not the size of a public key token, 8 bytes.
The simple name of the assembly.
The version of the assembly.
The culture name of the assembly, or empty if the culture is neutral.
The AssemblyNameFlags.
Specifies assembly binding model for the assembly definition or reference;
that is how assembly references are matched to assembly definitions.
True if the assembly identity includes full public key.
Full public key or empty.
Low 8 bytes of SHA1 hash of the public key, or empty.
True if the assembly identity has a strong name, ie. either a full public key or a token.
Gets the value which specifies if the assembly is retargetable.
Determines whether two instances are equal.
The operand appearing on the left side of the operator.
The operand appearing on the right side of the operator.
Determines whether two instances are not equal.
The operand appearing on the left side of the operator.
The operand appearing on the right side of the operator.
Determines whether the specified instance is equal to the current instance.
The object to be compared with the current instance.
Determines whether the specified instance is equal to the current instance.
The object to be compared with the current instance.
Returns the hash code for the current instance.
Returns true (false) if specified assembly identities are (not) equal
regardless of unification, retargeting or other assembly binding policies.
Returns null if these policies must be consulted to determine name equivalence.
Retrieves assembly definition identity from given runtime assembly.
The runtime assembly.
Assembly definition identity.
is null.
Returns the display name of the assembly identity.
True if the full public key should be included in the name. Otherwise public key token is used.
The display name.
Characters ',', '=', '"', '\'', '\' occurring in the simple name are escaped by backslash in the display name.
Any character '\t' is replaced by two characters '\' and 't',
Any character '\n' is replaced by two characters '\' and 'n',
Any character '\r' is replaced by two characters '\' and 'r',
The assembly name in the display name is enclosed in double quotes if it starts or ends with
a whitespace character (' ', '\t', '\r', '\n').
Returns the display name of the current instance.
Perf: ETW traces show 2%+ of all allocations parsing assembly identity names. This is due to how large
these strings can be (600+ characters in some cases), and how many substrings are continually produced as
the string is broken up into the pieces needed by AssemblyIdentity. The capacity of 1024 was picked as
around 700 unique strings were found in a solution the size of Roslyn.sln. So this seems like a reasonable
starting point for a large solution. This cache takes up around 240k in memory, but ends up saving >80MB of
garbage over typing even a few characters. And, of course, that savings just grows over the lifetime of a
session this is hosted within.
Parses display name filling defaults for any basic properties that are missing.
Display name.
A full assembly identity.
Parts of the assembly identity that were specified in the display name,
or 0 if the parsing failed.
True if display name parsed correctly.
The simple name has to be non-empty.
A partially specified version might be missing build and/or revision number. The default value for these is 65535.
The default culture is neutral ( is .
If neither public key nor token is specified the identity is considered weak.
is null.
Compares assembly identities.
Derived types may implement platform specific unification and portability policies.
A set of possible outcomes of comparison.
Reference doesn't match definition.
Strongly named reference matches strongly named definition (strong identity is identity with public key or token),
Or weak reference matches weak definition.
Reference matches definition except for version (reference version is lower or higher than definition version).
Compares assembly reference name (possibly partial) with definition identity.
Partial or full assembly display name.
Full assembly display name.
True if the reference name matches the definition identity.
Compares assembly reference identity with definition identity.
Reference assembly identity.
Full assembly display name.
True if the reference identity matches the definition identity.
Compares reference assembly identity with definition identity and returns their relationship.
Reference identity.
Definition identity.
Implements a map from an assembly identity to a value. The map allows to look up the value by an identity
that either exactly matches the original identity key, or corresponds to a key with the lowest version among identities
with higher version than the requested identity key.
Represents an immutable snapshot of assembly CLI metadata.
Factory that provides the for additional modules (other than ) of the assembly.
Shall only throw or .
Null of all modules were specified at construction time.
Modules the was created with, in case they are eagerly allocated.
Cached assembly symbols.
Guarded by .
Creates a single-module assembly.
Manifest module image.
is null.
Creates a single-module assembly.
Manifest module image.
is null.
The PE image format is invalid.
Creates a single-module assembly.
Manifest module PE image stream.
False to close the stream upon disposal of the metadata.
The PE image format is invalid.
Creates a single-module assembly.
Manifest module PE image stream.
False to close the stream upon disposal of the metadata.
The PE image format is invalid.
Finds all modules of an assembly on a specified path and builds an instance of that represents them.
The full path to the assembly on disk.
is null.
is invalid.
Error reading file . See for details.
Reading from a file path is not supported by the platform.
Creates a single-module assembly.
Manifest module.
This object disposes it when it is itself disposed.
Creates a multi-module assembly.
Modules comprising the assembly. The first module is the manifest module of the assembly.
This object disposes the elements of it when it is itself .
is default value.
contains null elements.
is empty or contains a module that doesn't own its image (was created via ).
Creates a multi-module assembly.
Modules comprising the assembly. The first module is the manifest module of the assembly.
This object disposes the elements of it when it is itself .
is default value.
contains null elements.
is empty or contains a module that doesn't own its image (was created via ).
Creates a multi-module assembly.
Modules comprising the assembly. The first module is the manifest module of the assembly.
This object disposes the elements of it when it is itself .
is default value.
contains null elements.
is empty or contains a module that doesn't own its image (was created via ).
Creates a shallow copy of contained modules and wraps them into a new instance of .
The resulting copy shares the metadata images and metadata information read from them with the original.
It doesn't own the underlying metadata images and is not responsible for its disposal.
This is used, for example, when a metadata cache needs to return the cached metadata to its users
while keeping the ownership of the cached metadata object.
Modules comprising this assembly. The first module is the manifest module.
The PE image format is invalid.
IO error reading the metadata. See for details.
The object has been disposed.
The PE image format is invalid.
IO error while reading the metadata. See for details.
The object has been disposed.
The PE image format is invalid.
IO error while reading the metadata. See for details.
The object has been disposed.
Disposes all modules contained in the assembly.
Checks if the first module has a single row in Assembly table and that all other modules have none.
The PE image format is invalid.
IO error reading the metadata. See for details.
The object has been disposed.
Returns the metadata kind.
Creates a reference to the assembly metadata.
Provider of XML documentation comments for the metadata symbols contained in the module.
Aliases that can be used to refer to the assembly from source code (see "extern alias" directive in C#).
True to embed interop types from the referenced assembly to the referencing compilation. Must be false for a module.
Path describing the location of the metadata, or null if the metadata have no location.
Display string used in error messages to identity the reference.
A reference to the assembly metadata.
Reference to another C# or VB compilation.
Returns an instance of the reference with specified aliases.
The new aliases for the reference.
Alias is invalid for the metadata kind.
Returns an instance of the reference with specified aliases.
The new aliases for the reference.
Alias is invalid for the metadata kind.
Returns an instance of the reference with specified interop types embedding.
The new value for .
Interop types can't be embedded from modules.
Returns an instance of the reference with specified properties, or this instance if properties haven't changed.
The new properties for the reference.
Specified values not valid for this reference.
An Id that can be used to identify a metadata instance. If two metadata instances
have the same id then they are guaranteed to have the same content. If two metadata
instances have different ids, then the contents may or may not be the same. As such,
the id is useful as a key in a cache when a client wants to share data for a metadata
reference as long as it has not changed.
Represents immutable assembly or module CLI metadata.
The id for this metadata instance. If two metadata instances have the same id, then
they have the same content. If they have different ids they may or may not have the
same content.
Retrieves the for this instance.
Releases any resources associated with this instance.
Creates a copy of this object.
The kind of metadata a PE file image contains.
The PE file is an assembly.
The PE file is a module.
Represents an in-memory Portable-Executable image.
Represents metadata image reference.
Represents a logical location of the image, not the content of the image.
The content might change in time. A snapshot is taken when the compiler queries the reference for its metadata.
Path or name used in error messages to identity the reference.
Returns true if this reference is an unresolved reference.
Returns an instance of the reference with specified aliases.
The new aliases for the reference.
Alias is invalid for the metadata kind.
Returns an instance of the reference with specified interop types embedding.
The new value for .
Interop types can't be embedded from modules.
Returns an instance of the reference with specified aliases.
The new aliases for the reference.
Alias is invalid for the metadata kind.
Returns an instance of the reference with specified properties, or this instance if properties haven't changed.
The new properties for the reference.
Specified values not valid for this reference.
Creates a reference to a single-module assembly or a standalone module stored in memory.
Assembly image.
Reference properties (extern aliases, type embedding, ).
Provides XML documentation for symbol found in the reference.
Optional path that describes the location of the metadata. The file doesn't need to exist on disk. The path is opaque to the compiler.
Performance considerations:
It is recommended to use or
API when creating multiple references to the same metadata.
Reusing object to create multiple references allows for sharing data across these references.
The method pins in managed heap. The pinned memory is released
when the resulting reference becomes unreachable and GC collects it. To control the lifetime of the pinned memory
deterministically use
to create an metadata object and
to get a reference to it.
The method creates a reference to a single-module assembly. To create a reference to a multi-module assembly or a stand-alone module use
and .
is null.
Creates a reference to a single-module assembly or a standalone module stored in memory.
Assembly image.
Reference properties (extern aliases, type embedding, ).
Provides XML documentation for symbol found in the reference.
Optional path that describes the location of the metadata. The file doesn't need to exist on disk. The path is opaque to the compiler.
Performance considerations:
It is recommended to use or
API when creating multiple references to the same metadata.
Reusing object to create multiple references allows for sharing data across these references.
The method makes a copy of the data and pins it. To avoid making a copy use an overload that takes an .
The pinned memory is released when the resulting reference becomes unreachable and GC collects it. To control the lifetime of the pinned memory
deterministically use
to create an metadata object and
to get a reference to it.
is null.
Creates a reference to a single-module assembly or a stand-alone module from data in specified stream.
Reads the content of the stream into memory and closes the stream upon return.
Assembly image.
Reference properties (extern aliases, type embedding, ).
Provides XML documentation for symbol found in the reference.
Optional path that describes the location of the metadata. The file doesn't need to exist on disk. The path is opaque to the compiler.
doesn't support read and seek operations.
is null.
An error occurred while reading the stream.
Performance considerations:
It is recommended to use or
API when creating multiple references to the same metadata.
Reusing object to create multiple references allows for sharing data across these references.
The method eagerly reads the entire content of into native heap. The native memory block is released
when the resulting reference becomes unreachable and GC collects it. To decrease memory footprint of the reference and/or manage
the lifetime deterministically use
to create an metadata object and
to get a reference to it.
Creates a reference to an assembly or standalone module stored in a file.
Reads the content of the file into memory.
Path to the assembly file.
Reference properties (extern aliases, type embedding, ).
Provides XML documentation for symbol found in the reference.
is null.
is invalid.
An error occurred while reading the file.
Performance considerations:
It is recommended to use or
API when creating multiple references to the same file.
Reusing object allows for sharing data across these references.
The method eagerly reads the entire content of the file into native heap. The native memory block is released
when the resulting reference becomes unreachable and GC collects it. To decrease memory footprint of the reference and/or manage
the lifetime deterministically use
to create an metadata object and
to get a reference to it.
Creates a reference to a loaded assembly.
Path to the module file.
is null.
is dynamic, doesn't have a location, or the platform doesn't support reading from the location.
Performance considerations:
It is recommended to use API when creating multiple references to the same assembly.
Reusing object allows for sharing data across these references.
Creates a reference to a loaded assembly.
Path to the module file.
Reference properties (extern aliases, type embedding).
Provides XML documentation for symbol found in the reference.
is null.
. is not .
is dynamic, doesn't have a location, or the platform doesn't support reading from the location.
Performance considerations:
It is recommended to use API when creating multiple references to the same assembly.
Reusing object allows for sharing data across these references.
Information about a metadata reference.
Default properties for a module reference.
Default properties for an assembly reference.
Initializes reference properties.
The image kind - assembly or module.
Assembly aliases. Can't be set for a module.
True to embed interop types from the referenced assembly to the referencing compilation. Must be false for a module.
Returns with specified aliases.
is , as modules can't be aliased.
Returns with specified aliases.
is , as modules can't be aliased.
Returns with set to specified value.
is , as interop types can't be embedded from modules.
Returns with set to specified value.
The image kind (assembly or module) the reference refers to.
Alias that represents a global declaration space.
Namespaces in references whose contain are available in global declaration space.
Aliases for the metadata reference. Empty if the reference has no aliases.
In C# these aliases can be used in "extern alias" syntax to disambiguate type names.
True if interop types defined in the referenced metadata should be embedded into the compilation referencing the metadata.
True to apply recursively on the target assembly and on all its transitive dependencies.
False to apply only on the target assembly.
Resolves references to metadata specified in the source (#r directives).
True to instruct the compiler to invoke for each assembly reference that
doesn't match any of the assemblies explicitly referenced by the (via , or #r directives.
Resolves a missing assembly reference.
The metadata definition (assembly or module) that declares assembly reference in its list of dependencies.
Identity of the assembly reference that couldn't be resolved against metadata references explicitly specified to in the compilation.
Resolved reference or null if the identity can't be resolved.
Represents an immutable snapshot of module CLI metadata.
This object may allocate significant resources or lock files depending upon how it is constructed.
Optional action to invoke when this metadata is disposed.
Create metadata module from a raw memory pointer to metadata directory of a PE image or .cormeta section of an object file.
Only manifest modules are currently supported.
Pointer to the start of metadata block.
The size of the metadata block.
is null.
is not positive.
Create metadata module from a raw memory pointer to metadata directory of a PE image or .cormeta section of an object file.
Only manifest modules are currently supported.
Pointer to the start of metadata block.
The size of the metadata block.
Action to run when the metadata module is disposed. This will only be called then
this actual metadata instance is disposed. Any instances created from this using will not call this when they are disposed.
is null.
Create metadata module from a raw memory pointer to a PE image or an object file.
Pointer to the DOS header ("MZ") of a portable executable image.
The size of the image pointed to by .
is null.
is not positive.
Create metadata module from a sequence of bytes.
The portable executable image beginning with the DOS header ("MZ").
is null.
Create metadata module from a byte array.
Portable executable image beginning with the DOS header ("MZ").
is null.
Create metadata module from a stream.
Stream containing portable executable image. Position zero should contain the first byte of the DOS header ("MZ").
False to close the stream upon disposal of the metadata (the responsibility for disposal of the stream is transferred upon entry of the constructor
unless the arguments given are invalid).
is null.
The stream doesn't support seek operations.
Create metadata module from a stream.
Stream containing portable executable image. Position zero should contain the first byte of the DOS header ("MZ").
Options specifying how sections of the PE image are read from the stream.
Unless is specified, the responsibility for disposal of the stream is transferred upon entry of the constructor
unless the arguments given are invalid.
is null.
The stream doesn't support read and seek operations.
has an invalid value.
or is specified and the PE headers of the image are invalid.
or is specified and an error occurs while reading the stream.
Creates metadata module from a file containing a portable executable image.
File path.
The file might remain mapped (and read-locked) until this object is disposed.
The memory map is only created for large files. Small files are read into memory.
is null.
is invalid.
Error opening file . See for details.
File not found.
Reading from a file path is not supported by the platform.
Creates a shallow copy of this object.
The resulting copy shares the metadata image and metadata information read from it with the original.
It doesn't own the underlying metadata image and is not responsible for its disposal.
This is used, for example, when a metadata cache needs to return the cached metadata to its users
while keeping the ownership of the cached metadata object.
Frees memory and handles allocated for the module.
True if the module has been disposed.
Name of the module.
Invalid metadata.
Module has been disposed.
Version of the module content.
Invalid metadata.
Module has been disposed.
Returns the for this instance.
Returns the file names of linked managed modules.
When an invalid module name is encountered.
Module has been disposed.
Returns the metadata reader.
Module has been disposed.
When an invalid module name is encountered.
Creates a reference to the module metadata.
Provider of XML documentation comments for the metadata symbols contained in the module.
Path describing the location of the metadata, or null if the metadata have no location.
Display string used in error messages to identity the reference.
A reference to the module metadata.
Reference to metadata stored in the standard ECMA-335 metadata format.
Display string used in error messages to identity the reference.
Path describing the location of the metadata, or null if the metadata have no location.
XML documentation comments provider for the reference.
Create documentation provider for the reference.
Called when the compiler needs to read the documentation for the reference.
This method can be called multiple times from different threads. The result of one of the calls
is cached on the reference object.
Returns an instance of the reference with specified aliases.
The new aliases for the reference.
Alias is invalid for the metadata kind.
Returns an instance of the reference with specified aliases.
The new aliases for the reference.
Alias is invalid for the metadata kind.
Returns an instance of the reference with specified interop types embedding.
The new value for .
Interop types can't be embedded from modules.
Returns an instance of the reference with specified properties, or this instance if properties haven't changed.
The new properties for the reference.
Specified values not valid for this reference.
Returns an instance of the reference with specified properties.
The new properties for the reference.
Specified values not supported.
Only invoked if the properties changed.
Get metadata representation for the PE file.
If the PE image format is invalid.
The metadata image content can't be read.
The metadata image is stored in a file that can't be found.
Called when the needs to read the reference metadata.
The listed exceptions are caught and converted to compilation diagnostics.
Any other exception is considered an unexpected error in the implementation and is not caught.
objects may cache information decoded from the PE image.
Reusing instances across metadata references will result in better performance.
The calling doesn't take ownership of the objects returned by this method.
The implementation needs to retrieve the object from a provider that manages their lifetime (such as metadata cache).
The object is kept alive by the that called
and by all compilations created from it via calls to With- factory methods on ,
other than overloads. A compilation created using
will call to again.
Returns a copy of the object this
contains. This copy does not need to be d.
If the PE image format is invalid.
The metadata image content can't be read.
The metadata image is stored in a file that can't be found.
Returns the for this reference's .
This will be equivalent to calling .,
but can be done more efficiently.
If the PE image format is invalid.
The metadata image content can't be read.
The metadata image is stored in a file that can't be found.
Represents the value of #r reference along with its source location.
Represents a metadata reference that can't be or is not yet resolved.
For error reporting only, can't be used to reference a metadata file.
Root type for representing the abstract semantics of C# and VB statements and expressions.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
IOperation that has this operation as a child. Null for the root.
Identifies the kind of the operation.
Syntax that was analyzed to produce the operation.
Result type of the operation, or null if the operation does not produce a result.
If the operation is an expression that evaluates to a constant value, is true and is the value of the expression. Otherwise, is false.
An array of child operations for this operation. Deprecated: please use .
An enumerable of child operations for this operation.
The source language of the IOperation. Possible values are and .
Set to True if compiler generated /implicitly computed by compiler code
Optional semantic model that was used to generate this operation.
Non-null for operations generated from source with API
and operation callbacks made to analyzers.
Null for operations inside a .
Implements a struct-based collection of nodes. This collection is ordered, but
random access into the collection is not provided.
Implements a struct-based enumerator for nodes. This type is not hardened
to default(Enumerator)
, and will null reference in these cases. Calling after
has returned false will throw an .
Implementation of the and
members are delegated to the virtual and
methods, respectively.
Implements a reverse-order struct-based collection of nodes.
This collection is ordered, but random access into the collection is not provided.
Implements a reverse-order struct-based enumerator for nodes. This type is not hardened
to default(Enumerator)
, and will null reference in these cases. Calling after
has returned false will throw an .
Root type for representing the abstract semantics of C# and VB statements and expressions.
IOperation that has this operation as a child
Set to True if compiler generated /implicitly computed by compiler code
Identifies the kind of the operation.
Syntax that was analyzed to produce the operation.
Result type of the operation, or null if the operation does not produce a result.
The source language of the IOperation. Possible values are and .
If the operation is an expression that evaluates to a constant value, is true and is the value of the expression. Otherwise, is false.
A slot of -1 means start at the beginning.
A slot of int.MaxValue means start from the end.
Gets the owning semantic model for this operation node.
Note that this may be different than , which
is the semantic model on which was invoked
to create this node.
Populates a empty dictionary of SyntaxNode->IOperation, where every key corresponds to an explicit IOperation node.
If there is a SyntaxNode with more than one explicit IOperation, this will throw.
Combines a value, , and a flag, ,
indicating whether or not that value is meaningful.
The type of the value.
Constructs an with a meaningful value.
Returns if the will return a meaningful value.
Gets the value of the current object. Not meaningful unless returns .
Unlike , this property does not throw an exception when
is .
The value if is ; otherwise, the default value for type
.
Creates a new object initialized to a meaningful value.
Returns a string representation of this object.
Specifies output assembly kinds generated by compiler.
An .exe with an entry point and a console.
An .exe with an entry point but no console.
A .dll file.
A .netmodule file.
A .winmdobj file.
An .exe that can run in an app container.
Equivalent to a WindowsApplication, but with an extra bit set in the Portable Executable file
so that the application can only be run in an app container.
Also known as a "Windows Store app".
A set of utilities for converting from a decimal floating-point literal string to its IEEE float
or double representation, which considers all digits significant and correctly rounds according to
the IEEE round-to-nearest-ties-to-even mode. This code does not support a leading sign character,
as that is not part of the C# or VB floating-point literal lexical syntax.
If you change this code, please run the set of long-running random tests in the solution
RandomRealParserTests.sln. That solution is not included in Roslyn.sln as it is Windows-specific.
Try parsing a correctly-formatted double floating-point literal into the nearest representable double
using IEEE round-to-nearest-ties-to-even rounding mode. Behavior is not defined for inputs that are
not valid C# floating-point literals.
The decimal floating-point constant's string
The nearest double value, if conversion succeeds
True if the input was converted; false if there was an overflow
Try parsing a correctly-formatted float floating-point literal into the nearest representable float
using IEEE round-to-nearest-ties-to-even rounding mode. Behavior is not defined for inputs that are
not valid C# floating-point literals.
The float floating-point constant's string
The nearest float value, if conversion succeeds
True if the input was converted; false if there was an overflow
Properties of an IEEE floating-point representation.
Converts the floating point value 0.mantissa * 2^exponent into the
correct form for the FloatingPointType and stores the bits of the resulting value
into the result object.
The caller must ensure that the mantissa and exponent are correctly computed
such that either [1] the most significant bit of the mantissa is in the
correct position for the FloatingType, or [2] the exponent has been correctly
adjusted to account for the shift of the mantissa that will be required.
This function correctly handles range errors and stores a zero or infinity in
the result object on underflow and overflow errors, respectively. This
function correctly forms denormal numbers when required.
If the provided mantissa has more bits of precision than can be stored in the
result object, the mantissa is rounded to the available precision. Thus, if
possible, the caller should provide a mantissa with at least one more bit of
precision than is required, to ensure that the mantissa is correctly rounded.
(The caller should not round the mantissa before calling this function.)
The bits of the mantissa
The exponent
Whether there are any nonzero bits past the supplied mantissa
Where the bits of the floating-point number are stored
A status indicating whether the conversion succeeded and why
Properties of a C# float.
Properties of a C# double.
This type is used to hold a partially-parsed string representation of a
floating point number. The number is stored in the following form:
0.Mantissa * 10^Exponent
The Mantissa buffer stores the mantissa digits as characters in a string.
The MantissaCount gives the number of digits present in the Mantissa buffer.
There shall be neither leading nor trailing zero digits in the Mantissa.
Note that this represents only nonnegative floating-point literals; the
negative sign in C# and VB is actually a separate unary negation operator.
Create a DecimalFloatingPointString from a string representing a floating-point literal.
The text of the floating-point literal
Convert a DecimalFloatingPointString to the bits of the given floating-point type.
This function is part of the fast track for integer floating point strings.
It takes an integer stored as an array of bytes (lsb first) and converts the value into its FloatingType
representation, storing the bits into "result". If the value is not
representable, +/-infinity is stored and overflow is reported (since this
function only deals with integers, underflow is impossible).
the bits of the integer, least significant bits first
the number of bits of precision in integerValueAsBytes
whether there are nonzero digits after the decimal
the kind of real number to build
the result
An indicator of the kind of result
Parse a sequence of digits into a BigInteger.
The DecimalFloatingPointString containing the digits in its Mantissa
The index of the first digit to convert
The index just past the last digit to convert
The BigInteger result
Return the number of significant bits set.
Return the number of significant bits set.
Return the number of significant bits set.
Return the number of significant bits set.
Computes value / 2^shift, then rounds the result according to the current
rounding mode. By the time we call this function, we will already have
discarded most digits. The caller must pass true for has_zero_tail if
all discarded bits were zeroes.
The value to shift
The amount of shift
Whether there are any less significant nonzero bits in the value
Determines whether a mantissa should be rounded up in the
round-to-nearest-ties-to-even mode given [1] the value of the least
significant bit of the mantissa, [2] the value of the next bit after
the least significant bit (the "round" bit) and [3] whether any
trailing bits after the round bit are set.
The mantissa is treated as an unsigned integer magnitude.
For this function, "round up" is defined as "increase the magnitude" of the
mantissa.
the least-significant bit of the representable value
the bit following the least-significant bit
true if there are any (less significant) bits set following roundBit
Multiply a BigInteger by the given power of two.
The BigInteger to multiply by a power of two and replace with the product
The power of two to multiply it by
Multiply a BigInteger by the given power of ten.
The BigInteger to multiply by a power of ten and replace with the product
The power of ten to multiply it by
Convert a float value to the bits of its representation
Convert the bits of its representation to a float
A union used to convert between a float and the bits of its representation
The base class for language specific assembly managers.
Language specific representation for a compilation
Language specific representation for an assembly symbol.
Information about an assembly, used as an input for the Binder class.
Identity of the assembly.
Identity of assemblies referenced by this assembly.
References should always be returned in the same order.
The sequence of AssemblySymbols the Binder can choose from.
Check if provided AssemblySymbol is created for assembly described by this instance.
This method is expected to return true for every AssemblySymbol returned by
AvailableSymbols property.
The AssemblySymbol to check.
Boolean.
Resolve assembly references against assemblies described by provided AssemblyData objects.
In other words, match assembly identities returned by AssemblyReferences property against
assemblies described by provided AssemblyData objects.
AssemblyData objects to match against.
Used to compare assembly identities.
For each assembly referenced by this assembly ()
a description of how it binds to one of the input assemblies.
Get the source compilation backing this assembly, if one exists.
Returns null otherwise.
Result of binding an AssemblyRef to an AssemblyDef.
Failed binding.
Successful binding.
Returns true if the reference was matched with the identity of the assembly being built.
True if the definition index is available (reference was successfully matched with the definition).
0 if the reference is equivalent to the definition.
-1 if version of the matched definition is lower than version of the reference, but the reference otherwise matches the definition.
+1 if version of the matched definition is higher than version of the reference, but the reference otherwise matches the definition.
Undefined unless is true.
Index into assembly definition list.
Undefined unless is true.
Private helper class to capture information about AssemblySymbol instance we
should check for suitability. Used by the Bind method.
An index of the AssemblyData object in the input array. AssemblySymbol instance should
be checked for suitability against assembly described by that object, taking into account
assemblies described by other AssemblyData objects in the input array.
AssemblySymbol instance to check for suitability.
Convenience constructor to initialize fields of this structure.
Result of binding an input assembly and its references.
Suitable AssemblySymbol instance for the corresponding assembly,
null reference if none is available/found.
For each AssemblyRef of this AssemblyDef specifies which AssemblyDef matches the reference.
Result of resolving assembly references of the corresponding assembly
against provided set of assemblies. Essentially, this is an array returned by
AssemblyData.BindAssemblyReferences method.
Each element describes the assembly the corresponding reference of the input assembly
is bound to.
For the given set of AssemblyData objects, do the following:
1) Resolve references from each assembly against other assemblies in the set.
2) Choose suitable AssemblySymbol instance for each AssemblyData object.
The first element (index==0) of the assemblies array represents the assembly being built.
One can think about the rest of the items in assemblies array as assembly references given to the compiler to
build executable for the assembly being built.
An array of objects describing assemblies, for which this method should
resolve references and find suitable AssemblySymbols. The first slot contains the assembly being built.
An array of objects describing standalone modules referenced by the compilation.
An array of references passed to the compilation and resolved from #r directives.
May contain references that were skipped during resolution (they don't have a corresponding explicit assembly).
Maps index to to an index of a resolved assembly or module in or modules.
Reference resolver used to look up missing assemblies.
Hide lower versions of dependencies that have multiple versions behind an alias.
Used to filter out assemblies that have the same strong or weak identity.
Maps simple name to a list of identities. The highest version of each name is the first.
Import options applied to implicitly resolved references.
Updated array with resolved implicitly referenced assemblies appended.
Implicitly resolved references.
Maps indices of implicitly resolved references to the corresponding indices of resolved assemblies in (explicit + implicit).
Map of implicit reference resolutions performed in the preceding script compilation.
Output contains additional implicit resolutions performed during binding of this script compilation references.
Any diagnostics reported while resolving missing assemblies.
True if the assembly being compiled is indirectly referenced through some of its own references.
The definition index of the COR library.
An array of structures describing the result. It has the same amount of items as
the input assemblies array, for each input AssemblyData object resides
at the same position.
Each contains the following data:
- Suitable AssemblySymbol instance for the corresponding assembly,
null reference if none is available/found. Always null for the first element, which corresponds to the assembly being built.
- Result of resolving assembly references of the corresponding assembly
against provided set of assembly definitions. Essentially, this is an array returned by
method.
Resolve using a given .
We make sure not to query the resolver for the same identity multiple times (across submissions).
Doing so ensures that we don't create multiple assembly symbols within the same chain of script compilations
for the same implicitly resolved identity. Failure to do so results in cast errors like "can't convert T to T".
The method only records successful resolution results by updating .
Failures are only recorded after all resolution attempts have been completed.
This approach addresses the following scenario. Consider a script:
#r "dir1\a.dll"
#r "dir2\b.dll"
where both a.dll and b.dll reference x.dll, which is present only in dir2. Let's assume the resolver first
attempts to resolve "x" referenced from "dir1\a.dll". The resolver may fail to find the dependency if it only
looks up the directory containing the referencing assembly (dir1). If we recorded and this failure immediately
we would not call the resolver to resolve "x" within the context of "dir2\b.dll" (or any other referencing assembly).
This behavior would ensure consistency and if the types from x.dll do leak thru to the script compilation, but it
would result in a missing assembly error. By recording the failure after all resolution attempts are complete
we also achieve a consistent behavior but are able to bind the reference to "x.dll". Besides, this approach
also avoids dependency on the order in which we evaluate the assembly references in the scenario above.
In general, the result of the resolution may still depend on the order of #r - if there are different assemblies
of the same identity in different directories.
Determines if it is possible that gives internals
access to assembly . It does not make a conclusive
determination of visibility because the compilation's strong name key is not supplied.
Compute AssemblySymbols referenced by the input AssemblySymbol and fill in with the result.
The AssemblySymbols must correspond
to the AssemblyNames returned by AssemblyData.AssemblyReferences property. If reference is not
resolved, null reference should be returned in the corresponding item.
The target AssemblySymbol instance.
A list which will be filled in with
AssemblySymbols referenced by the input AssemblySymbol. The caller is expected to clear
the list before calling this method.
Implementer may not cache the list; the caller may mutate it.
Return collection of assemblies involved in canonical type resolution of
NoPia local types defined within target assembly. In other words, all
references used by previous compilation referencing the target assembly.
Assembly is /l-ed by compilation that is using it as a reference.
Get Assembly used as COR library for the candidate.
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.
Called to compare two weakly named identities with the same name.
Aliases that should be applied to the referenced assembly.
Empty array means {"global"} (all namespaces and types in the global namespace of the assembly are accessible without qualification).
Null if not applicable (the reference only has recursive aliases).
Aliases that should be applied recursively to all dependent assemblies.
Empty array means {"global"} (all namespaces and types in the global namespace of the assembly are accessible without qualification).
Null if not applicable (the reference only has simple aliases).
default() is considered skipped.
Index into an array of assemblies (not including the assembly being built) or an array of modules, depending on .
non-negative: Index into the array of all (explicitly and implicitly) referenced assemblies.
negative: ExplicitlyReferencedAssemblies.Count + RelativeAssemblyIndex is an index into the array of assemblies.
Resolves given metadata references to assemblies and modules.
The compilation whose references are being resolved.
Used to filter out assemblies that have the same strong or weak identity.
Maps simple name to a list of identities. The highest version of each name is the first.
List where to store resolved references. References from #r directives will follow references passed to the compilation constructor.
Maps #r values to successfully resolved metadata references. Does not contain values that failed to resolve.
Unique metadata references resolved from #r directives.
List where to store information about resolved assemblies to.
List where to store information about resolved modules to.
Diagnostic bag where to report resolution errors.
Maps index to to an index of a resolved assembly or module in or , respectively.
Creates or gets metadata for PE reference.
If any of the following exceptions: , , ,
are thrown while reading the metadata file, the exception is caught and an appropriate diagnostic stored in .
Determines whether references are the same. Compilation references are the same if they refer to the same compilation.
Otherwise, references are represented by their object identities.
Merges aliases of the first observed reference () with aliases specified for an equivalent reference ().
Empty alias list is considered to be the same as a list containing "global", since in both cases C# allows unqualified access to the symbols.
Caller is responsible for freeing any allocated ArrayBuilders.
Caller is responsible for freeing any allocated ArrayBuilders.
Returns null if an assembly of an equivalent identity has not been added previously, otherwise returns the reference that added it.
Two identities are considered equivalent if
- both assembly names are strong (have keys) and are either equal or FX unified
- both assembly names are weak (no keys) and have the same simple name.
For each given directive return a bound PE reference, or null if the binding fails.
Used to match AssemblyRef with AssemblyDef.
Definitions to match against.
Whether to attempt to resolve the reference against the assembly being built (index 0).
Reference identity to resolve.
Assembly identity comparer.
Returns an index the reference is bound.
If the compilation being built represents an assembly its assembly name.
If the compilation being built represents a module, the name of the
containing assembly or
if not specified (/moduleassemblyname command line option).
Used to compares assembly identities.
May implement unification and portability policies specific to the target platform.
Metadata observed by the compiler.
May be shared across multiple Reference Managers.
Access only under lock().
Once this is non-zero the state of the manager is fully initialized and immutable.
True if the compilation has a reference that refers back to the assembly being compiled.
If we have a circular reference the bound references can't be shared with other compilations.
A map from a metadata reference to an index to array. Do not access
directly, use property instead.
A map from a net-module metadata reference to the index of the corresponding module
symbol in the source assembly symbol for the current compilation.
Subtract one from the index (for the manifest module) to find the corresponding elements
of and .
Maps (containing syntax tree file name, reference string) of #r directive to a resolved metadata reference.
If multiple #r's in the same tree use the same value as a reference the resolved metadata reference is the same as well.
Array of unique bound #r references.
The references are in the order they appear in syntax trees. This order is currently preserved
as syntax trees are added or removed, but we might decide to share reference manager between compilations
with different order of #r's. It doesn't seem this would be an issue since all #r's within the compilation
have the same "priority" with respect to each other.
Stores the results of implicit reference resolutions.
If is true the reference manager attempts to resolve assembly identities,
that do not match any explicit metadata references passed to the compilation (or specified via #r directive).
For each such assembly identity is called
and its result is captured in this map.
The map also stores failures - the reference is null if the assembly of the given identity is not found by the resolver.
This is important to maintain consistency, especially across multiple submissions (e.g. the reference is not found during compilation of the first submission
but then it is available when the second submission is compiled).
Diagnostics produced during reference resolution and binding.
When reporting diagnostics be sure not to include any information that can't be shared among
compilations that share the same reference manager (such as full identity of the compilation,
simple assembly name is ok).
COR library symbol, or null if the compilation itself is the COR library.
If the compilation being built is the COR library we don't want to store its source assembly symbol
here since we wouldn't be able to share the state among subsequent compilations that are derived from it
(each of them has its own source assembly symbol).
Standalone modules referenced by the compilation (doesn't include the manifest module of the compilation).
[i] corresponds to [i].
References of standalone modules referenced by the compilation (doesn't include the manifest module of the compilation).
[i] corresponds to [i].
Assemblies referenced directly by the source module of the compilation.
Aliases used by assemblies referenced directly by the source module of the compilation.
Aliases [i] are of an assembly [i].
A map capturing s that were "merged" to a single referenced assembly
associated with a key in the map.
The keys are a subset of keys from .
Unified assemblies referenced directly by the source module of the compilation.
Call only while holding .
Call only while holding .
Global namespaces of assembly references that have been superseded by an assembly reference with a higher version are
hidden behind to avoid ambiguity when they are accessed from source.
All existing aliases of a superseded assembly are discarded.
Calculates map from the identities of specified symbols to the corresponding identities in the original EnC baseline metadata.
The map only includes an entry for identities that differ, i.e. for symbols representing assembly references of the current compilation that have different identities
than the corresponding identity in baseline metadata AssemblyRef table. The key comparer of the map ignores build and revision parts of the version number,
since these might change if the original version included wildcard.
Assembly symbols for references of the current compilation.
Identities in the baseline. [i] corresponds to [i].
Gets the that corresponds to the assembly symbol.
Must be acquired whenever the following data are about to be modified:
- Compilation.lazyAssemblySymbol
- Compilation.referenceManager
- ReferenceManager state
-
-
All the above data should be updated at once while holding this lock.
Once lazyAssemblySymbol is set the Compilation.referenceManager field and ReferenceManager
state should not change.
Enumerates all referenced assemblies.
Enumerates all referenced assemblies and their aliases.
Adds aliases of a specified reference to the merged set of aliases.
Consider the following special cases:
o {} + {} = {}
If neither reference has any aliases then the result has no aliases.
o {A} + {} = {A, global}
{} + {A} = {A, global}
If one and only one of the references has aliases we add the global alias since the
referenced declarations should now be accessible both via existing aliases
as well as unqualified.
o {A, A} + {A, B, B} = {A, A, B, B}
We preserve dups in each alias array, but avoid making more dups when merging.
A record of the assemblies referenced by a module (their identities, symbols, and unification).
Identities of referenced assemblies (those that are or will be emitted to metadata).
Names[i] is the identity of assembly Symbols[i].
Assembly symbols that the identities are resolved against.
Names[i] is the identity of assembly Symbols[i].
Unresolved references are represented as MissingAssemblySymbols.
A subset of that correspond to references with non-matching (unified)
version along with unification details.
Assembly symbol referenced by a AssemblyRef for which we couldn't find a matching
compilation reference but we found one that differs in version.
Created only for assemblies that require runtime binding redirection policy,
i.e. not for Framework assemblies.
Original reference that was unified to the identity of the .
Representation of a resource whose contents are to be embedded in the output assembly.
Creates a representation of a resource whose contents are to be embedded in the output assembly.
Resource name.
The callers will dispose the result after use.
This allows the resources to be opened and read one at a time.
True if the resource is public.
Returns a stream of the data to embed.
Creates a representation of a resource whose file name will be recorded in the assembly.
Resource name.
File name with an extension to be stored in metadata.
The callers will dispose the result after use.
This allows the resources to be opened and read one at a time.
True if the resource is public.
Function returning a stream of the resource content (used to calculate hash).
Represents errors that occur while parsing RuleSet files.
Represents a set of rules as specified in a ruleset file.
The file path of the ruleset file.
The global option specified by the IncludeAll tag.
Individual rule ids and their associated actions.
List of rulesets included by this ruleset.
Create a RuleSet.
Create a RuleSet with a global effective action applied on it.
Get the effective ruleset after resolving all the included rulesets.
Get all the files involved in resolving this ruleset.
Returns true if the action1 is stricter than action2.
Load the ruleset from the specified file. This ruleset will contain
all the rules resolved from the includes specified in the ruleset file
as well. See also: .
A ruleset that contains resolved rules or null if there were errors.
Get the paths to all files contributing rules to the ruleset from the specified file.
See also: .
The full paths to included files, or an empty array if there were errors.
Parses the ruleset file at the given and returns the following diagnostic options from the parsed file:
1) A map of from rule ID to option.
2) A global option for all rules in the ruleset file.
Represents a Include tag in a RuleSet file.
The path of the included file.
The effective action to apply on this included ruleset.
Create a RuleSetInclude given the include path and the effective action.
Gets the RuleSet associated with this ruleset include
The parent of this ruleset include
Returns a full path to the include file. Relative paths are expanded relative to the current rule set file.
The parent of this rule set include
This type is responsible for parsing a ruleset xml file and producing a object.
Creates and loads the rule set from a file
The file path to load the rule set
Load the rule set from the XML node
The rule set node from which to create a rule set object
The file path to the rule set file
A rule set object with data from the given XML node
Load the rules from the XML node
The rules node from which to loop through each child rule node
A list of rule objects with data from the given XML node
Load the rule from the XML node
The rule node from which to create a rule object
A rule object with data from the given XML node
Load the included rule set from the XML node
The include node from which to create a RuleSetInclude object
A RuleSetInclude object with data from the given XML node
Reads the action from the given node
The node to read the action, it can be a rule node or an include node.
Whether or not the default value is allowed.
The rule action
Load the IncludedAll from the XML node
The IncludeAll node from which to create a IncludeAll object
A IncludeAll object with data from the given XML node
Reads an attribute from a node and validates that it is not empty.
The XML node that contains the attribute
The name of the attribute to read
The attribute value
Gets the default settings to read the ruleset xml file.
Specifies capabilities that may or may not be supported by the common language runtime the compilation is
targeting.
Represents a runtime feature where types can define ref fields.
Represents a runtime feature where overriding methods can return more derived types than the method they override.
Represents a runtime feature where interfaces can define default method implementations.
Indicates that this version of the runtime supports IntPtr and UIntPtr as numeric types.
Represents a runtime feature where C# function pointers can be declared with an unmanaged calling convention.
Indicates that this version of runtime supports virtual static members of interfaces.
Indicates that this version of runtime supports inline array types.
Indicates that this version of runtime supports generic type parameters allowing substitution with a ref struct.
Specifies the C# or VB source code kind.
No scripting. Used for .cs/.vb file parsing.
Allows top-level statements, declarations, and optional trailing expression.
Used for parsing .csx/.vbx and interactive submissions.
The same as .
Resolves references to source files specified in source code.
A source text created by an
A syntax tree created by a
Adapts an ISourceGenerator to an incremental generator that
by providing an execution environment that matches the old one
A dummy extension that is used to indicate this adaptor was created outside of the driver.
Place this attribute onto a type to cause it to be considered a source generator
The source languages to which this generator applies. See .
Attribute constructor used to specify the attached class is a source generator that provides CSharp sources.
Attribute constructor used to specify the attached class is a source generator and indicate which language(s) it supports.
One language to which the generator applies.
Additional languages to which the generator applies. See .
Context passed to a source generator when is called
Get the current at the time of execution.
This compilation contains only the user supplied code; other generated code is not
available. As user code can depend on the results of generation, it is possible that
this compilation will contain errors.
Get the that will be used to parse any added sources.
A set of additional non-code text files that can be used by generators.
Allows access to options provided by an analyzer config
If the generator registered an during initialization, this will be the instance created for this generation pass.
If the generator registered an during initialization, this will be the instance created for this generation pass.
A that can be checked to see if the generation should be cancelled.
Adds source code in the form of a to the compilation.
An identifier that can be used to reference this source text, must be unique within this generator
The source code to add to the compilation
Adds a to the compilation
An identifier that can be used to reference this source text, must be unique within this generator
The to add to the compilation
Directory separators "/" and "\" are allowed in , they are normalized to "/" regardless of host platform.
Adds a to the users compilation
The diagnostic that should be added to the compilation
The severity of the diagnostic may cause the compilation to fail, depending on the settings.
is located in a syntax tree which is not part of the compilation,
its location span is outside of the given file, or its identifier is not valid.
Context passed to a source generator when is called
A that can be checked to see if the initialization should be cancelled.
Register a for this generator, which can be used to create an instance of an .
This method allows generators to be 'syntax aware'. Before each generation the will be invoked to create
an instance of . This receiver will have its
invoked for each syntax node in the compilation, allowing the receiver to build up information about the compilation before generation occurs.
During the generator can obtain the instance that was
created by accessing the property. Any information that was collected by the receiver can be
used to generate the final output.
A new instance of is created per-generation, meaning there is no need to manage the lifetime of the
receiver or its contents.
A that can be invoked to create an instance of
Register a for this generator, which can be used to create an instance of an .
This method allows generators to be 'syntax aware'. Before each generation the will be invoked to create
an instance of . This receiver will have its
invoked for each syntax node in the compilation, allowing the receiver to build up information about the compilation before generation occurs.
During the generator can obtain the instance that was
created by accessing the property. Any information that was collected by the receiver can be
used to generate the final output.
A new instance of is created prior to every call to ,
meaning there is no need to manage the lifetime of the receiver or its contents.
A that can be invoked to create an instance of
Register a callback that is invoked after initialization.
This method allows a generator to opt-in to an extra phase in the generator lifecycle called PostInitialization. After being initialized
any generators that have opted in will have their provided callback invoked with a instance
that can be used to alter the compilation that is provided to subsequent generator phases.
For example a generator may choose to add sources during PostInitialization. These will be added to the compilation before execution and
will be visited by a registered and available for semantic analysis as part of the
Note that any sources added during PostInitialization will be visible to the later phases of other generators operating on the compilation.
An that accepts a that will be invoked after initialization.
Context passed to an when is called
The currently being visited
The that can be queried to obtain information about .
Context passed to a source generator when it has opted-in to PostInitialization via
A that can be checked to see if the PostInitialization should be cancelled.
Adds source code in the form of a to the compilation that will be available during subsequent phases
An identifier that can be used to reference this source text, must be unique within this generator
The source code to add to the compilation
Adds a to the compilation that will be available during subsequent phases
An identifier that can be used to reference this source text, must be unique within this generator
The to add to the compilation
Directory separators "/" and "\" are allowed in , they are normalized to "/" regardless of host platform.
Responsible for orchestrating a source generation pass
GeneratorDriver is an immutable class that can be manipulated by returning a mutated copy of itself.
In the compiler we only ever create a single instance and ignore the mutated copy. The IDE may perform
multiple edits, or generation passes of the same driver, re-using the state as needed.
Run generators and produce an updated containing the results.
The compilation to run generators against
An updated driver that contains the results of the generators running.
Run generators and produce an updated containing the results.
The compilation to run generators against
A filter that specifies which generators to run. If null all generators will run.
Used to cancel an in progress operation.
An updated driver that contains the results of the generators running.
Attempts to find a driver based on . If a matching driver is found in the
cache, or explicitly passed via , the cache is updated so that it is at the
head of the list.
The key to lookup the driver by in the cache
An optional driver that should be cached, if not already found in the cache
Options passed to a during creation
The set of s associated with this state.
This is the set of generators that will run on next generation.
If there are any states present in , they were produced by a subset of these generators.
The set of s associated with this state.
This is the 'internal' representation of the collection. There is a 1-to-1 mapping
where each entry is either the unwrapped incremental generator or a wrapped
The last run state of each generator, by the generator that created it
There will be a 1-to-1 mapping for each generator. If a generator has yet to
be initialized or failed during initialization it's state will be default(GeneratorState)
The set of s available to source generators during a run
Gets a provider for analyzer options
The base directory for the of generated files.
ParseOptions to use when parsing generator provided source.
A bit field containing the output kinds that should not be produced by this generator driver.
Returns the underlying type of a given generator
For s a wrapper is created that also implements
. This method will unwrap and return the underlying type
in those cases.
The generator to get the type of
The underlying generator type
Returns the underlying type of a given generator
The generator to get the type of
The underlying generator type
Converts an into an object that can be used when constructing a
The incremental generator to convert
An that can be passed to a generator driver
Converts an into an
The source generator to convert
An incremental generator
Represents the current state of a generator
A generator state that has been initialized but produced no results
Creates a new generator state that contains information, constant trees and an execution pipeline
Simple wrapper class around an immutable array so we can have the value-semantics needed for the incremental
generator to know when a change actually happened and it should run later transform stages.
The base interface required to implement an incremental generator
The lifetime of a generator is controlled by the compiler.
State should not be stored directly on the generator, as there
is no guarantee that the same instance will be used on a
subsequent generation pass.
Called to initialize the generator and register generation steps via callbacks
on the
The to register callbacks on
Context passed to an incremental generator when is called
Context passed to an incremental generator when it has registered an output via
A that can be checked to see if the PostInitialization should be cancelled.
Adds source code in the form of a to the compilation that will be available during subsequent phases
An identifier that can be used to reference this source text, must be unique within this generator
The source code to add to the compilation
Adds a to the compilation that will be available during subsequent phases
An identifier that can be used to reference this source text, must be unique within this generator
The to add to the compilation
Directory separators "/" and "\" are allowed in , they are normalized to "/" regardless of host platform.
Context passed to an incremental generator when it has registered an output via
Adds source code in the form of a to the compilation.
An identifier that can be used to reference this source text, must be unique within this generator
The source code to add to the compilation
Adds a to the compilation
An identifier that can be used to reference this source text, must be unique within this generator
The to add to the compilation
Directory separators "/" and "\" are allowed in , they are normalized to "/" regardless of host platform.
Adds a to the users compilation
The diagnostic that should be added to the compilation
The severity of the diagnostic may cause the compilation to fail, depending on the settings.
is located in a syntax tree which is not part of the compilation,
its location span is outside of the given file, or its identifier is not valid.
Context passed to a filter to determine if a generator should be executed or not.
The generator instance that is being filtered
A that can be checked to see if the filtering should be cancelled.
Context passed to an incremental generator when it has registered an output via
Adds a host specific output
The name of the output to be added.
The output to be added.
A host output has no defined use. It does not contribute to the final compilation in any way. Any outputs registered
here are made available via the collection, and it is up the host to
decide how to use them. A host may also disable these outputs altogether if they are not needed. The generator driver
otherwise makes no guarantees about how the outputs are used, other than that they will be present if the host has
requested they be produced.
A that can be checked to see if producing the output should be cancelled.
A description of a step of an incremental generator that was executed.
The state of the output of a given executed incremental source generator step.
The input to this step was added or modified from a previous run, and it produced a new output.
The input to this step was modified from a previous run, and it produced a different value than the previous run.
The input to this step was modified from a previous run, but it produced an equal value to the previous run.
The output of this step was pulled from this step's cache since the inputs was unchanged from the previous run.
The input to this step was removed or modified from a previous run, and the output it used to generate is no longer present.
Represents a provider of a single value that can be transformed as part of constructing an execution pipeline
This is an opaque type that cannot be used directly. Instead an
will receive a set of value providers when constructing its execution pipeline. A set of extension methods
are then used to create transforms over the data that creates the actual pipeline.
The type of value that this source provides access to
Represents a provider of multiple values that can be transformed to construct an execution pipeline
This is an opaque type that cannot be used directly. Instead an
will receive a set of value providers when constructing its execution pipeline. A set of extension methods
are then used to create transforms over the data that creates the actual pipeline.
The type of value that this source provides access to
Wraps an incremental generator in a dummy interface.
Allows us to treat both generator types as ISourceGenerator externally and not change the public API.
Inside the driver we unwrap and use the actual generator instance.
The base interface required to implement a source generator
The lifetime of a generator is controlled by the compiler.
State should not be stored directly on the generator, as there
is no guarantee that the same instance will be used on a
subsequent generation pass.
Called before generation occurs. A generator can use the
to register callbacks required to perform generation.
The to register callbacks on
Called to perform source generation. A generator can use the
to add source files via the
method.
The to add source to
This call represents the main generation step. It is called after a is
created that contains the user written code.
A generator can use the property to
discover information about the users compilation and make decisions on what source to
provide.
must be a compilation unit or namespace block.
Receives notifications of each in the compilation before generation runs
A can provide an instance of
via a .
The compiler will invoke the prior to generation to
obtain an instance of . This instance will have its
called for every syntax node in the compilation.
The can record any information about the nodes visited. During
the generator can obtain the
created instance via the property. The
information contained can be used to perform final generation.
A new instance of is created per-generation, meaning the instance
is free to store state without worrying about lifetime or reuse.
An may provide only a single or
, not both.
Called for each in the compilation
The current being visited
Allows a generator to provide instances of an
An instance of an
Receives notifications of each in the compilation, along with a
that can be queried to obtain more information, before generation
runs.
A can provide an instance of
via a .
The compiler will invoke the prior to generation to
obtain an instance of . This instance will have its
called for every syntax node
in the compilation.
The can record any information about the nodes visited.
During the generator can obtain the
created instance via the property. The
information contained can be used to perform final generation.
A new instance of is created per-generation, meaning the instance
is free to store state without worrying about lifetime or reuse.
An may provide only a single or
, not both.
Allows a generator to provide instances of an
An instance of an
Represents a node in the execution pipeline of an incremental generator
The type of value this step operates on
Internal representation of an incremental output
Represents the various output kinds of an .
Can be passed as a bit field when creating a to selectively disable outputs.
Represents no output kinds. Can be used when creating a driver to indicate that no outputs should be disabled.
A regular source output, registered via
or
A post-initialization output, which will be visible to later phases, registered via
An Implementation only source output, registered via
or
A host specific output, registered via
or
Input nodes are the 'root' nodes in the graph, and get their values from the inputs of the driver state table
The type of the input
A data structure that tracks the inputs and output of an execution node
The type of the items tracked by this table
Indicates that this table is unchanged from the previous version.
The builder is not threadsafe.
All items removed as part of a transformation from non-empty input.
All items removed because the input has been removed.
Represents the corresponding state of each item in , or contains a single state when
is populated or when every state of has the same value.
Holds input nodes that are shared between generators and always exist
Allows a user to create Syntax based input nodes for incremental generation
Creates an that can provide a transform over s
The type of the value the syntax node is transformed into
A function that determines if the given should be transformed
A function that performs the transform, when returns true for a given node
An that provides the results of the transformation
Creates a syntax receiver input node. Only used for back compat in
Creates an that can provide a transform over all s if that node has an attribute on it that binds to a with the
same fully-qualified metadata as the provided . should be the fully-qualified, metadata name of the attribute, including the
Attribute suffix. For example "System.CLSCompliantAttribute" for .
A function that determines if the given attribute target () should be transformed. Nodes that do not pass this
predicate will not have their attributes looked at at all.
A function that performs the transform. This will only be passed nodes that return for and which have a matching whose
has the same fully qualified, metadata name as .
Returns all syntax nodes of that match if that node has an attribute on it that
could possibly bind to the provided . should be the
simple, non-qualified, name of the attribute, including the Attribute suffix, and not containing any
generics, containing types, or namespaces. For example CLSCompliantAttribute for .
This provider understands (Import in Visual Basic) aliases and will find
matches even when the attribute references an alias name. For example, given:
using XAttribute = System.CLSCompliantAttribute;
[X]
class C { }
Then
context.SyntaxProvider.CreateSyntaxProviderForAttribute(nameof(CLSCompliantAttribute), (node, c) => node is ClassDeclarationSyntax)
will find the C class.
Note: a 'Values'-provider of arrays are returned. Each array provides all the matching nodes from a single .
The syntax node the attribute is attached to. For example, with [CLSCompliant] class C { } this would
the class declaration node.
The symbol that the attribute is attached to. For example, with [CLSCompliant] class C { } this would be
the for "C".
Semantic model for the file that is contained within.
s for any matching attributes on . Always non-empty. All
these attributes will have an whose fully qualified name metadata
name matches the name requested in .
To get the entire list of attributes, use on .
Represents the results of running a generation pass over a set of s.
The individual result of each that was run in this generator pass, one per generator.
The wall clock time that this generator pass took to execute.
The s produced by all generators run during this generation pass.
This is equivalent to the union of all in .
The s produced during this generation pass by parsing each added by each generator.
This is equivalent to the union of all s in each in each
Represents the results of a single generation pass.
The that produced this result.
The sources that were added by during the generation pass this result represents.
A collection of s reported by
When generation fails due to an being thrown, a single diagnostic is added
to represent the failure. Any generator reported diagnostics up to the failure point are not included.
A collection of items added via .
An instance that was thrown by the generator, or null if the generator completed without error.
When this property has a value, property is guaranteed to be empty, and the
collection will contain a single diagnostic indicating that the generator failed.
The wall clock time that elapsed while this generator was running.
A collection of the named incremental steps (both intermediate and final output ones)
executed during the generator pass this result represents.
Steps can be named by extension method WithTrackingName.
A collection of the named output steps executed during the generator pass this result represents.
Steps can be named by extension method WithTrackingName.
Represents the results of an calling .
This contains the original added by the generator, along with the parsed representation of that text in .
The that was produced from parsing the .
The that was added by the generator.
An identifier provided by the generator that identifies the added .
Contains timing information for a full generation pass.
The wall clock time that the entire generation pass took.
This can be more than the sum of times in as it includes other costs such as setup.
Individual timings per generator.
Contains timing information for a single generator.
The that was running during the recorded time.
The wall clock time the generator spent running.
Wraps an in an
Gets the adjustment to wall clock time that should be applied for a set of input nodes.
The syntax store updates all input nodes in parallel the first time an input node is asked to update,
so that it can share the semantic model between multiple nodes and improve perf.
Unfortunately that means that the first generator to request the results of a syntax node will incorrectly
have its wall clock time contain the time of all other syntax nodes. And conversely other input nodes will
not have the true time taken.
This method gets the adjustment that should be applied to the wall clock time for a set of input nodes
so that the correct time is attributed to each.
Well known incremental generator input step names.
Well known incremental generator output step names.
Specifies the Ids of special runtime types.
Only types explicitly mentioned in "Co-located core types" spec
(https://github.com/dotnet/roslyn/blob/main/docs/compilers/Co-located%20core%20types.md)
can be in this enum.
The following things should be in sync:
1) SpecialType enum
2) names in SpecialTypes.EmittedNames array.
Indicates a non-special type (default value).
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is .
Indicates that the type is System.Runtime.CompilerServices.RuntimeFeature.
An attribute that is placed on each method with a 'methodimpl" aka ".override" in metadata.
An attribute that is placed on an inline array type.
Count of special types. This is not a count of enum members.
The underlying numeric value of this member is expected to change every time a new special type is added
Checks if a type is considered a "built-in integral" by CLR.
Checks if a type is a primitive of a fixed size.
These special types are structs that contain fields of the same type
(e.g. System.Int32 contains a field of type System.Int32).
Checks if a type is considered a "built-in integral" by CLR.
For signed integer types return number of bits for their representation minus 1.
I.e. 7 for Int8, 31 for Int32, etc.
Used for checking loop end condition for VB for loop.
Tells whether a different code path can be taken based on the fact, that a given type is a special type.
This method is called in places where conditions like specialType != SpecialType.None were previously used.
The main reason for this method to exist is to prevent such conditions, which introduce silent code changes every time a new special type is added.
This doesn't mean the checked special type range of this method cannot be modified,
but rather that each usage of this method needs to be reviewed to make sure everything works as expected in such cases
Convert a boxed primitive (generally of the backing type of an enum) into a ulong.
Array of names for types from Cor Library.
The names should correspond to ids from TypeId enum so
that we could use ids to index into the array
Gets the name of the special type as it would appear in metadata.
Try to retrieve the public key from a crypto blob.
Can be either a PUBLICKEYBLOB or PRIVATEKEYBLOB. The BLOB must be unencrypted.
Helper for RsaCryptoServiceProvider.ExportParameters()
Copied from https://github.com/dotnet/corefx/blob/5fe5f9aae7b2987adc7082f90712b265bee5eefc/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Shared.cs
Helper for converting a UInt32 exponent to bytes.
Copied from https://github.com/dotnet/corefx/blob/5fe5f9aae7b2987adc7082f90712b265bee5eefc/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Shared.cs
Read in a byte array in reverse order.
Copied from https://github.com/dotnet/corefx/blob/5fe5f9aae7b2987adc7082f90712b265bee5eefc/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Shared.cs
Provides strong name and signs source assemblies.
Creates an instance of .
Path to use for any temporary file generation.
An ordered set of fully qualified paths which are searched when locating a cryptographic key file.
Resolves assembly strong name key file path.
Normalized key file path or null if not found.
This is an abstraction over the file system which allows for us to do more thorough unit testing.
The strong name key associated with the identity of this assembly.
This contains the contents of the user-supplied key file exactly as extracted.
Determines source assembly identity.
The Private key information that will exist if it was a private key file that was parsed.
A diagnostic created in the process of determining the key.
The CSP key container containing the public key used to produce the key,
or null if the key was retrieved from .
The original value as specified by or
.
Original key file path, or null if the key is provided by the .
The original value as specified by or
True when the assembly contains a value
and hence signing requires counter signature verification.
True if the compilation can be signed using these keys.
True if a strong name can be created for the compilation using these keys.
Provides strong name and signs source assemblies.
Signs the value using .
Signs the contents of using and .
Create a for the provided information.
Contains helper methods for switch statement label constants
Method used to compare ConstantValues for switch statement case labels
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Less than zero: first instance precedes second in the sort order.
Zero: first instance occurs in the same position in the sort order as second.
Greater than zero: first instance follows second in the sort order.
Append a default argument (i.e. the default argument of an optional parameter).
Assumed to be non-null.
Check if the given type is an enum with System.FlagsAttribute.
TODO: Can/should this be done using WellKnownAttributes?
This class associates a symbol with particular format for display.
It can be passed as an argument for an error message in place where symbol display should go,
which allows to defer building strings and doing many other things (like loading metadata)
associated with that until the error message is actually requested.
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Specifies the options for how generics are displayed in the description of a symbol.
Format object using default options.
In C#, include the numeric code point before character literals.
Whether or not to include type suffix for applicable integral literals.
Whether or not to display integral literals in hexadecimal.
Whether or not to quote character and string literals.
In C#, replace non-printable (e.g. control) characters with dedicated (e.g. \t) or unicode (\u0001) escape sequences.
In Visual Basic, replace non-printable characters with calls to ChrW and vb* constants.
None
".ctor" instead of "Goo"
"List`1" instead of "List<T>" ("List(of T)" in VB). Overrides GenericsOptions on
types.
Append "[Missing]" to missing Metadata types (for testing).
Include the Script type when qualifying type names.
Include custom modifiers (e.g. modopt([mscorlib]System.Runtime.CompilerServices.IsConst)) on
the member (return) type and parameters.
CONSIDER: custom modifiers are part of the public API, so we might want to move this to SymbolDisplayMemberOptions.
For a type written as "int[][,]" in C#, then
a) setting this option will produce "int[,][]", and
b) not setting this option will produce "int[][,]".
Display `System.[U]IntPtr` instead of `n[u]int`.
Separate out nested types from containing types using + instead of . (dot).
Display `MyType@File.cs` instead of `MyType`.
Does not include parameter name if the parameter is displayed on its own
(i.e., not as part of a method, delegate, or indexer).
Display `<File>F<sha256-hex-string>_MyType` instead of `MyType`.
Differs from because it guarantees that
the prefix will be unique for all files which are permitted to declare file-local types.
Specifies how to display delegates (just the name or the name with the signature).
Shows only the name of the delegate (e.g. "SomeDelegate").
Shows the name and the parameters of the delegate (e.g. "SomeDelegate(int x)").
The format of the parameters will be determined by the other flags passed.
Shows the name and the signature of the delegate (e.g. "void SomeDelegate(int x)").
The format of the signature will be determined by the other flags passed.
Specifies how to display extension methods.
Displays the extension method based on its .
Displays the extension method in the form of an instance method.
For example, IEnumerable<TSource>.ElementAt<TSource>(int index).
Displays the extension method as a static method.
For example, Enumerable.ElementAt<TSource>(this IEnumerable<TSource> source, int index).
Exposes extension methods for displaying symbol descriptions.
Converts an immutable array of s to a string.
The array of parts.
The concatenation of the parts into a single string.
Converts an ArrayBuilder of s to a string.
The array of parts.
The concatenation of the parts into a single string.
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Determines if a flag is set on the enum.
The value to check.
An enum field that specifies the flag.
Whether the is set on the .
Describes the formatting rules that should be used when displaying symbols.
Formats a symbol description as in a C# compiler error message.
Formats a symbol description as in a C# compiler short error message.
Formats a symbol description as in a Visual Basic compiler error message.
Formats a symbol description as in a Visual Basic compiler short error message.
Formats the names of all types and namespaces in a fully qualified style (including the global alias).
The current behavior will not output the fully qualified style as expected for member symbols (such as properties) because memberOptions is not set.
For example, MyNamespace.MyClass.MyPublicProperty will return as MyPublicProperty.
The current behavior displayed here will be maintained for backwards compatibility.
Formats a symbol description in a form that suits .
A verbose format for displaying symbols (useful for testing).
A verbose format for displaying symbols (useful for testing).
this.QualifiedNameOnly = containingSymbol.QualifiedNameOnly + "." + this.Name
this.QualifiedNameArity = containingSymbol.QualifiedNameArity + "." + this.Name + "`" + this.Arity
A succinct format for displaying symbols.
The format used for displaying symbols when visualizing IL.
Used to normalize explicit interface implementation member names.
Only expected to be applied to interface types (and their type arguments).
Determines how the global namespace is displayed.
Determines how types are qualified (e.g. Nested vs Containing.Nested vs Namespace.Containing.Nested).
Determines how generics (on types and methods) should be described (i.e. the level of detail).
Determines how fields, properties, events, and methods are displayed.
Determines how parameters (of methods, properties/indexers, and delegates) are displayed.
Determines how delegates are displayed (e.g. name vs full signature).
Determines how extension methods are displayed.
Determines how properties are displayed.
For example, "Prop" vs "Prop { get; set; }" in C# or "Prop" vs. "ReadOnly Prop" in Visual Basic.
Determines how local variables are displayed.
Determines which kind keywords should be included when displaying symbols.
Determines other characteristics of how symbols are displayed.
Flags that can only be set within the compiler.
Constructs a new instance of accepting a variety of optional parameters.
The settings that determine how the global namespace is displayed.
The settings that determine how types are qualified (e.g. Nested vs Containing.Nested vs Namespace.Containing.Nested).
The settings that determine how generics (on types and methods) should be described (i.e. the level of detail).
The settings that determine how fields, properties, events, and methods are displayed.
The settings that determine how delegates are displayed (e.g. name vs full signature).
The settings that determine how extension methods are displayed.
The settings that determine how parameters (of methods, properties/indexers, and delegates) are displayed.
The settings that determine how properties are displayed.
For example, "Prop" vs "Prop { get; set; }" in C# or "Prop" vs. "ReadOnly Prop" in Visual Basic.
The settings that determine how local variables are displayed.
The settings that determine which kind keywords should be included when displaying symbols.
The settings that determine other characteristics of how symbols are displayed.
This version also accepts .
Creates a copy of the SymbolDisplayFormat but with replaced set of .
An object representing how miscellaneous symbols will be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with an additional set of .
An object specifying additional parameters for how miscellaneous symbols will be formatted.
A duplicate of the SymbolDisplayFormat, with an additional set of .
Creates a copy of the SymbolDisplayFormat without the specified .
An object specifying which parameters should not be applied to how miscellaneous symbols will be formatted.
A duplicate of the SymbolDisplayFormat, without the specified .
Creates a copy of the SymbolDisplayFormat but with replaced set of .
An object specifying how generic symbols will be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with an additional set of .
An object specifying additional parameters for how generic symbols will be formatted.
A duplicate of the SymbolDisplayFormat, with an additional set of .
Creates a copy of the SymbolDisplayFormat but with a set of stripped away from the original object.
An object specifying which parameters should not be applied to how generic symbols will be formatted.
A duplicate of the SymbolDisplayFormat, with a set of stripped away from the original object.
Creates a copy of the SymbolDisplayFormat but with replaced set of .
An object specifying how members will be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with an additional set of .
An object specifying additional parameters for how members will be formatted.
A duplicate of the SymbolDisplayFormat, with an additional set of .
Creates a copy of the SymbolDisplayFormat but with a set of stripped away from the original object.
An object specifying which parameters should not be applied to how members will be formatted.
A duplicate of the SymbolDisplayFormat, with a set of stripped away from the original object.
Creates a copy of the SymbolDisplayFormat but with replaced set of .
An object specifying parameters with which symbols belonging to kind keywords should be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with an additional set of .
An object specifying additional parameters with which symbols belonging to kind keywords should be formatted.
A duplicate of the SymbolDisplayFormat, with an additional set of .
Creates a copy of the SymbolDisplayFormat but with a set of stripped away from the original object.
The settings that determine other characteristics of how symbols are displayed.
A duplicate of the SymbolDisplayFormat, with a set of stripped away from the original object.
Creates a copy of the SymbolDisplayFormat but with replaced set of .
An object specifying how parameters should be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with an additional set of .
An object specifying additional parameters on how parameters should be formatted.
A duplicate of the SymbolDisplayFormat, with an additional set of .
Creates a copy of the SymbolDisplayFormat but with a set of stripped away from the original object.
An object specifying parameters that should not be applied when formatting parameters.
A duplicate of the SymbolDisplayFormat, with a set of stripped away from the original object.
Creates a copy of the SymbolDisplayFormat but with replaced .
An object specifying parameters on how namespace symbols should be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with replaced set of .
An object specifying parameters on how symbols belonging to locals should be formatted.
A duplicate of the SymbolDisplayFormat, with a replaced set of .
Creates a copy of the SymbolDisplayFormat but with an additional set of .
An object specifying additional parameters on how symbols belonging to locals should be formatted.
A duplicate of the SymbolDisplayFormat, with an additional set of .
Creates a copy of the SymbolDisplayFormat but with a set of stripped away from the original object.
An object specifying parameters that should not be applied when formatting symbols belonging to locals.
A duplicate of the SymbolDisplayFormat, with a set of stripped away from the original object.
Creates a copy of the SymbolDisplayFormat but with added set of .
Creates a copy of the SymbolDisplayFormat but with a set of stripped away from the original object.
Creates a copy of the SymbolDisplayFormat but with replaced set of .
Specifies the options for how generics are displayed in the description of a symbol.
Omits the type parameter list entirely.
Includes the type parameters.
For example, "Goo<T>" in C# or "Goo(Of T)" in Visual Basic.
Includes type parameters and constraints.
For example, "where T : new()" in C# or "Of T as New" in Visual Basic.
Includes in or out keywords before variant type parameters.
For example, "Goo<out T>" in C# or (Goo Of Out T" in Visual Basic.
Specifies the options for how to display the global namespace in the description of a symbol.
Any of these styles may be overridden by .
Omits the global namespace, unconditionally.
Omits the global namespace if it is being displayed as a containing symbol (i.e. not on its own).
Include the global namespace, unconditionally.
Specifies which kind keywords should be included when displaying symbols.
Omits all kind keywords.
Includes the namespace keyword before namespaces.
For example, "namespace System", rather than "System".
Includes the type keyword before types.
For example, "class C" in C# or "Structure S" in Visual Basic.
Include the member keyword before members (if one exists).
For example, "event D E" in C# or "Function MyFun()" in Visual Basic.
Specifies the options for how locals are displayed in the description of a symbol.
Shows only the name of the local.
For example, "x".
Shows the type of the local in addition to its name.
For example, "int x" in C# or "x As Integer" in Visual Basic.
Shows the constant value of the local, if there is one, in addition to its name.
For example "x = 1".
Includes the ref keyword for ref-locals and the scoped keyword for scoped locals.
Replaced by .
Includes the ref keyword for ref-locals and the scoped keyword for scoped locals.
Specifies the options for how members are displayed in the description of a symbol.
Includes only the name of the member.
Includes the (return) type of the method/field/property/event.
Includes the modifiers of the member. For example, "static readonly" in C# or "Shared ReadOnly" in Visual Basic.
Accessibility modifiers are controlled separately by .
Includes the accessibility modifiers of the member. For example, "public" in C# or "Public" in Visual Basic.
Includes the name of corresponding interface on members that explicitly implement interface members. For example, "IGoo.Bar { get; }".
This option has no effect in Visual Basic.
Includes the parameters of methods and properties/indexers.
See for finer-grained settings.
Includes the name of the type containing the member.
The format of the containing type is determined by .
Includes the value of the member if is a constant.
Includes the ref, ref readonly, ByRef keywords for ref-returning methods and properties/indexers.
Also includes the readonly keyword on methods, properties/indexers, and events due to the keyword
changing the this parameter's ref kind from ref to ref readonly.
Specifies miscellaneous options about the format of symbol descriptions.
Specifies that no miscellaneous options should be applied.
Uses keywords for predefined types.
For example, "int" instead of "System.Int32" in C#
or "Integer" instead of "System.Integer" in Visual Basic.
Escapes identifiers that are also keywords.
For example, "@true" instead of "true" in C# or
"[True]" instead of "True" in Visual Basic.
Displays asterisks between commas in multi-dimensional arrays.
For example, "int[][*,*]" instead of "int[][,]" in C# or
"Integer()(*,*)" instead of "Integer()(*,*) in Visual Basic.
Displays "?" for erroneous types that lack names (perhaps due to faulty metadata).
Displays attributes names without the "Attribute" suffix, if possible.
Has no effect outside and only applies
if the context location is one where an attribute ca be referenced without the suffix.
Displays as a normal generic type, rather than with
the special question mark syntax.
Append '?' to nullable reference types.
Allow the use of default instead of default(T) where applicable.
Append '!' to non-nullable reference types.
Insert a tuple into the display parts as a single part instead of multiple parts (similar
to how anonymous types are inserted).
Displays as a normal generic type, rather than with the special
parenthetical syntax (e.g. ValueTuple<int, string>
instead of (int, string)
)
Specifies how parameters are displayed in the description of a (member, property/indexer, or delegate) symbol.
Omits parameters from symbol descriptions.
If this option is combined with , then only
the parentheses will be shown (e.g. M()).
Includes the this keyword before the first parameter of an extension method in C#.
This option has no effect in Visual Basic.
Includes the params, scoped, ref, in, out, ByRef, ByVal keywords before parameters.
Replaced by .
Includes the params, scoped, ref, in, out, ByRef, ByVal keywords before parameters.
Includes parameter types in symbol descriptions.
Includes parameter names in symbol descriptions.
Includes parameter default values in symbol descriptions.
Ignored if is not set.
Includes square brackets around optional parameters.
A single element of a symbol description. For example, a keyword, a punctuation character or
a class name.
Gets the kind of this display part.
Gets the symbol associated with this display part, if there is one.
For example, the associated with a class name.
Construct a non-formattable (i.e. with a fixed string value).
The kind of the display part.
An optional associated symbol.
The fixed string value of the part.
Returns the string value of this symbol display part.
Specifies the kinds of a piece of classified text (SymbolDisplayPart).
The name of an alias.
The name of an assembly.
The name of a class.
The name of a delegate.
The name of an enum.
The name of an error type.
The name of an event.
The name of a field.
The name of an interface.
A language keyword.
The name of a label.
A line-break (i.e. whitespace).
A numeric literal.
Typically for the default values of parameters and the constant values of fields.
A string literal.
Typically for the default values of parameters and the constant values of fields.
The name of a local.
The name of a method.
The name of a module.
The name of a namespace.
The symbol of an operator (e.g. "+").
The name of a parameter.
The name of a property.
A punctuation character (e.g. "(", ".", ",") other than an .
A single space character.
The name of a struct (structure in Visual Basic).
A keyword-like part for anonymous types (not actually a keyword).
An unclassified part.
Never returned - only set in user-constructed parts.
The name of a type parameter.
The name of a query range variable.
The name of an enum member.
The name of a reduced extension method.
When an extension method is in it's non-reduced form it will be will be marked as MethodName.
The name of a field or local constant.
The name of a record class.
The name of a record struct.
Specifies the options for how properties are displayed in symbol descriptions.
Shows only the names of properties.
Indicates whether the property is readable and/or writable.
In C#, this is accomplished by including accessors.
In Visual Basic, this is accomplished by including the ReadOnly or WriteOnly
keyword, as appropriate.
Specifies how much qualification is used in symbol descriptions.
Shows only the name of the symbol.
Shows the name of the symbol and the names of all containing types.
Shows the name of the symbol the names of all containing types and namespaces.
Enumeration for common accessibility combinations.
No accessibility specified.
Only accessible where both protected and internal members are accessible
(more restrictive than , and ).
Only accessible where both protected and friend members are accessible
(more restrictive than , and ).
Accessible wherever either protected or internal members are accessible
(less restrictive than , and ).
Accessible wherever either protected or friend members are accessible
(less restrictive than , and ).
We should not see new anonymous types from source after we finished emit phase.
If this field is true, the collection is sealed; in DEBUG it also is used to check the assertion.
Collection of anonymous type templates is sealed
Parses one or two debug ids that the specified ends with.
Returns true if ends with one or two well-formed debug ids.
If two ids are present in the name then the first is and the second is .
Otherwise, if is true then the single parsed id is returned in ,
otherwise in .
Suffix of the metadata name following the suffix separator.
Is this a zero-based one-dimensional array, i.e. SZArray in CLR terms.
Gets the type of the elements stored in the array.
Gets the name of this assembly.
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.
Returns true if this field was declared as "volatile".
Field type.
True if the method is a source method implemented as an iterator.
Returns true if this method is an async method
Returns whether this method is generic; i.e., does it have any type parameters?
Returns true if this method has no return type; i.e., returns "void".
Handle of the method signature blob or nil if not a PE symbol.
Returns a constructed method given its type arguments.
The immediate type arguments to be replaced for type
parameters in the method.
For enum types, gets the underlying type. Returns null on all other
kinds of types.
Returns whether this namespace is the unnamed, global namespace that is
at the root of all namespaces.
The contents of the AssemblySignatureKeyAttribute
Interface implemented by the compiler's internal representation of a symbol.
An object implementing this interface might also implement (as is done in VB),
or the compiler's symbols might be wrapped to implement ISymbol (as is done in C#).
Gets the indicating what kind of symbol it is.
Gets the symbol name. Returns the empty string if unnamed.
Gets the name of a symbol as it appears in metadata.
Gets the metadata token associated with this symbol, or 0 if the symbol is not loaded from metadata.
Visibility of the member as emitted to the metadata.
Allows a symbol to support comparisons that involve child type symbols
Because TypeSymbol equality can differ based on e.g. nullability, any symbols that contain TypeSymbols can also differ in the same way
This call allows the symbol to accept a comparison kind that should be used when comparing its contained types
Gets the for the immediately containing symbol.
Gets the for the containing assembly. Returns null if the
symbol is shared across multiple assemblies.
Gets the for the containing module. Returns null if the
symbol is shared across multiple modules.
Gets the for the containing type. Returns null if the
symbol is not contained within a type.
Gets the for the nearest enclosing namespace. Returns null if the
symbol isn't contained in a namespace.
Gets a value indicating whether the symbol is the original definition. Returns false
if the symbol is derived from another symbol, by type substitution for instance.
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.
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.
Gets a indicating the declared accessibility for the symbol.
Returns NotApplicable if no accessibility is declared.
Gets a value indicating whether the symbol is static.
Gets a value indicating whether the symbol is virtual.
Gets a value indicating whether the symbol is an override of a base class symbol.
Gets a value indicating whether the symbol is abstract.
Gets a value indicating whether the symbol is defined externally.
Returns an instance associated with this symbol.
Returns an instance associated with this symbol.
In general, this API is not safe to use. Transition from symbols to Cci interfaces
should be handled by PEModuleBuilder translation layer. One relatively safe scenario
is to use it on a symbol that is a definition.
if this symbol has any location that is within . otherwise. Can be more efficient than iteration over all the as it will avoid an unnecessary array allocation.
Optional span. If present, the location of this symbol must be both inside
this tree and within the span passed in.
Synthesized symbol that implements a method body feature (iterator, async, lambda, etc.)
The symbol whose body lowering produced this synthesized symbol,
or null if the symbol is synthesized based on declaration.
True if this symbol body needs to be updated when the body is updated.
False if is null.
An enumerated value that identifies whether this type is an array, pointer, enum, and so on.
An enumerated value that identifies certain 'special' types such as .
Returns if the type is not special.
True if this type is known to be a reference type. It is never the case that
and both return true. However, for an unconstrained type
parameter, and will both return false.
True if this type is known to be a value type. It is never the case that
and both return true. However, for an unconstrained type
parameter, and will both return false.
Returns an instance associated with this symbol.
This API and should return the same object.
Default attribute usage for attribute types:
(a) Valid targets: AttributeTargets.All
(b) AllowMultiple: false
(c) Inherited: true
Information decoded from well-known custom attributes applied on an assembly.
Raw assembly version as specified in the AssemblyVersionAttribute, or Nothing if none specified.
If the string passed to AssemblyVersionAttribute contains * the version build and/or revision numbers are set to .
Returns data decoded from security attributes or null if there are no security attributes.
The attribute class.
The constructor on the attribute class.
Constructor arguments on the attribute.
Named (property value) arguments on the attribute.
Attribute is conditionally omitted if it is a source attribute and both the following are true:
(a) It has at least one applied conditional attribute AND
(b) None of conditional symbols are true at the attribute source location.
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 attributeArgCount.
NOTE: We don't allow early decoded attributes to have optional parameters.
Returns the value of a constructor argument as type .
Throws if no constructor argument exists or the argument cannot be converted to the type.
Returns named attribute argument with the given as type .
If there is more than one named argument with this name, it returns the last one.
If no named argument is found then the is returned.
The metadata property or field name. This name is case sensitive (both VB and C#).
SpecialType of the named argument.
Default value for the named argument.
For user defined attributes VB allows duplicate named arguments and uses the last value.
Dev11 reports an error for pseudo-custom attributes when emitting metadata. We don't.
Decode the arguments to ObsoleteAttribute. ObsoleteAttribute can have 0, 1 or 2 arguments.
Decode the arguments to DeprecatedAttribute. DeprecatedAttribute can have 3 or 4 arguments.
Decode the arguments to ExperimentalAttribute. ExperimentalAttribute has 0 arguments.
Used to determine if two instances are identical,
i.e. they have the same attribute type, attribute constructor and have identical arguments.
Information decoded from early well-known custom attributes applied on an event.
Information decoded from well-known custom attributes applied on an event.
Information decoded from early well-known custom attributes applied on a field.
Information decoded from well-known custom attributes applied on a field.
Returns marshalling data or null of MarshalAs attribute isn't applied on the field.
Information decoded from early well-known custom attributes applied on a method.
Information decoded from well-known custom attributes applied on a method.
Returns data decoded from security attributes or null if there are no security attributes.
Information decoded from well-known custom attributes applied on a module.
Information decoded from early well-known custom attributes applied on a parameter.
Information decoded from well-known custom attributes applied on a parameter.
Returns marshalling data or null of MarshalAs attribute isn't applied on the 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 method return value.
Returns marshalling data or null of MarshalAs attribute isn't applied on the return value.
Information decoded from early well-known custom attributes applied on a type.
Information decoded from well-known custom attributes applied on a type.
Returns data decoded from security attributes or null if there are no security attributes.
Represents a bag of custom attributes and the associated decoded well-known attribute data.
Instance representing sealed custom attribute bag with no attributes.
Returns a non-sealed custom attribute bag with null initialized , null initialized and uninitialized .
Sets the early decoded well-known attribute data on the bag in a thread safe manner.
Stored early decoded data is immutable and cannot be updated further.
Returns true if early decoded data were stored into the bag on this thread.
Sets the decoded well-known attribute data (except the early data) on the bag in a thread safe manner.
Stored decoded data is immutable and cannot be updated further.
Returns true if decoded data were stored into the bag on this thread.
Sets the bound attributes on the bag in a thread safe manner.
If store succeeds, it seals the bag and makes the bag immutable.
Returns true if bound attributes were stored into the bag on this thread.
Gets the stored bound attributes in the bag.
This property can only be accessed on a sealed bag.
Gets the decoded well-known attribute data (except the early data) in the bag.
This property can only be accessed on the bag after has been invoked.
Gets the early decoded well-known attribute data in the bag.
This property can only be accessed on the bag after has been invoked.
Return whether early decoded attribute data has been computed and stored on the bag and it is safe to access from this bag.
Return value of true doesn't guarantee that bound attributes or remaining decoded attribute data has also been initialized.
Return whether all decoded attribute data has been computed and stored on the bag and it is safe to access from this bag.
Return value of true doesn't guarantee that bound attributes have also been initialized.
Enum representing the current state of attribute binding/decoding for a corresponding CustomAttributeBag.
Bag has been created, but no decoded data or attributes have been stored.
CustomAttributeBag is in this state during early decoding phase.
Early decoded attribute data has been computed and stored on the bag, but bound attributes or remaining decoded attribute data is not stored.
Only can be accessed from this bag.
All decoded attribute data has been computed and stored on the bag, but bound attributes are not yet stored.
Both and can be accessed from this bag.
Bound attributes have been computed and stored on this bag.
CustomAttributeBag is completely initialized and immutable.
Contains common arguments to Symbol.DecodeWellKnownAttribute method in both the language compilers.
Object to store the decoded data from bound well-known attributes.
Created lazily only when some decoded data needs to be stored, null otherwise.
Gets or creates the decoded data object.
This method must be called only when some decoded data will be stored into it subsequently.
Returns true if some decoded data has been stored into .
Gets the stored decoded data.
Assumes is true.
Syntax of the attribute to decode. Might be null when the attribute information is not coming
from syntax. For example, an assembly attribute propagated from added module to the resulting assembly.
Bound attribute to decode.
The index of the attribute in the list of attributes to decode.
Total count of attributes to decode.
Diagnostic bag.
Specific part of the symbol to which the attributes apply, or AttributeLocation.None if the attributes apply to the symbol itself.
Used e.g. for return type attributes of a method symbol.
Contains common arguments to Symbol.EarlyDecodeWellKnownAttribute method in both the language compilers.
Object to store the decoded data from early bound well-known attributes.
Created lazily only when some decoded data needs to be stored, null otherwise.
Gets or creates the decoded data object.
This method must be called only when some decoded data will be stored into it subsequently.
Returns true if some decoded data has been stored into .
Gets the stored decoded data.
Assumes is true.
Binder to bind early well-known attributes.
Bound type of the attribute to decode.
Syntax of the attribute to decode.
Specific part of the symbol to which the attributes apply, or AttributeLocation.None if the attributes apply to the symbol itself.
Used e.g. for return type attributes of a method symbol.
Base class for storing information decoded from early well-known custom attributes.
CONSIDER: Should we remove this class and let the sub-classes derived from WellKnownAttributeData?
Information decoded from .
Returns an instance of with all types replaced by types returned by specified translator.
Returns this instance if it doesn't hold on any types.
Information decoded from .
True if an error should be thrown for the . Default is false in which case
a warning is thrown.
The message that will be shown when an error/warning is created for .
The custom diagnostic ID to use for obsolete diagnostics.
If null, diagnostics are produced using the compiler default diagnostic IDs.
The custom help URL format string for obsolete diagnostics.
Expected to contain zero or one format items.
When specified, the obsolete diagnostic's will be produced
by formatting this string using the as the single argument.
e.g. with a value "TEST1",
and a value ,
the diagnostic will have the HelpLinkUri .
Information decoded from security attributes, i.e. attributes derived from well-known SecurityAttribute, applied on a method/type/assembly.
Used for retrieving applied source security attributes, i.e. attributes derived from well-known SecurityAttribute.
Base class for storing information decoded from well-known custom attributes.
Used to distinguish cases when attribute is applied with null value and when attribute is not applied.
For some well-known attributes, the latter case will return string stored in
field.
If true, a language may use the modified storage location without
being aware of the meaning of the modification, modopt vs. modreq.
A type used as a tag that indicates which type of modification applies.
Represents a using alias (Imports alias in Visual Basic).
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the for the
namespace or type referenced by the alias.
Represents an array.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the number of dimensions of this 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.
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.
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 (Nothing in VB) array is returned in this case.
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.
Gets the type of the elements stored in the array.
Gets the top-level nullability of the elements stored in the array.
Custom modifiers associated with the array type, or an empty array if there are none.
Represents a .NET assembly, consisting of one or more modules.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
True if the assembly contains interactive code.
Gets the name of this 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.
Gets the modules in this assembly. (There must be at least one.) The first one is the main module
that holds the assembly manifest.
Gets the set of type identifiers from this assembly.
Gets the set of namespace names from this assembly.
Gets a value indicating whether this assembly gives
access to internal symbols
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.
Determines if the assembly might contain extension methods.
If false, the assembly does not contain extension methods.
Returns the type symbol for a forwarded type based 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.
Returns type symbols for top-level (non-nested) types forwarded by this assembly.
If this symbol represents a metadata assembly returns the underlying .
Otherwise, this returns .
A symbol representing a discarded value, e.g. a symbol in the result of
GetSymbolInfo for _ in M(out _) or (x, _) = e.
The type of the discarded value.
The top-level nullability of the discarded value.
Represents the 'dynamic' type in C#.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
An IErrorTypeSymbol 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 IErrorTypeSymbol is returned when asking the field "x" what it's type is.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
When constructing this type, 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.
This only applies if this INamedTypeSymbol has TypeKind TypeKind.Error.
If not, an empty ImmutableArray is returned.
If CandidateSymbols returns one or more symbols, returns the reason that those
symbols were not chosen. Otherwise, returns None.
Represents an event.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The type of the event.
The top-level nullability of the event.
Returns true if the event is a WinRT type event.
The 'add' accessor of the event. Null only in error scenarios.
The 'remove' accessor of the event. Null only in error scenarios.
The 'raise' accessor of the event. Null if there is no raise method.
The original definition of the event. If the event is constructed from another
symbol by type substitution, OriginalDefinition gets the original symbol, as it was
defined in source or metadata.
Returns the overridden event, or null.
Returns interface properties explicitly implemented by this event.
Properties imported from metadata can explicitly implement more than one event.
Represents a field in a class, struct or enum.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
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 "const" (i.e. is a constant declaration).
Also returns true for an enum member.
Returns true if this field was declared as "readonly".
Returns true if this field was declared as "volatile".
True if this field is required to be set in an object initializer during construction.
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 or there is an error (such as a bad constant value in source), FixedSize is 0.
Note that for 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.
Returns the RefKind of the field.
Custom modifiers associated with the ref modifier, or an empty array if there are none.
Gets the type of this field.
Gets the top-level nullability of this field.
Returns false if the field wasn't declared as "const", or constant value was omitted or erroneous.
True otherwise.
Gets the constant value of this field
Returns custom modifiers associated with the field, or an empty array if there are none.
Get the original definition of this symbol. If this symbol is derived from another
symbol by (say) type substitution, this gets the original symbol, as it was defined in
source or metadata.
If this field represents a tuple element, returns a corresponding default element field.
Otherwise returns null.
A tuple type will always have default elements such as Item1, Item2, Item3...
This API allows matching a field that represents a named element, such as "Alice"
to the corresponding default element field such as "Item1"
Returns true if this field represents a tuple element which was given an explicit name.
Represents a function pointer type such as "delegate*<void>".
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the signature of the function pointed to by an instance of the function pointer type.
Represents a label in method body
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the immediately containing of this .
Represents a local variable in method body.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the type of this local variable.
Gets the top-level nullability of this local variable.
Returns true if this local variable was declared as "const" (i.e. is a constant declaration).
Also returns true for an enum member.
Returns true if this local is a ref local or a ref readonly local.
Use to get more detailed information.
Whether the variable is a ref or ref readonly local.
Returns the scoped kind of the local.
Returns false if the local variable wasn't declared as "const", or constant value was omitted or erroneous.
True otherwise.
Gets the constant value of this local variable.
Returns true if this local variable is function return variable whose name is the function's name,
whose type is the return type of the function and whose initial value is the default of its type.
Is always false for the C# local variable
Returns true if the local variable is declared with fixed-pointer-initializer (in unsafe context).
Returns true if this local variable is declared as iteration variable
Returns true if the local variable is declared in resource-acquisition of a 'using statement';
otherwise false
using (var localVariable = new StreamReader(path)) { ... }
Represents a method or method-like symbol (including constructor,
destructor, operator, or property/event accessor).
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
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 method is an extension method.
Returns true if this method is an async method
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 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 true if this method has no return type; i.e., returns "void".
Returns true if this method returns by reference.
Returns true if this method returns by ref readonly.
Returns the RefKind of the method.
Gets the return type of the method.
Gets the top-level nullability of the return type of the method.
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 top-level nullability of the type arguments that have been substituted
for the type parameters. If nothing has been substituted for a given type parameter,
then is returned.
Get the type parameters on this method. If the method has not generic,
returns an empty list.
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).
Indicates whether the method is readonly,
i.e. whether the 'this' receiver parameter is 'ref readonly'.
Returns true for readonly instance methods and accessors
and for reduced extension methods with a 'this in' parameter.
Returns true for 'init' set accessors, and false otherwise.
Get the original definition of this symbol. If this symbol is derived from another
symbol by (say) type substitution, this gets the original symbol, as it was defined in
source or metadata.
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.
If this method can be applied to an object, returns the type of object it is applied to.
If this method can be applied to an object, returns the top-level nullability of the object it is applied to.
If this method is a reduced extension method, returns the definition of extension
method from which this was reduced. Otherwise, returns null.
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.
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.
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.
Returns the list of custom modifiers, if any, associated with the return type.
Custom modifiers associated with the ref modifier, or an empty array if there are none.
Returns the list of custom attributes, if any, associated with the returned value.
The calling convention enum of the method symbol.
Modifier types that are considered part of the calling convention of this method, if the is
and the is . If this is not a function pointer signature or the calling convention is
not unmanaged, this is an empty array. Order and duplication of these modifiers reflect source/metadata order and duplication, whichever this symbol came from.
Returns a symbol (e.g. property, event, etc.) associated with the method.
If this method has of or ,
returns the property that this method is the getter or setter for.
If this method has of or ,
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 a constructed method given its type arguments.
The immediate type arguments to be replaced for type
parameters in the method.
Returns a constructed method given its type arguments and type argument nullable annotations.
If this is a partial method implementation part, returns the corresponding
definition part. Otherwise null.
If this is a partial method declaration without a body, and the method is
implemented with a body, returns that implementing definition. Otherwise
null.
Returns the implementation flags for the given method symbol.
Return true if this is a partial method definition without a body. If there
is an implementing body, it can be retrieved with .
Platform invoke information, or null if the method isn't a P/Invoke.
If this method is a Lambda method (MethodKind = MethodKind.LambdaMethod) and
there is an anonymous delegate associated with it, returns this delegate.
Returns null if the symbol is not a lambda or if it does not have an
anonymous delegate associated with it.
Returns a flag indicating whether this symbol has at least one applied/inherited conditional attribute.
Represents a module within an assembly. Every assembly contains one or more modules.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
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.
Given a namespace symbol, returns the corresponding module specific namespace symbol
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 AssemblySymbol objects corresponding to assemblies referenced
by this module. Items at the same position from ReferencedAssemblies and
from ReferencedAssemblySymbols correspond to each other.
If this symbol represents a metadata module returns the underlying .
Otherwise, this returns .
Represents a type other than an array, a pointer, a type parameter.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Returns the arity of this type, or the number of type parameters it takes.
A non-generic type has zero arity.
True if this type or some containing type has type parameters.
True if this is a reference to an unbound generic type. 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.
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).
Specifies that the class or interface is imported from another module. See
and
Indicates the type is declared in source and is only visible in the file it is declared in.
Returns collection of names of members declared within this type.
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 considered the type argument.
Returns the top-level nullability of the type arguments that have been substituted
for the type parameters. If nothing has been substituted for a given type parameter,
then is returned for that type argument.
Returns custom modifiers for the type argument that has been substituted for the type parameter.
The modifiers correspond to the type argument at the same ordinal within the
array. Returns an empty array if there are no modifiers.
Get the original definition of this type symbol. If this symbol is derived from another
symbol by (say) type substitution, this gets the original symbol, as it was defined in
source or metadata.
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.
For enum types, gets the underlying type. Returns null on all other
kinds of types.
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).
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 and type argument nullable annotations.
Returns an unbound generic type of this named type.
Get the instance constructors for this type.
Get the static constructors for this type.
Get the both instance and static constructors for this type.
For implicitly declared delegate types returns the EventSymbol that caused this
delegate type to be generated.
For all other types returns null.
Note, the set of possible associated symbols might be expanded in the future to
reflect changes in the languages.
Determines if the symbol might contain extension methods.
If false, the symbol does not contain extension methods.
If this is a tuple type with element names, returns the symbol for the tuple type without names.
Otherwise, returns null.
The type argument corresponding to the type of the extension field (VT[8].Rest),
which is at the 8th (one based) position is always a symbol for another tuple,
rather than its underlying type.
Returns fields that represent tuple elements for types that are tuples.
If this type is not a tuple, then returns default.
True if the type is serializable (has Serializable metadata flag).
If this is a native integer, returns the symbol for the underlying type,
either or .
Otherwise, returns null.
Represents either a namespace or a type.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
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.
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. If it is not a type, it must be a namespace.
Represents a namespace.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Get all the members of this symbol.
Get all the members of this symbol that have a particular name.
Get all the members of this symbol that are namespaces.
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 is an assembly or compilation namespace, 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.
Represents a parameter of a method or property.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Whether the parameter passed by value or by reference.
Returns the scoped kind of the parameter.
Returns true if the parameter was declared as a parameter array or as a parameter collection.
Returns true if the parameter was declared as a parameter array.
Returns true if the parameter was declared as a parameter collection.
Returns true if the parameter is optional.
Returns true if the parameter is the hidden 'this' ('Me' in Visual Basic) parameter.
Returns true if the parameter is a discard parameter.
Gets the type of the parameter.
Gets the top-level nullability of the parameter.
Custom modifiers associated with the parameter type, or an empty array if there are none.
Custom modifiers associated with the ref modifier, or an empty array if there are none.
Gets the ordinal position of the parameter. The first parameter has ordinal zero.
The 'this' parameter ('Me' in Visual Basic) has ordinal -1.
Returns true if the parameter specifies a default value to be passed
when no value is provided as an argument to a call. The default value
can be obtained with the property.
Returns the default value of the parameter.
Returns null if the parameter type is a struct and the default value of the parameter
is the default value of the struct type.
The parameter has no default value.
Get the original definition of this symbol. If this symbol is derived from another
symbol by (say) type substitution, this gets the original symbol, as it was defined in
source or metadata.
Represents a pointer type such as "int *". Pointer types
are used only in unsafe code.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the type of the storage location that an instance of the pointer type points to.
Custom modifiers associated with the pointer type, or an empty array if there are none.
Some managed languages may represent special information about the pointer type
as a custom modifier on either the pointer type or the element type, or
both.
Represents a preprocessing conditional compilation symbol.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a property or indexer.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Returns whether the property is really an indexer.
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.
True if this property is required to be set in an object initializer during construction.
Returns true if this property is an auto-created WithEvents property that takes place of
a field member when the field is marked as WithEvents.
Returns true if this property returns by reference.
Returns true if this property returns by reference a readonly variable.
Returns the RefKind of the property.
The type of the property.
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.
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.
The original definition of the property. If the property is constructed from another
symbol by type substitution, OriginalDefinition gets the original symbol, as it was
defined in source or metadata.
Returns the overridden property, or null.
Returns interface properties explicitly implemented by this property.
Properties imported from metadata can explicitly implement more than one property.
Custom modifiers associated with the ref modifier, or an empty array if there are none.
The list of custom modifiers, if any, associated with the type of the property.
If this is a partial property implementation part, returns the corresponding
definition part. Otherwise null.
If this is a partial property definition part, returns the corresponding
implementation part. Otherwise null.
Returns true if this is a partial definition part. Otherwise false.
Represents a range variable in a query expression.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a source assembly symbol exposed by the compiler.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Represents a symbol (namespace, class, method, parameter, etc.)
exposed by the compiler.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
Gets the indicating what kind of symbol it is.
Gets the source language ("C#" or "Visual Basic").
Gets the symbol name. Returns the empty string if unnamed.
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:
-
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).
-
The metadata name of explicit interface names have spaces removed, compared to
the name property.
-
The length of names is limited to not exceed metadata restrictions.
Gets the metadata token associated with this symbol, or 0 if the symbol is not loaded from metadata.
Gets the for the immediately containing symbol.
Gets the for the containing assembly. Returns null if the
symbol is shared across multiple assemblies.
Gets the for the containing module. Returns null if the
symbol is shared across multiple modules.
Gets the for the containing type. Returns null if the
symbol is not contained within a type.
Gets the for the nearest enclosing namespace. Returns null if the
symbol isn't contained in a namespace.
Gets a value indicating whether the symbol is the original definition. Returns false
if the symbol is derived from another symbol, by type substitution for instance.
Gets a value indicating whether the symbol is static.
Gets a value indicating whether the symbol is virtual.
Gets a value indicating whether the symbol is an override of a base class symbol.
Gets a value indicating whether the symbol is abstract.
Gets a value indicating whether the symbol is sealed.
Gets a value indicating whether the symbol is defined externally.
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.
The class and entry point method for top-level statements are not considered as implicitly declared.
Returns true if this symbol can be referenced by its name in code.
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.
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 IsImplicitlyDeclared 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
NamespaceDeclarationSyntax for N1.N2. For the global namespace, the declaring syntax will
be the CompilationUnitSyntax.
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.
Gets the attributes for the symbol. Returns an empty
if there are no attributes.
Gets a indicating the declared accessibility for the symbol.
Returns NotApplicable if no accessibility is declared.
Gets the for the original definition of the symbol.
If this symbol is derived from another symbol, by type substitution for instance,
this gets the original symbol, as it was defined in source or metadata.
Returns the Documentation Comment ID for the symbol, or null if the symbol doesn't
support documentation comments.
Gets the XML (as text) for the comment associated with the symbol.
Preferred culture or null for the default.
Optionally, expand <include> elements. No impact on non-source documentation comments.
Token allowing cancellation of request.
The XML that would be written to the documentation file for the symbol.
Converts the symbol to a string representation.
Format or null for the default.
A formatted string representation of the symbol.
Convert a symbol to an array of string parts, each of which has a kind. Useful for
colorizing the display string.
Formatting rules - null implies
SymbolDisplayFormat.ErrorMessageFormat.
A read-only array of string parts.
Convert a symbol to a string that can be displayed to the user. May be tailored to a
specific location in the source code.
Binding information (for determining names appropriate to
the context).
A position in the source code (context).
Formatting rules - null implies
SymbolDisplayFormat.MinimallyQualifiedFormat.
A formatted string that can be displayed to the user.
Convert a symbol to an array of string parts, each of which has a kind. May be tailored
to a specific location in the source code. Useful for colorizing the display string.
Binding information (for determining names appropriate to
the context).
A position in the source code (context).
Formatting rules - null implies
SymbolDisplayFormat.MinimallyQualifiedFormat.
A read-only array of string parts.
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 (for example, a pointer type)
- Method - parameter or return type is unsupported
- Field - type is unsupported
- Event - type is unsupported
- Property - type is unsupported
- Parameter - type is unsupported
Determines if this symbol is equal to another, according to the rules of the provided
The other symbol to compare against
The to use when comparing symbols
True if the symbols are equivalent.
Returns the constructed form of the ReducedFrom property,
including the type arguments that were either inferred during reduction or supplied at the call site.
Returns true if a given field is a default tuple element
Returns true if a given field is a tuple element
Return the name of the field if the field is an explicitly named tuple element.
Otherwise returns null.
Note that it is possible for an element to be both "Default" and to have a user provided name.
That could happen if the provided name matches the default name such as "Item10"
Given that an assembly with identity assemblyGrantingAccessIdentity granted access to assemblyWantingAccess,
check the public keys to ensure the internals-visible-to check should succeed. This is used by both the
C# and VB implementations as a helper to implement `bool IAssemblySymbol.GivesAccessTo(IAssemblySymbol toAssembly)`.
Represents a type parameter in a generic type or generic method.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
The ordinal position of the type parameter in the parameter list which declares
it. The first type parameter has ordinal zero.
The variance annotation, if any, of the type parameter declaration. Type parameters may be
declared as covariant (out), contravariant (in), or neither.
The type parameter kind of this type parameter.
The method that declares the type parameter, or null.
The type that declares the type parameter, or null.
True if the reference type constraint (class) was specified for the type parameter.
If is true, returns the top-level nullability of the
class constraint that was specified for the type parameter. If there was no class
constraint, this returns .
True if the value type constraint (struct) was specified for the type parameter.
True if the 'allows ref struct' constraint was specified for the type parameter.
True if the value type constraint (unmanaged) was specified for the type parameter.
True if the notnull constraint (notnull) was specified for the type parameter.
True if the parameterless constructor constraint (new()) was specified for the type parameter.
The types that were directly specified as constraints on the type parameter.
The top-level nullabilities that were directly specified as constraints on the
constraint types.
Get the original definition of this type symbol. If this symbol is derived from another
symbol by (say) type substitution, this 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.
Represents a type.
This interface is reserved for implementation by its associated APIs. We reserve the right to
change it in the future.
An enumerated value that identifies whether this type is an array, pointer, enum, and so on.
The declared base type of this type, or null. The object type, interface types,
and pointer types do not have a base type. The base type of a type parameter
is its effective base class.
Gets the set of interfaces that this type directly implements. This set does not include
interfaces that are base interfaces of directly implemented interfaces. This does
include the interfaces declared as constraints on type parameters.
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). This also is the effective
interface set of a type parameter. 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>.
True if this type is known to be a reference type. It is never the case that
and both return true. However, for an unconstrained type
parameter, and will both return false.
True if this type is known to be a value type. It is never the case that
and both return true. However, for an unconstrained type
parameter, and will both return false.
Is this a symbol for an anonymous type (including anonymous VB 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'.
The original definition of this symbol. If this symbol is constructed from another
symbol by type substitution then gets the original symbol as it was defined in
source or metadata.
An enumerated value that identifies certain 'special' types such as .
Returns if the type is not special.
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.
True if the type is ref-like, meaning it follows rules similar to CLR by-ref variables. False if the type
is not ref-like or if the language has no concept of ref-like types.
is a commonly used ref-like type.
True if the type is unmanaged according to language rules. False if managed or if the language
has no concept of unmanaged types.
True if the type is readonly.
For source symbols, true if the type is a record.
For metadata symbols, true if the type is a record and a reference type.
Returns false for record structs in metadata since they don't have any distinctive marker.
Converts an ITypeSymbol and a nullable flow state to a string representation.
The top-level nullability to use for formatting.
Format or null for the default.
A formatted string representation of the symbol with the given nullability.
Converts a symbol to an array of string parts, each of which has a kind. Useful
for colorizing the display string.
The top-level nullability to use for formatting.
Format or null for the default.
A read-only array of string parts.
Converts a symbol to a string that can be displayed to the user. May be tailored to a
specific location in the source code.
Binding information (for determining names appropriate to
the context).
The top-level nullability to use for formatting.
A position in the source code (context).
Formatting rules - null implies
A formatted string that can be displayed to the user.
Convert a symbol to an array of string parts, each of which has a kind. May be tailored
to a specific location in the source code. Useful for colorizing the display string.
Binding information (for determining names appropriate to
the context).
The top-level nullability to use for formatting.
A position in the source code (context).
Formatting rules - null implies
A read-only array of string parts.
Nullable annotation associated with the type, or if there are none.
Returns the same type as this type but with the given nullable annotation.
The nullable annotation to use
A class that provides constants for common language names.
The common name used for the C# language.
The common name used for the Visual Basic language.
The common name used for the F# language.
F# is not a supported compile target for the Roslyn compiler.
Enumeration of the possible "degrees of managed" for a type.
Enumeration for possible kinds of method symbols.
An anonymous method or lambda expression
Method is a constructor.
Method is a conversion.
Method is a delegate invoke.
Method is a destructor.
Method is an event add.
Method is an event raise.
Method is an event remove.
Method is an explicit interface implementation.
Method is an operator.
Method is an ordinary method.
Method is a property get.
Method is a property set.
An extension method with the "this" parameter removed.
Method is a static constructor.
A built-in operator.
Declare Sub or Function.
Method is declared inside of another method.
Method represents the signature of a function pointer type.
Describes the kind of the namespace extent.
The nullable annotation of the expression represented by the syntax node. This represents
the nullability of expressions that can be assigned to this expression, if this expression
can be used as an lvalue.
The nullable flow state of the expression represented by the syntax node. This represents
the compiler's understanding of whether this expression can currently contain null, if
this expression can be used as an rvalue.
Represents the nullability of values that can be assigned
to an expression used as an lvalue.
The expression has not been analyzed, or the syntax is
not an expression (such as a statement).
There are a few different reasons the expression could have not been analyzed:
- The symbol producing the expression comes from a method that has not been annotated, such as invoking a C# 7.3 or earlier method, or a method in this compilation that is in a disabled context.
- Nullable is completely disabled in this compilation.
The expression is not annotated (does not have a ?).
The expression is annotated (does have a ?).
Represents the compiler's analysis of whether an expression may be null
Syntax is not an expression, or was not analyzed.
Expression is not null.
Expression may be null.
This method directly converts a to a ,
ignoring the to which it is attached. It should only be used when converting
an RValue flow state to an RValue annotation for returning via the public API. For general use, please
use Microsoft.CodeAnalysis.CSharp.Symbols.TypeWithState.ToTypeWithAnnotations.
Information that describes how a method from the underlying Platform is to be invoked.
Module name. Null if value specified in the attribute is not valid.
Name of the native entry point or null if not specified (the effective name is the same as the name of the target method).
Controls whether the field causes the common language runtime
to search an unmanaged DLL for entry-point names other than the one specified.
Indicates how to marshal string parameters and controls name mangling.
Indicates whether the callee calls the SetLastError Win32 API function before returning from the attributed method.
Indicates the calling convention of an entry point.
Enables or disables best-fit mapping behavior when converting Unicode characters to ANSI characters.
Null if not specified (the setting for the containing type or assembly should be used, ).
Enables or disables the throwing of an exception on an unmappable Unicode character that is converted to an ANSI "?" character.
Null if not specified.
Denotes the kind of reference.
Indicates a "value" parameter or return type.
Indicates a "ref" parameter or return type.
Indicates an "out" parameter.
Indicates an "in" parameter.
Indicates a "ref readonly" return type.
Indicates a "ref readonly" parameter.
Enumeration for kinds of scoped modifiers.
Not scoped.
A ref scoped to the enclosing block or method.
A value scoped to the enclosing block or method.
Allows for the comparison of two instances
Compares two instances based on the default comparison rules, equivalent to calling .
Comparing string and string? will return equal. Use if you don't want them to be considered equal.
Compares two instances, considering that a reference type and the same nullable reference type are not equal.
Comparing string and string? will not return equal. Use if you want them to be considered equal.
Determines if two instances are equal according to the rules of this comparer
The first symbol to compare
The second symbol to compare
True if the symbols are equivalent
Specifies the possible kinds of symbols.
Symbol is an alias.
Symbol is an array type.
Symbol is an assembly.
Symbol is a dynamic type.
Symbol that represents an error
Symbol is an Event.
Symbol is a field.
Symbol is a label.
Symbol is a local.
Symbol is a method.
Symbol is a netmodule.
Symbol is a named type (e.g. class).
Symbol is a namespace.
Symbol is a parameter.
Symbol is a pointer type.
Symbol is a property.
Symbol is a range variable of a query expression.
Symbol is a type parameter.
Symbol is a preprocessing/conditional compilation constant.
Symbol represents a value that is discarded, e.g. in M(out _)
Symbol represents a function pointer type
Internal Symbol representing the inferred signature of
a lambda expression or method group.
Specifies the different kinds of comparison between types.
Represents a constant value used as an argument to a custom attribute.
The kind of the constant.
Returns the of the constant,
or null if the type can't be determined (error).
True if the constant represents a null reference.
The value for a non-array constant.
Unlike returns when the value is a symbol.
The value for a array.
Returns a ImmutableArray if was passed as the array value;
can be used to check for this.
TypedConstant isn't computing its own kind from the type symbol because it doesn't
have a way to recognize the well-known type System.Type.
Represents the kind of a TypedConstant.
Represents a simple value or a read-only array of .
True if the constant represents a null literal.
Enumeration for possible kinds of type symbols.
Type's kind is undefined.
Type is an array type.
Type is a class.
Type is a delegate.
Type is dynamic.
Type is an enumeration.
Type is an error type.
Type is an interface.
Type is a module.
Type is a pointer.
Type is a C# struct or VB Structure
Type is a C# struct or VB Structure
Type is a type parameter.
Type is an interactive submission.
Type is a function pointer.
Internal Symbol representing the inferred signature of
a lambda expression or method group.
Type layout information.
Layout kind (Layout flags in metadata).
Field alignment (PackingSize field in metadata).
Size of the type.
Represents the different kinds of type parameters.
Type parameter of a named type. For example: T in ]]>.
Type parameter of a method. For example: T in ()]]>.
Type parameter in a cref attribute in XML documentation comments. For example: T in ]]>.
An enumeration declaring the kinds of variance supported for generic type parameters.
Invariant.
Covariant (out).
Contravariant (in).
Specifies the member names known to the compiler (such as .ctor or op_Explicit).
Name of the enum backing field.
The name assigned to an instance constructor.
The name assigned to the static constructor.
The symbol name assigned to all indexers, other than explicit interface implementations.
Will not correspond to the name that appears in metadata.
The name assigned to the destructor.
The name assigned to the delegate Invoke method.
The name assigned to the delegate BeginInvoke method.
The name assigned to the delegate EndInvoke method.
The name of an entry point method.
The default fully qualified name of a Script class.
The name assigned to Object.ToString method.
The name assigned to Object.Equals method.
The name assigned to Object.GetHashCode method.
The name assigned to an implicit (widening) conversion.
The name assigned to an explicit (narrowing) conversion.
The name assigned to a checked explicit (narrowing) conversion.
The name assigned to the Addition operator.
The name assigned to the checked Addition operator.
The name assigned to the BitwiseAnd operator.
The name assigned to the BitwiseOr operator.
The name assigned to the Decrement operator.
The name assigned to the checked Decrement operator.
The name assigned to the Division operator.
The name assigned to the checked Division operator.
The name assigned to the Equality operator.
The name assigned to the ExclusiveOr operator.
The name assigned to the False operator.
The name assigned to the GreaterThan operator.
The name assigned to the GreaterThanOrEqual operator.
The name assigned to the Increment operator.
The name assigned to the checked Increment operator.
The name assigned to the Inequality operator.
The name assigned to the LeftShift operator.
The name assigned to the UnsignedLeftShift operator.
The name assigned to the LessThan operator.
The name assigned to the LessThanOrEqual operator.
The name assigned to the LogicalNot operator.
The name assigned to the LogicalOr operator.
The name assigned to the LogicalAnd operator.
The name assigned to the Modulus operator.
The name assigned to the Multiply operator.
The name assigned to the checked Multiply operator.
The name assigned to the OnesComplement operator.
The name assigned to the RightShift operator.
The name assigned to the UnsignedRightShift operator.
The name assigned to the Subtraction operator.
The name assigned to the checked Subtraction operator.
The name assigned to the True operator.
The name assigned to the UnaryNegation operator.
The name assigned to the checked UnaryNegation operator.
The name assigned to the UnaryPlus operator.
The name assigned to the Concatenate operator.
The name assigned to the Exponent operator.
The name assigned to the IntegerDivision operator.
The name assigned to the Like operator.
The required name for the GetEnumerator method used in a ForEach statement.
The required name for the GetAsyncEnumerator method used in a ForEach statement.
The required name for the MoveNextAsync method used in a ForEach-await statement.
The required name for the Deconstruct method used in a deconstruction.
The required name for the MoveNext method used in a ForEach statement.
The required name for the Current property used in a ForEach statement.
The required name for the property used in
a ForEach statement when the collection is a nullable struct.
The name for the Add method to be invoked for each element in a collection initializer expression
(see C# Specification, ยง7.6.10.3 Collection initializers).
The required name for the GetAwaiter method used to obtain an awaiter for a task
(see C# Specification, ยง7.7.7.1 Awaitable expressions).
The required name for the IsCompleted property used to determine if a task is already complete
(see C# Specification, ยง7.7.7.1 Awaitable expressions).
The required name for the GetResult method used to obtain the outcome of a task once it is complete
(see C# Specification, ยง7.7.7.1 Awaitable expressions).
The name of the method used to register a resumption delegate
(see C# Specification, ยง7.7.7.1 Awaitable expressions).
The required name for the Dispose method used in a Using statement.
The required name for the DisposeAsync method used in an await using statement.
The required name for the Count property used in a pattern-based Index or Range indexer.
The required name for the Length property used in a pattern-based Index or Range indexer.
The required name for the Slice method used in a pattern-based Range indexer.
The required name for the PrintMembers method that is synthesized in a record.
The name of an entry point method synthesized for top-level statements.
The name of a type synthesized for a top-level statements entry point method.
List of entries sorted in source order, each of which captures a
position in the supplied syntax tree and the set of diagnostics (warnings)
whose reporting should either be suppressed or enabled at this position.
Returns list of entries sorted in source order, each of which captures a
position in the supplied syntax tree and the set of diagnostics (warnings)
whose reporting should either be suppressed or enabled at this position.
Returns the reporting state for the supplied diagnostic id at the supplied position
in the associated syntax tree.
Gets the entry with the largest position less than or equal to supplied position.
Struct that represents an entry in the warning state map. Sorts by position in the associated syntax tree.
Gets the separator at the given index in this list.
The index.
WARN WARN WARN: This should be used with extreme caution - the underlying builder does
not give any indication that it is from a separated syntax list but the constraints
(node, token, node, token, ...) should still be maintained.
In order to avoid creating a separate pool of SeparatedSyntaxListBuilders, we expose
our underlying SyntaxListBuilder to SyntaxListPool.
Find the slot that contains the given offset.
The target offset. Must be between 0 and .
The slot index of the slot containing the given offset.
This implementation uses a binary search to find the first slot that contains
the given offset.
Adds to the end of this builder. No change happens if is
passed in.
Provides caching functionality for green nonterminals with up to 3 children.
Example:
When constructing a node with given kind, flags, child1 and child2, we can look up
in the cache whether we already have a node that contains same kind, flags,
child1 and child2 and use that.
For the purpose of children comparison, reference equality is used as a much cheaper
alternative to the structural/recursive equality. This implies that in order to de-duplicate
a node to a cache node, the children of two nodes must be already de-duplicated.
When adding a node to the cache we verify that cache does contain node's children,
since otherwise there is no reason for the node to be used.
Tokens/nulls are for this purpose considered deduplicated. Indeed most of the tokens
are deduplicated via quick-scanner caching, so we just assume they all are.
As a result of above, "fat" nodes with 4 or more children or their recursive parents
will never be in the cache. This naturally limits the typical single cache item to be
a relatively simple expression. We do not want the cache to be completely unbounded
on the item size.
While it still may be possible to store a gigantic nested binary expression,
it should be a rare occurrence.
We only consider "normal" nodes to be cacheable.
Nodes with diagnostics/annotations/directives/skipped, etc... have more complicated identity
and are not likely to be repetitive.
This is a SyntaxReference implementation that lazily translates the result (SyntaxNode) of the
original syntax reference to another one.
Creates a new node identical to this node with the specified annotations attached.
Original node.
Annotations to be added to the new node.
Creates a new node identical to this node with the specified annotations attached.
Original node.
Annotations to be added to the new node.
Creates a new node identical to this node with the specified annotations removed.
Original node.
Annotations to be removed from the new node.
Creates a new node identical to this node with the specified annotations removed.
Original node.
Annotations to be removed from the new node.
Creates a new node identical to this node with the annotations of the specified kind removed.
Original node.
The kind of annotation to remove.
Gets the number of children contained in the .
Gets the child at the specified index.
The zero-based index of the child to get.
is less than 0.-or- is equal to or greater than .
The green node slot index at which to start the search
Indicates the total number of occupants in preceding slots
Indicates the node start position plus any prior slot full widths
internal indexer that does not verify index.
Used when caller has already ensured that index is within bounds.
Locate the node or token that is a child of the given and contains the given position.
The to search.
The position.
The node or token that spans the given position.
Assumes that is within the span of .
internal indexer that does not verify index.
Used when caller has already ensured that index is within bounds.
Returns the first child in the list.
The first child in the list.
The list is empty.
Returns the last child in the list.
The last child in the list.
The list is empty.
Returns a list which contains all children of in reversed order.
which contains all children of in reversed order
Returns an enumerator that iterates through the .
A for the .
Determines whether the specified object is equal to the current instance.
true if the specified object is a structure and is equal to the current instance; otherwise, false.
The object to be compared with the current instance.
Determines whether the specified structure is equal to the current instance.
true if the specified structure is equal to the current instance; otherwise, false.
The structure to be compared with the current instance.
Returns the hash code for the current instance.
A 32-bit signed integer hash code.
Indicates whether two structures are equal.
true if is equal to ; otherwise, false.
The structure on the left side of the equality operator.
The structure on the right side of the equality operator.
Indicates whether two structures are unequal.
true if is equal to ; otherwise, false.
The structure on the left side of the inequality operator.
The structure on the right side of the inequality operator.
Enumerates the elements of a .
Advances the enumerator to the next element of the .
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
Gets the element at the current position of the enumerator.
The element in the at the current position of the enumerator.
Sets the enumerator to its initial position, which is before the first element in the collection.
Gets the element in the collection at the current position of the enumerator.
The element in the collection at the current position of the enumerator.
Gets the element in the collection at the current position of the enumerator.
The element in the collection at the current position of the enumerator.
Advances the enumerator to the next element of the collection.
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
Sets the enumerator to its initial position, which is before the first element in the collection.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Gets the element in the collection at the current position of the enumerator.
The element in the collection at the current position of the enumerator.
Gets the element in the collection at the current position of the enumerator.
The element in the collection at the current position of the enumerator.
Advances the enumerator to the next element of the collection.
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
The collection was modified after the enumerator was created.
Sets the enumerator to its initial position, which is before the first element in the collection.
The collection was modified after the enumerator was created.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Value used to indicate the slot count was too large to be encoded directly in our
value. Callers will have to store the value elsewhere and retrieve the full value themselves.
Called when returns a value of .
Enumerates all green nodes of the tree rooted by this node (including this node). This includes normal
nodes, list nodes, and tokens. The nodes will be returned in depth-first order. This will not descend
into trivia or structured trivia.
Find the slot that contains the given offset.
The target offset. Must be between 0 and .
The slot index of the slot containing the given offset.
The base implementation is a linear search. This should be overridden
if a derived class can implement it more efficiently.
Special flags a node can have. Note: while this is typed as being `ushort`, we can only practically use 12
of those 16 bits as we use the remaining 4 bits to store the slot count of a node.
If this node is missing or not. We use a non-zero value for the not-missing case so that this value
automatically merges upwards when building parent nodes. In other words, once we have one node that is
not-missing, all nodes above it are definitely not-missing as well.
If this node directly has annotations (not its descendants). can be
used to determine if a node or any of its descendants has annotations.
If this node, or any of its descendants has annotations attached to them.
If this node, or any of its descendants has attributes attached to it.
Add an error to the given node, creating a new node that is the same except it has no parent,
and has the given error attached to it. The error span is the entire span of this node.
The error to attach to this node
A new node, with no parent, that has this error added to it.
Since nodes are immutable, the only way to create nodes with errors attached is to create a node without an error,
then add an error with this method to create another node.
Combination of and stored in a single 16bit value.
4 bits for the SlotCount. This allows slot counts of 0-14 to be stored as a direct byte. All 1s
indicates that the slot count must be computed.
12 bits for the NodeFlags. This allows for up to 12 distinct bits to be stored to designate interesting
aspects of a node.
CCCCFFFFFFFFFFFF for Count bits then Flag bits.
Returns the slot count if it was small enough to be stored directly in this object. Otherwise, returns
to indicate it could not be directly stored.
Interface implemented by any node that is the root 'CompilationUnit' of a . i.e.
any node returned by where
is will implement this interface.
This interface provides a common way to both easily find the root of a
given any , as well as a common way for handling the special
that is needed to store all final trivia in a
that is not owned by any other .
Represents the end of the source file. This may have
(whitespace, comments, directives) attached to it.
Represents structured trivia that contains skipped tokens. This is implemented by
and
.
Represents the root node of a structured trivia tree (for example, a preprocessor directive
or a documentation comment). From this root node you can traverse back up to the containing
trivia in the outer tree that contains it.
Returns the parent trivia syntax for this structured trivia syntax.
The parent trivia syntax for this structured trivia syntax.
The LineDirectiveMap is created to enable translating positions, using the #line directives
in a file. The basic implementation creates an ordered array of line mapping entries, one
for each #line directive in the file (plus one at the beginning). If the file has no
directives, then the array has just one element in it. To map line numbers, a binary search
of the mapping entries is done and nearest line mapping is applied.
Determines whether the position is considered to be hidden from the debugger or not.
Combines TranslateSpan and IsHiddenPosition to not search the entries twice when emitting sequence points
Are there any hidden regions in the map?
True if there's at least one hidden region in the map.
The caller is expected to not call this if is empty.
Enum that describes the state related to the #line or #externalsource directives at a position in source.
Used in VB when the position is not hidden, but it's not known yet that there is a (nonempty) #ExternalSource
following.
Used in C# for spans preceding the first #line directive (if any) and for #line default spans
Used in C# for spans inside of #line linenumber directive
Used in C# for spans inside of #line (startLine, startChar) - (endLine, endChar) charOffset directive
Used in VB for spans inside of a #ExternalSource directive that followed an unknown span
Used in VB for spans inside of a #ExternalSource directive that followed a hidden span
Used in C# and VB for spans that are inside of #line hidden (C#) or outside of #ExternalSource (VB)
directives
Represents a line mapping defined by a single line mapping directive (#line in C# or #ExternalSource in VB).
The span in the syntax tree containing the line mapping directive.
The optional offset in the syntax tree for the line immediately following an enhanced #line directive in C#.
If the line mapping directive maps the span into an explicitly specified file the is true.
If the path is not mapped is empty and is false.
If the line mapping directive marks hidden code is false.
True if the line mapping marks hidden code.
The state of the visibility of a line.
The line is located before any #line directive and there is at least one #line directive present in this syntax tree.
This enum value is used for C# only to enable the consumer to define how to interpret the lines before the first
line directive.
The line is following a #line hidden directive.
The line is following a #line default directive or a #line directive with at least a line number.
If there is no line directive at all, Visible is returned for all lines.
Gets the separator at the given index in this list.
The index.
Returns the sequence of just the separator tokens.
The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements.
The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements.
Returns the string representation of the nodes in this list including separators but not including
the first node's leading trivia and the last node or token's trailing trivia.
The string representation of the nodes in this list including separators but not including
the first node's leading trivia and the last node or token's trailing trivia.
Returns the full string representation of the nodes in this list including separators,
the first node's leading trivia, and the last node or token's trailing trivia.
The full string representation of the nodes in this list including separators including separators,
the first node's leading trivia, and the last node or token's trailing trivia.
Creates a new list with the specified node added to the end.
The node to add.
Creates a new list with the specified nodes added to the end.
The nodes to add.
Creates a new list with the specified node inserted at the index.
The index to insert at.
The node to insert.
Creates a new list with the specified nodes inserted at the index.
The index to insert at.
The nodes to insert.
Creates a new list with the element at the specified index removed.
The index of the element to remove.
Creates a new list with specified element removed.
The element to remove.
Creates a new list with the specified element replaced by the new node.
The element to replace.
The new node.
Creates a new list with the specified element replaced by the new nodes.
The element to replace.
The new nodes.
Creates a new list with the specified separator token replaced with the new separator.
The separator token to be replaced.
The new separator token.
A SyntaxAnnotation is used to annotate syntax elements with additional information.
Since syntax elements are immutable, annotating them requires creating new instances of them
with the annotations attached.
A predefined syntax annotation that indicates whether the syntax element has elastic trivia.
A list of .
Creates a singleton list of syntax nodes.
The single element node.
Creates a list of syntax nodes.
A sequence of element nodes.
The number of nodes in the list.
Gets the node at the specified index.
The zero-based index of the node to get or set.
The node at the specified index.
The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements.
The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements.
Returns the string representation of the nodes in this list, not including
the first node's leading trivia and the last node's trailing trivia.
The string representation of the nodes in this list, not including
the first node's leading trivia and the last node's trailing trivia.
Returns the full string representation of the nodes in this list including
the first node's leading trivia and the last node's trailing trivia.
The full string representation of the nodes in this list including
the first node's leading trivia and the last node's trailing trivia.
Creates a new list with the specified node added at the end.
The node to add.
Creates a new list with the specified nodes added at the end.
The nodes to add.
Creates a new list with the specified node inserted at the index.
The index to insert at.
The node to insert.
Creates a new list with the specified nodes inserted at the index.
The index to insert at.
The nodes to insert.
Creates a new list with the element at specified index removed.
The index of the element to remove.
Creates a new list with the element removed.
The element to remove.
Creates a new list with the specified element replaced with the new node.
The element to replace.
The new node.
Creates a new list with the specified element replaced with new nodes.
The element to replace.
The new nodes.
The first node in the list.
The first node in the list or default if the list is empty.
The last node in the list.
The last node in the list or default if the list is empty.
True if the list has at least one node.
Get's the enumerator for this list.
The index of the node in this list, or -1 if the node is not in the list.
Represents a non-terminal node in the syntax tree. This is the language agnostic equivalent of and .
Used by structured trivia which has "parent == null", and therefore must know its
SyntaxTree explicitly when created.
An integer representing the language specific kind of this node.
The language name that this node is syntax of.
Returns that owns the node.
The absolute span of this node in characters, including its leading and trailing trivia.
The absolute span of this node in characters, not including its leading and trailing trivia.
Same as accessing on .
Slight performance improvement.
The width of the node in characters, not including leading and trailing trivia.
The Width property returns the same value as Span.Length, but is somewhat more efficient.
The complete width of the node in characters, including leading and trailing trivia.
The FullWidth property returns the same value as FullSpan.Length, but is
somewhat more efficient.
This works the same as GetRed, but intended to be used in lists
The only difference is that the public parent of the node is not the list,
but the list's parent. (element's grand parent).
special cased helper for 2 and 3 children lists where child #1 may map to a token
Returns the string representation of this node, not including its leading and trailing trivia.
The string representation of this node, not including its leading and trailing trivia.
The length of the returned string is always the same as Span.Length
Returns full string representation of this node including its leading and trailing trivia.
The full string representation of this node including its leading and trailing trivia.
The length of the returned string is always the same as FullSpan.Length
Writes the full text of this node to the specified .
Gets the full text of this node as a new instance.
Encoding of the file that the text was read from or is going to be saved to.
null if the encoding is unspecified.
If the encoding is not specified the isn't debuggable.
If an encoding-less is written to a file a shall be used as a default.
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
is not supported.
Determine whether this node is structurally equivalent to another.
Returns true if these two nodes are considered "incrementally identical". An incrementally identical node
occurs when a is incrementally parsed using
and the incremental parser is able to take the node from the original tree and use it in its entirety in the
new tree. In this case, the of each node will be the same, though
they could have different parents, and may occur at different positions in their respective trees. If two nodes are
incrementally identical, all children of each node will be incrementally identical as well.
Incrementally identical nodes can also appear within the same syntax tree, or syntax trees that did not arise
from . This can happen as the parser is allowed to construct parse
trees from shared nodes for efficiency. In all these cases though, it will still remain true that the incrementally
identical nodes could have different parents and may occur at different positions in their respective trees.
Determines whether the node represents a language construct that was actually parsed
from the source code. Missing nodes are generated by the parser in error scenarios to
represent constructs that should have been present in the source code in order to
compile successfully but were actually missing.
Determines whether this node is a descendant of a structured trivia.
Determines whether this node represents a structured trivia.
Determines whether a descendant trivia of this node is structured.
Determines whether this node has any descendant skipped text.
Determines whether this node or any of its descendant nodes, tokens or trivia have any diagnostics on them.
Determines whether this node has any descendant preprocessor directives.
Returns true if this node contains any directives (e.g. #if, #nullable, etc.) within it with a matching kind.
Determines if the specified node is a descendant of this node.
Returns true for current node.
Determines whether this node has any leading trivia.
Determines whether this node has any trailing trivia.
Gets a node at given node index without forcing its creation.
If node was not created it would return null.
This function calculates the offset of a child at given position. It is very common that
some children to the left of the given index already know their positions so we first
check if that is the case. In a worst case the cost is O(n), but it is not generally an
issue because number of children in regular nodes is fixed and small. In a case where
the number of children could be large (lists) this function is overridden with more
efficient implementations.
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 a for this syntax node. CommonSyntaxReferences can be used to
regain access to a syntax node without keeping the entire tree and source text in
memory.
The node that contains this node in its collection.
The list of child nodes and tokens of this node, where each element is a SyntaxNodeOrToken instance.
Gets node at given node index.
This WILL force node creation if node has not yet been created.
Can still return null for invalid slot numbers
Gets a list of the child nodes in prefix document order.
Gets a list of ancestor nodes
Gets a list of ancestor nodes (including this node)
Gets the first node of type TNode that matches the predicate.
Gets the first node of type TNode that matches the predicate.
Gets a list of descendant nodes in prefix document order.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of descendant nodes in prefix document order.
The span the node's full span must intersect.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of descendant nodes (including this node) in prefix document order.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of descendant nodes (including this node) in prefix document order.
The span the node's full span must intersect.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of descendant nodes and tokens in prefix document order.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of the descendant nodes and tokens in prefix document order.
The span the node's full span must intersect.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of descendant nodes and tokens (including this node) in prefix document order.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Gets a list of the descendant nodes and tokens (including this node) in prefix document order.
The span the node's full span must intersect.
An optional function that determines if the search descends into the argument node's children.
Determines if nodes that are part of structured trivia are included in the list.
Finds the node with the smallest that contains .
is used to determine the behavior in case of a tie (i.e. a node having the same span as its parent).
If is true, then it returns lowest descending node encompassing the given .
Otherwise, it returns the outermost node encompassing the given .
TODO: This should probably be reimplemented with
This exception is thrown if doesn't contain the given span.
Finds a descendant token of this node whose span includes the supplied position.
The character position of the token relative to the beginning of the file.
True to return tokens that are part of trivia. If false finds the token whose full span (including trivia)
includes the position.
Gets the first token of the tree rooted by this node. Skips zero-width tokens.
The first token or default(SyntaxToken) if it doesn't exist.
Gets the last token of the tree rooted by this node. Skips zero-width tokens.
The last token or default(SyntaxToken) if it doesn't exist.
Gets a list of the direct child tokens of this node.
Gets a list of all the tokens in the span of this node.
Gets a list of all the tokens in the full span of this node.
The list of trivia that appears before this node in the source code and are attached to a token that is a
descendant of this node.
The list of trivia that appears after this node in the source code and are attached to a token that is a
descendant of this 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.
True to return tokens that are part of trivia. If false finds the token whose full span (including trivia)
includes the position.
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.
Get a list of all the trivia associated with the descendant nodes and tokens.
Get a list of all the trivia associated with the descendant nodes and tokens.
Determines whether this node or any sub node, token or trivia has annotations.
Determines whether this node has any annotations with the specific annotation kind.
Determines whether this node has any annotations with any of the specific annotation kinds.
Determines whether this node has the specific annotation.
Gets all the annotations with the specified annotation kind.
Gets all the annotations with the specified annotation kinds.
Gets all nodes and tokens with an annotation of the specified annotation kind.
Gets all nodes and tokens with an annotation of the specified annotation kinds.
Gets all nodes and tokens with the specified annotation.
Gets all nodes with the specified annotation.
Gets all nodes with the specified annotation kind.
Gets all tokens with the specified annotation.
Gets all tokens with the specified annotation kind.
Gets all trivia with an annotation of the specified annotation kind.
Gets all trivia with an annotation of the specified annotation kinds.
Gets all trivia with the specified annotation.
Copies all SyntaxAnnotations, if any, from this SyntaxNode instance and attaches them to a new instance based on .
If no annotations are copied, just returns .
It can also be used manually to preserve annotations in a more complex tree
modification, even if the type of a node changes.
Determines if two nodes are the same, disregarding trivia differences.
The node to compare against.
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.
Serializes the node to the given .
Leaves the open for further writes.
Specialized exception subtype to make it easier to search telemetry streams for this specific case.
Determine if this node is structurally equivalent to another.
Returns SyntaxTree that owns the node. If the node does not belong to a tree then
one will be generated.
Finds a descendant token of this node whose span includes the supplied position.
The character position of the token relative to the beginning of the file.
True to return tokens that are part of trivia.
If false finds the token whose full span (including trivia) includes the position.
Finds a descendant token of this node whose span includes the supplied position.
The character position of the token relative to the beginning of the file.
Applied on every structured trivia. Return false if the tokens included in the trivia should be skipped.
Pass null to skip all structured trivia.
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.
Creates a new tree of nodes with the specified nodes, tokens or trivia replaced.
Creates a new tree of nodes with the specified node removed.
Determines if two nodes are the same, disregarding trivia differences.
The node to compare against.
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.
Whether or not this parent node wants its child SyntaxList node to be
converted to a Weak-SyntaxList when creating the red-node equivalent.
For example, in C# the statements of a Block-Node that is parented by a
MethodDeclaration will be held weakly.
Creates a clone of a red node that can be used as a root of given syntaxTree.
New node has no parents, position == 0, and syntaxTree as specified.
Creates a new tree of nodes with the specified nodes, tokens and trivia replaced.
The type of the root node.
The root node of the tree of nodes.
The nodes to be replaced.
A function that computes a replacement node for the
argument nodes. The first argument is the original node. The second argument is the same
node potentially rewritten with replaced descendants.
The tokens to be replaced.
A function that computes a replacement token for
the argument tokens. The first argument is the original token. The second argument is
the same token potentially rewritten with replaced trivia.
The trivia to be replaced.
A function that computes replacement trivia for
the specified arguments. The first argument is the original trivia. The second argument is
the same trivia with potentially rewritten sub structure.
Creates a new tree of nodes with the specified old node replaced with a new node.
The type of the root node.
The type of the nodes being replaced.
The root node of the tree of nodes.
The nodes to be replaced; descendants of the root node.
A function that computes a replacement node for the
argument nodes. The first argument is the original node. The second argument is the same
node potentially rewritten with replaced descendants.
Creates a new tree of nodes with the specified old node replaced with a new node.
The type of the root node.
The root node of the tree of nodes.
The node to be replaced; a descendant of the root node.
The new node to use in the new tree in place of the old node.
Creates a new tree of nodes with specified old node replaced with a new nodes.
The type of the root node.
The root of the tree of nodes.
The node to be replaced; a descendant of the root node and an element of a list member.
A sequence of nodes to use in the tree in place of the old node.
Creates a new tree of nodes with new nodes inserted before the specified node.
The type of the root node.
The root of the tree of nodes.
The node to insert before; a descendant of the root node an element of a list member.
A sequence of nodes to insert into the tree immediately before the specified node.
Creates a new tree of nodes with new nodes inserted after the specified node.
The type of the root node.
The root of the tree of nodes.
The node to insert after; a descendant of the root node an element of a list member.
A sequence of nodes to insert into the tree immediately after the specified node.
Creates a new tree of nodes with the specified old token replaced with new tokens.
The type of the root node.
The root of the tree of nodes.
The token to be replaced; a descendant of the root node and an element of a list member.
A sequence of tokens to use in the tree in place of the specified token.
Creates a new tree of nodes with new tokens inserted before the specified token.
The type of the root node.
The root of the tree of nodes.
The token to insert before; a descendant of the root node and an element of a list member.
A sequence of tokens to insert into the tree immediately before the specified token.
Creates a new tree of nodes with new tokens inserted after the specified token.
The type of the root node.
The root of the tree of nodes.
The token to insert after; a descendant of the root node and an element of a list member.
A sequence of tokens to insert into the tree immediately after the specified token.
Creates a new tree of nodes with the specified old trivia replaced with new trivia.
The type of the root node.
The root of the tree of nodes.
The trivia to be replaced; a descendant of the root node.
A sequence of trivia to use in the tree in place of the specified trivia.
Creates a new tree of nodes with new trivia inserted before the specified trivia.
The type of the root node.
The root of the tree of nodes.
The trivia to insert before; a descendant of the root node.
A sequence of trivia to insert into the tree immediately before the specified trivia.
Creates a new tree of nodes with new trivia inserted after the specified trivia.
The type of the root node.
The root of the tree of nodes.
The trivia to insert after; a descendant of the root node.
A sequence of trivia to insert into the tree immediately after the specified trivia.
Creates a new tree of nodes with the specified old node replaced with a new node.
The type of the root node.
The root node of the tree of nodes.
The token to be replaced; descendants of the root node.
A function that computes a replacement token for
the argument tokens. The first argument is the original token. The second argument is
the same token potentially rewritten with replaced trivia.
Creates a new tree of nodes with the specified old token replaced with a new token.
The type of the root node.
The root node of the tree of nodes.
The token to be replaced.
The new token to use in the new tree in place of the old
token.
Creates a new tree of nodes with the specified trivia replaced with new trivia.
The type of the root node.
The root node of the tree of nodes.
The trivia to be replaced; descendants of the root node.
A function that computes replacement trivia for
the specified arguments. The first argument is the original trivia. The second argument is
the same trivia with potentially rewritten sub structure.
Creates a new tree of nodes with the specified trivia replaced with new trivia.
The type of the root node.
The root node of the tree of nodes.
The trivia to be replaced.
The new trivia to use in the new tree in place of the old trivia.
Creates a new tree of nodes with the specified node removed.
The type of the root node.
The root node from which to remove a descendant node from.
The node to remove.
Options that determine how the node's trivia is treated.
New root or null if the root node itself is removed.
Creates a new tree of nodes with the specified nodes removed.
The type of the root node.
The root node from which to remove a descendant node from.
The nodes to remove.
Options that determine how the nodes' trivia is treated.
Creates a new syntax node with all whitespace and end of line trivia replaced with
regularly formatted trivia.
The type of the node.
The node to format.
A sequence of whitespace characters that defines a single level of indentation.
If true the replaced trivia is elastic trivia.
Creates a new syntax node with all whitespace and end of line trivia replaced with
regularly formatted trivia.
The type of the node.
The node to format.
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 node from this node with both the leading and trailing trivia of the specified node.
Creates a new node from this node without leading or trailing trivia.
Creates a new token from this token without leading or trailing trivia.
Creates a new node from this node with the leading trivia replaced.
Creates a new node from this node with the leading trivia replaced.
Creates a new node from this node with the leading trivia removed.
Creates a new node from this node with the leading trivia replaced.
Creates a new node from this node with the trailing trivia replaced.
Creates a new node from this node with the trailing trivia replaced.
Creates a new node from this node with the trailing trivia removed.
Creates a new node from this node with the trailing trivia replaced.
Attaches the node to a SyntaxTree that the same options as
Creates a new tree of nodes with the specified nodes being tracked.
Use GetCurrentNode on the subtree resulting from this operation, or any transformation of it,
to get the current node corresponding to the original tracked node.
The root of the subtree containing the nodes to be tracked.
One or more nodes that are descendants of the root node.
Creates a new tree of nodes with the specified nodes being tracked.
Use GetCurrentNode on the subtree resulting from this operation, or any transformation of it,
to get the current node corresponding to the original tracked node.
The root of the subtree containing the nodes to be tracked.
One or more nodes that are descendants of the root node.
Gets the nodes within the subtree corresponding to the original tracked node.
Use TrackNodes to start tracking nodes.
The root of the subtree containing the current node corresponding to the original tracked node.
The node instance originally tracked.
Gets the node within the subtree corresponding to the original tracked node.
Use TrackNodes to start tracking nodes.
The root of the subtree containing the current node corresponding to the original tracked node.
The node instance originally tracked.
Gets the nodes within the subtree corresponding to the original tracked nodes.
Use TrackNodes to start tracking nodes.
The root of the subtree containing the current nodes corresponding to the original tracked nodes.
One or more node instances originally tracked.
A wrapper for either a syntax node () or a syntax token ().
Note that we do not store the token directly, we just store enough information to reconstruct it.
This allows us to reuse nodeOrToken as a token's parent.
An integer representing the language specific kind of the underlying node or token.
The language name that this node or token is syntax of.
Determines whether the underlying node or token represents a language construct that was actually parsed
from source code. Missing nodes and tokens are typically generated by the parser in error scenarios to
represent constructs that should have been present in the source code for the source code to compile
successfully but were actually missing.
The node that contains the underlying node or token in its Children collection.
Determines whether this is wrapping a token.
Determines whether this is wrapping a node.
Returns the underlying token if this is wrapping a
token.
The underlying token if this is wrapping a token.
Returns the underlying node if this is wrapping a
node.
The underlying node if this is wrapping a node.
The list of child nodes and tokens of the underlying node or token.
The absolute span of the underlying node or token in characters, not including its leading and trailing
trivia.
Same as accessing on .
Slight performance improvement.
The absolute span of the underlying node or token in characters, including its leading and trailing trivia.
Returns the string representation of this node or token, not including its leading and trailing
trivia.
The string representation of this node or token, not including its leading and trailing trivia.
The length of the returned string is always the same as Span.Length
Returns the full string representation of this node or token including its leading and trailing trivia.
The full string representation of this node or token including its leading and trailing
trivia.
The length of the returned string is always the same as FullSpan.Length
Writes the full text of this node or token to the specified TextWriter.
Determines whether the underlying node or token has any leading trivia.
The list of trivia that appear before the underlying node or token in the source code and are attached to a
token that is a descendant of the underlying node or token.
Determines whether the underlying node or token has any trailing trivia.
The list of trivia that appear after the underlying node or token in the source code and are attached to a
token that is a descendant of the underlying node or token.
Determines whether the underlying node or token or any of its descendant nodes, tokens or trivia have any
diagnostics on them.
Gets a list of all the diagnostics in either the sub tree that has this node as its root or
associated with this token and its related trivia.
This method does not filter diagnostics based on #pragmas and compiler options
like nowarn, warnaserror etc.
Determines whether the underlying node or token has any descendant preprocessor directives.
Determines whether this node or token (or any sub node, token or trivia) as annotations.
Determines whether this node or token has annotations of the specified kind.
Determines whether this node or token has annotations of the specified kind.
Determines if this node or token has the specific annotation.
Gets all annotations of the specified annotation kind.
Gets all annotations of the specified annotation kind.
Creates a new node or token identical to this one with the specified annotations.
Creates a new node or token identical to this one with the specified annotations.
Creates a new node or token identical to this one without the specified annotations.
Creates a new node or token identical to this one without the specified annotations.
Creates a new node or token identical to this one without annotations of the specified kind.
Determines whether the supplied is equal to this
.
Determines whether two s are equal.
Determines whether two s are unequal.
Determines whether the supplied is equal to this
.
Serves as hash function for .
Determines if the two nodes or tokens are equivalent.
See and .
Returns a new that wraps the supplied token.
The input token.
A that wraps the supplied token.
Returns the underlying token wrapped by the supplied .
The input .
The underlying token wrapped by the supplied .
Returns a new that wraps the supplied node.
The input node.
A that wraps the supplied node.
Returns the underlying node wrapped by the supplied .
The input .
The underlying node wrapped by the supplied .
SyntaxTree which contains current SyntaxNodeOrToken.
Get the location of this node or token.
A list of structures.
The underlying field
The index from the parent's children list of this node.
Initializes a new instance of the structure.
The underlying syntax node.
The index.
Create a from a sequence of .
The sequence of nodes and tokens
Create a from one or more .
The nodes and tokens
Gets the underlying syntax node.
Gets the count of nodes in this list
Gets the at the specified index.
is out of range.
The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements.
The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements.
Returns the string representation of the nodes and tokens in this list, not including the first node or token's leading trivia
and the last node or token's trailing trivia.
The string representation of the nodes and tokens in this list, not including the first node or token's leading trivia
and the last node or token's trailing trivia.
Returns the full string representation of the nodes and tokens in this list including the first node or token's leading trivia
and the last node or token's trailing trivia.
The full string representation of the nodes and tokens in this list including the first node or token's leading trivia
and the last node or token's trailing trivia.
Gets the first SyntaxNodeOrToken structure from this list.
Gets the first SyntaxNodeOrToken structure from this list if present, else default(SyntaxNodeOrToken).
Gets the last SyntaxNodeOrToken structure from this list.
Gets the last SyntaxNodeOrToken structure from this list if present, else default(SyntaxNodeOrToken).
Returns the index from the list for the given .
The node or token to search for in the list.
The index of the found nodeOrToken, or -1 if it wasn't found
Indicates whether there is any element in the list.
true if there are any elements in the list, else false.
Copies a given count of elements into the given array at specified offsets.
The offset to start copying from.
The array to copy the elements into.
The array offset to start writing to.
The count of elements to copy.
Creates a new with the specified node or token added to the end.
The node or token to add.
Creates a new with the specified nodes or tokens added to the end.
The nodes or tokens to add.
Creates a new with the specified node or token inserted at the index.
The index to insert at.
The node or token to insert.
Creates a new with the specified nodes or tokens inserted at the index.
The index to insert at.
The nodes or tokens to insert.
Creates a new with the element at the specified index removed.
The index of the element to remove.
Creates a new with the specified element removed.
The element to remove.
Creates a new with the specified element replaced with a new node or token.
The element to replace.
The new node or token.
Creates a new with the specified element replaced with a new nodes and tokens.
The element to replace.
The new nodes and tokens.
Gets the enumerator.
Returns an enumerator that iterates through the collection.
A that can be used to iterate through the collection.
Returns an enumerator that iterates through a collection.
An object that can be used to iterate through the collection.
Implements the operator ==.
The left SyntaxNodeOrTokenList
The right SyntaxNodeOrTokenList
true if both lists equal, else false.
Implements the operator !=.
The left SyntaxNodeOrTokenList
The right SyntaxNodeOrTokenList
true if both lists not equal, else false.
Indicates whether the current object is equal to another object of the same type.
An object to compare with this object.
true if the current object is equal to the parameter; otherwise,
false.
Determines whether the specified is equal to this instance.
The to compare with this instance.
true if the specified is equal to this instance; otherwise, false.
Returns a hash code for this instance.
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Enumerator for lists of SyntaxNodeOrToken structs.
Advances the enumerator to the next element of the collection.
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
The collection was modified after the enumerator was created.
Gets the struct that this enumerator instance is currently pointing to.
Gets the struct that this enumerator instance is currently pointing to.
Sets the enumerator to its initial position, which is before the first element in the collection.
The collection was modified after the enumerator was created.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
A reference to a syntax node.
The syntax tree that this references a node within.
The span of the node referenced.
Retrieves the original referenced syntax node.
This action may cause a parse to happen to recover the syntax node.
The original referenced syntax node.
Retrieves the original referenced syntax node.
This action may cause a parse to happen to recover the syntax node.
The original referenced syntax node.
The location of this syntax reference.
The location of this syntax reference.
More performant than GetSyntax().GetLocation().
None of the trivia associated with the node or token is kept.
The leading trivia associated with the node or token is kept.
The trailing trivia associated with the node or token is kept.
The leading and trailing trivia associated with the node or token is kept.
Any directives that would become unbalanced are kept.
All directives are kept
Ensure that at least one EndOfLine trivia is kept if one was present
Adds elastic marker trivia
Represents a token in the syntax tree.
An integer representing the language specific kind of this token.
The language name that this token is syntax of.
The kind of token, given its position in the syntax. This differs from when a contextual keyword is used in a place in the syntax that gives it
its keyword meaning.
The ContextualKind is relevant only on contextual keyword tokens. ContextualKind differs
from Kind when a token is used in context where the token should be interpreted as a
keyword.
The node that contains this token in its Children collection.
The width of the token in characters, not including its leading and trailing trivia.
The complete width of the token in characters including its leading and trailing trivia.
The absolute span of this token in characters, not including its leading and trailing trivia.
Same as accessing on .
Slight performance improvement.
The absolute span of this token in characters, including its leading and trailing trivia.
Determines whether this token represents a language construct that was actually parsed from source code.
Missing tokens are typically generated by the parser in error scenarios to represent constructs that should
have been present in the source code for the source code to compile successfully but were actually missing.
Returns the value of the token. For example, if the token represents an integer literal, then this property
would return the actual integer.
Returns the text representation of the value of the token. For example, if the token represents an integer
literal, then this property would return a string representing the integer.
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
Returns the full string representation of this token including its leading and trailing trivia.
The full string representation of this token including its leading and trailing trivia.
The length of the returned string is always the same as FullSpan.Length
Writes the full text of this token to the specified .
Writes the text of this token to the specified TextWriter, optionally including trivia.
Determines whether this token has any leading trivia.
Determines whether this token has any trailing trivia.
Full width of the leading trivia of this token.
Full width of the trailing trivia of this token.
Determines whether this token or any of its descendant trivia have any diagnostics on them.
Determines whether this token has any descendant preprocessor directives.
Determines whether this token is a descendant of a structured trivia.
Determines whether any of this token's trivia is structured.
True if this token or its trivia has any annotations.
True if this token has annotations of the specified annotation kind.
True if this token has annotations of the specified annotation kinds.
True if this token has the specified annotation.
Gets all the annotations of the specified annotation kind.
Gets all the annotations of the specified annotation kind.
Gets all the annotations of the specified annotation kind.
Adds this annotation to a given syntax token, creating a new syntax token of the same type with the
annotation on it.
Adds this annotation to a given syntax token, creating a new syntax token of the same type with the
annotation on it.
Creates a new syntax token identical to this one without the specified annotations.
Creates a new syntax token identical to this one without the specified annotations.
Creates a new syntax token identical to this one without annotations of the specified kind.
Copies all SyntaxAnnotations, if any, from this SyntaxToken instance and attaches them to a new instance based on .
If no annotations are copied, just returns .
The list of trivia that appear before this token in the source code.
The list of trivia that appear after this token in the source code and are attached to this token or any of
its descendants.
Creates a new token from this token with the leading and trailing trivia from the specified token.
Creates a new token from this token with the leading trivia specified.
Creates a new token from this token with the leading trivia specified..
Creates a new token from this token with the leading trivia specified.
Creates a new token from this token with the trailing trivia specified.
Creates a new token from this token with the trailing trivia specified.
Creates a new token from this token with the trailing trivia specified.
Gets a list of all the trivia (both leading and trailing) for this token.
Determines whether two s are equal.
Determines whether two s are unequal.
Determines whether the supplied is equal to this
.
Determines whether the supplied is equal to this
.
Serves as hash function for .
Gets the token that follows this token in the syntax tree.
The token that follows this token in the syntax tree.
Returns the token after this token in the syntax tree.
Delegate applied to each token. The token is returned if the predicate returns
true.
Delegate applied to trivia. If this delegate is present then trailing trivia is
included in the search.
Gets the token that precedes this token in the syntax tree.
The previous token that precedes this token in the syntax tree.
Returns the token before this token in the syntax tree.
Delegate applied to each token. The token is returned if the predicate returns
true.
Delegate applied to trivia. If this delegate is present then trailing trivia is
included in the search.
The SyntaxTree that contains this token.
Gets the location for this token.
Gets a list of all the diagnostics associated with this token and any related trivia.
This method does not filter diagnostics based on #pragmas and compiler options
like nowarn, warnaserror etc.
Determines if this token is equivalent to the specified token.
Returns true if these two tokens are considered "incrementally identical". An incrementally identical token
occurs when a is incrementally parsed using
and the incremental parser is able to take the token from the original tree and use it in its entirety in the
new tree. In this case, the of each token will be the same, though
they could have different parents, and may occur at different positions in the respective trees. If two tokens are
incrementally identical, all trivial of each node will be incrementally identical as well.
Incrementally identical tokens can also appear within the same syntax tree, or syntax trees that did not arise
from . This can happen as the parser is allowed to construct parse
trees using shared tokens for efficiency. In all these cases though, it will still remain true that the incrementally
identical tokens could have different parents and may occur at different positions in their respective trees.
Represents a read-only list of .
Represents a read-only list of s.
Creates a list of tokens.
An array of tokens.
Creates a list of tokens.
Returns the number of tokens in the list.
Gets the token at the specified index.
The zero-based index of the token to get.
The token at the specified index.
is less than 0.-or- is equal to or greater than .
The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements.
The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements.
Returns the string representation of the tokens in this list, not including
the first token's leading trivia and the last token's trailing trivia.
The string representation of the tokens in this list, not including
the first token's leading trivia and the last token's trailing trivia.
Returns the full string representation of the tokens in this list including
the first token's leading trivia and the last token's trailing trivia.
The full string representation of the tokens in this list including
the first token's leading trivia and the last token's trailing trivia.
Returns the first token in the list.
The first token in the list.
The list is empty.
Returns the last token in the list.
The last token in the list.
The list is empty.
Tests whether the list is non-empty.
True if the list contains any tokens.
Returns a list which contains all elements of in reversed order.
which contains all elements of in reversed order
get the green node at the given slot
get the green node at the given slot
Creates a new with the specified token added to the end.
The token to add.
Creates a new with the specified tokens added to the end.
The tokens to add.
Creates a new with the specified token insert at the index.
The index to insert the new token.
The token to insert.
Creates a new with the specified tokens insert at the index.
The index to insert the new tokens.
The tokens to insert.
Creates a new with the token at the specified index removed.
The index of the token to remove.
Creates a new with the specified token removed.
The token to remove.
Creates a new with the specified token replaced with a new token.
The token to replace.
The new token.
Creates a new with the specified token replaced with new tokens.
The token to replace.
The new tokens.
Returns an enumerator for the tokens in the
Compares and for equality.
True if the two s are equal.
Compares and for inequality.
True if the two s are not equal.
Compares this with the for equality.
True if the two objects are equal.
Serves as a hash function for the
Create a new Token List
Element of the return Token List
A structure for enumerating a
Advances the enumerator to the next token in the collection.
true if the enumerator was successfully advanced to the next element; false if the enumerator
has passed the end of the collection.
Gets the current element in the collection.
Reversed enumerable.
The parsed representation of a source document.
Cached value for empty .
The path of the source document file.
If this syntax tree is not associated with a file, this value can be empty.
The path shall not be null.
The file doesn't need to exist on disk. The path is opaque to the compiler.
The only requirement on the path format is that the implementations of
, and
passed to the compilation that contains the tree understand it.
Clients must also not assume that the values of this property are unique
within a Compilation.
The path is used as follows:
- When debug information is emitted, this path is embedded in the debug information.
- When resolving and normalizing relative paths in #r, #load, #line/#ExternalSource,
#pragma checksum, #ExternalChecksum directives, XML doc comment include elements, etc.
Returns true if this syntax tree has a root with SyntaxKind "CompilationUnit".
The options used by the parser to produce the syntax tree.
The options used by the parser to produce the syntax tree.
Option to specify custom behavior for each warning in this tree.
A map from diagnostic ID to diagnostic reporting level. The diagnostic
ID string may be case insensitive depending on the language.
The length of the text of the syntax tree.
Gets the syntax tree's text if it is available.
Gets the text of the source document.
The text encoding of the source document.
Useful information about this tree that is stored for source-generator scenarios. Allows the incremental
generation framework to compute and cache data once against a tree so it does not have to go back to source
for untouched trees when other trees in the compilation are modified.
Gets the text of the source document 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 if it is available.
Gets the root of the syntax tree if it is available.
Gets the root node of the syntax tree, causing computation if necessary.
Gets the root node of the syntax tree, causing computation if necessary.
Gets the root node of the syntax tree asynchronously.
Gets the root node of the syntax tree asynchronously.
Create a new syntax tree 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.
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.
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 the location in terms of path, line and column for a given span.
Span within the tree.
Cancellation token.
A valid 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 in C# or #ExternalSource in VB).
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 it is preceded by a line mapping directive that
either specifies an explicit file path or is #line default.
Returns empty sequence if there are no line mapping directives in the tree.
Otherwise, returns a sequence of pairs of spans: each describing a mapping of a span of the tree between two consecutive #line directives.
If the first directive is not on the first line the first pair describes mapping of the span preceding the first directive.
The last pair of the sequence describes mapping of the span following the last #line directive.
Empty sequence if the tree does not contain a line mapping directive.
Otherwise a non-empty sequence of .
Returns the visibility for the line at the given position.
The position to check.
The cancellation token.
Gets a FileLinePositionSpan for a TextSpan and the information whether this span is considered to be hidden or not.
FileLinePositionSpans are used primarily for diagnostics and source locations.
This method combines a call to GetLineSpan and IsHiddenPosition.
Returns a boolean indicating whether this span is considered hidden or not.
This function is being called only in the context of sequence point creation and therefore interprets the
LineVisibility accordingly (BeforeFirstRemappingDirective -> Visible).
Returns a path for particular location in source that is presented to the user.
Used for implementation of
or for embedding source paths in error messages.
Unlike Dev12 we do account for #line and #ExternalSource directives when determining value for
.
Returns the path used for emit purposes. This takes into account /pathmap arguments passed into
the compiler.
Returns a line number for particular location in source that is presented to the user.
Used for implementation of
or for embedding source line numbers in error messages.
Unlike Dev12 we do account for #line and #ExternalSource directives when determining value for
.
Are there any hidden regions in the tree?
True if there is at least one hidden region.
Returns a list of the changed regions between this tree and the specified tree. The list is conservative for
performance reasons. It may return larger regions than what has actually changed.
Gets a location for the specified text span.
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.
Gets a SyntaxReference for a specified 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 text changes that when applied to the old tree produce this tree.
The old tree.
The list of changes may be different than the original changes that produced
this tree.
Gets the checksum + algorithm id to use in the PDB.
Returns a new tree whose root and options are as specified and other properties are copied from the current tree.
Returns a new tree whose is the specified node and other properties are copied from the current tree.
Returns a new tree whose are the specified value and other properties are copied
from the current tree.
A mapping from diagnostic id to diagnostic reporting level. The diagnostic ID may be case-sensitive depending
on the language.
Returns a that represents the entire source text of this .
Verify nodes match source.
Return the index of the first difference between
the two strings, or -1 if the strings are the same.
Returns true if the provided position is in a hidden region inaccessible to the user.
Represents a trivia in the syntax tree.
An integer representing the language specific kind of this trivia.
The language name that this trivia is syntax of.
The parent token that contains this token in its LeadingTrivia or TrailingTrivia collection.
The width of this trivia in characters. If this trivia is a structured trivia then the returned width will
not include the widths of any leading or trailing trivia present on the child non-terminal node of this
trivia.
The width of this trivia in characters. If this trivia is a structured trivia then the returned width will
include the widths of any leading or trailing trivia present on the child non-terminal node of this trivia.
The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span
will not include spans of any leading or trailing trivia present on the child non-terminal node of this
trivia.
Same as accessing on .
Slight performance improvement.
The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span
will include spans of any leading or trailing trivia present on the child non-terminal node of this trivia.
Determines whether this trivia has any diagnostics on it. If this trivia is a structured trivia then the
returned value will indicate whether this trivia or any of its descendant nodes, tokens or trivia have any
diagnostics on them.
>
Determines whether this trivia is a structured trivia.
Determines whether this trivia is a descendant of a structured trivia.
Determines whether this trivia or any of its structure has annotations.
Determines where this trivia has annotations of the specified annotation kind.
Determines where this trivia has any annotations of the specified annotation kinds.
Determines whether this trivia has the specific annotation.
Get all the annotations of the specified annotation kind.
Get all the annotations of the specified annotation kinds.
Determines whether this trivia represents a preprocessor directive.
Returns the child non-terminal node representing the syntax tree structure under this structured trivia.
The child non-terminal node representing the syntax tree structure under this structured
trivia.
Returns the string representation of this trivia. If this trivia is structured trivia then the returned string
will not include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.
The string representation of this trivia.
The length of the returned string is always the same as Span.Length
Returns the full string representation of this trivia. If this trivia is structured trivia then the returned string will
include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.
The full string representation of this trivia.
The length of the returned string is always the same as FullSpan.Length
Writes the full text of this trivia to the specified TextWriter.
Determines whether two s are equal.
Determines whether two s are unequal.
Determines whether the supplied is equal to this
.
Determines whether the supplied is equal to this
.
Serves as hash function for .
Creates a new SyntaxTrivia with the specified annotations.
Creates a new SyntaxTrivia with the specified annotations.
Creates a new SyntaxTrivia without the specified annotations.
Creates a new SyntaxTrivia without the specified annotations.
Creates a new SyntaxTrivia without annotations of the specified kind.
Copies all SyntaxAnnotations, if any, from this SyntaxTrivia instance and attaches them to a new instance based on .
SyntaxTree which contains current SyntaxTrivia.
Get the location of this trivia.
Gets a list of all the diagnostics associated with this trivia.
This method does not filter diagnostics based on #pragmas and compiler options
like nowarn, warnaserror etc.
Determines if this trivia is equivalent to the specified trivia.
Represents a read-only list of .
Creates a list of trivia.
An array of trivia.
Creates a list of trivia.
A sequence of trivia.
Gets the trivia at the specified index.
The zero-based index of the trivia to get.
The token at the specified index.
is less than 0.-or- is equal to or greater than .
The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements.
The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements.
Returns the first trivia in the list.
The first trivia in the list.
The list is empty.
Returns the last trivia in the list.
The last trivia in the list.
The list is empty.
Does this list have any items.
Returns a list which contains all elements of in reversed order.
which contains all elements of in reversed order
Creates a new with the specified trivia added to the end.
The trivia to add.
Creates a new with the specified trivia added to the end.
The trivia to add.
Creates a new with the specified trivia inserted at the index.
The index in the list to insert the trivia at.
The trivia to insert.
Creates a new with the specified trivia inserted at the index.
The index in the list to insert the trivia at.
The trivia to insert.
Creates a new with the element at the specified index removed.
The index identifying the element to remove.
Creates a new with the specified element removed.
The trivia element to remove.
Creates a new with the specified element replaced with new trivia.
The trivia element to replace.
The trivia to replace the element with.
Creates a new with the specified element replaced with new trivia.
The trivia element to replace.
The trivia to replace the element with.
get the green node at the specific slot
Copy number of items starting at from this list into starting at .
Reversed enumerable.
Walks the syntax tree, allowing subclasses to operate on all nodes, token and trivia. The
walker will perform a depth first walk of the tree.
Syntax the should descend into.
Creates a new walker instance.
Syntax the should descend into.
Called when the walker visits a node. This method may be overridden if subclasses want
to handle the node. Overrides should call back into this base method if they want the
children of this node to be visited.
The current node that the walker is visiting.
Called when the walker visits a token. This method may be overridden if subclasses want
to handle the token. Overrides should call back into this base method if they want the
trivia of this token to be visited.
The current token that the walker is visiting.
Called when the walker visits a trivia syntax. This method may be overridden if
subclasses want to handle the token. Overrides should call back into this base method if
they want the children of this trivia syntax to be visited.
The current trivia syntax that the walker is visiting.
Syntax the should descend into.
descend into only nodes
descend into nodes and tokens
descend into nodes, tokens and trivia
descend into everything
Kind of a synthesized local variable.
Synthesized local variables are either
1) Short-lived (temporary)
The lifespan of a temporary variable shall not cross a statement boundary (a PDB sequence point).
These variables are not tracked by EnC and don't have names. Only values less than 0 are considered
short-lived: new short-lived kinds should have a negative value.
2) Long-lived
All variables whose lifespan might cross a statement boundary (include a PDB sequence point)
must be named in a build configuration that supports EnC. Some of them might need to be named in release, to support EE.
The kind of such local must be encoded in the name, so that we can retrieve it from debug metadata during EnC.
The integer value of the kind must match corresponding Dev11/12 TEMP_KIND enum values for
compatibility with assemblies generated by the native compiler.
Long-lived local variables must be assigned slots in source order.
Temp created for caching "this".
Technically it is long-lived, but will happen only in optimized code.
Temp variable created by the optimizer.
Temp variable created during lowering.
Temp variable created by the emitter.
The variable is not synthesized (C#, VB). Note that SynthesizedLocalKind values
greater than or equal to this are considered long-lived;
see .
Local variable that stores value of an expression consumed by a subsequent conditional branch instruction that might jump across PDB sequence points.
The value needs to be preserved when remapping the IL offset from old method body to new method body during EnC.
A hidden sequence point also needs to be inserted at the offset where this variable is loaded to be consumed by the branch instruction.
(VB, C#).
Boolean passed to Monitor.Enter (C#, VB).
Variable holding on the object being locked while the execution is within the block of the lock statement (C#) or SyncLock statement (VB).
Local variable that stores the resources to be disposed at the end of using statement (C#, VB).
Local variable that stores the enumerator instance (C#, VB).
Local variable that stores the array instance (C#, VB?).
Local variables that store upper bound of multi-dimensional array, for each dimension (C#, VB?).
Local variables that store the current index, for each dimension (C#, VB?).
Local variable that holds a pinned handle of a managed reference passed to a fixed statement (C#).
Local variable that holds the object passed to With statement (VB).
Local variable used to store the value of Select Case during the execution of Case statements.
Local variable that stores the return value of an async method.
VB: Stores the return value of a function that is not accessible from user code (e.g. operator, lambda, async, iterator).
C#: Stores the return value of a method/lambda with a block body, so that we can put a sequence point on the closing brace of the body.
Very special corner case involving filters, await and lambdas.
Local variable that stores the current state of the state machine while MoveNext method is executing.
Used to avoid race conditions due to multiple reads from the lifted state.
Local that stores an expression value which needs to be spilled.
Such a local arises from the translation of an await or switch expression,
and might be hoisted to an async state machine if it remains alive
after an await expression.
Local variable that holds on the display class instance.
Local variable used to cache a delegate that is used in inner block (possibly a loop),
and can be reused for all iterations of the loop.
Local variable that stores the result of an await expression (the awaiter object).
The variable is assigned the result of a call to await-expression.GetAwaiter() and subsequently used
to check whether the task completed. Eventually the value is stored in an awaiter field.
The value assigned to the variable needs to be preserved when remapping the IL offset from old method body
to new method body during EnC. If the awaiter expression is contained in an active statement and the
containing MoveNext method changes the debugger finds the next sequence point that follows the await expression
and transfers the execution to the new method version. This sequence point is placed by the compiler at
the immediately after the stloc instruction that stores the awaiter object to this variable.
The subsequent ldloc then restores it in the new method version.
(VB, C#).
Stores a dynamic analysis instrumentation payload array. The value is initialized in
synthesized method prologue code and referred to throughout the method body.
Temp created for pattern matching by type. This holds the value of an input value provisionally
converted to the type against which it is being matched.
Variable that stores the context object used to track local variable and parameter stores in method bodies instrumented with .
Associated with the method body syntax.
All values have to be less than or equal to
()
An awaiter in async method.
Never actually created as a local variable, immediately lifted to a state machine field.
Not serialized to .
The receiver of a delegate relaxation stub.
Created as a local variable but always lifted to a relaxation display class field.
We never emit debug info for hoisted relaxation variable.
TODO: Avoid using lambdas and display classes for implementation of relaxation stubs and remove this kind.
This is ONLY used id BoundNode.cs Debug method - Dump()
This is ONLY used for debugging purpose
Parses a version string of the form "major [ '.' minor [ '.' build [ '.' revision ] ] ]".
The version string to parse.
If parsing succeeds, the parsed version. Otherwise a version that represents as much of the input as could be parsed successfully.
True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise.
Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]"
as accepted by System.Reflection.AssemblyVersionAttribute.
The version string to parse.
Indicates whether or not a wildcard is accepted as the terminal component.
If parsing succeeded, the parsed version. Otherwise a version instance with all parts set to zero.
If contains * the version build and/or revision numbers are set to .
True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise.
Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]"
as accepted by System.Reflection.AssemblyVersionAttribute.
The version string to parse.
Indicates whether or not we're parsing an assembly version string. If so, wildcards are accepted and each component must be less than 65535.
The maximum value that a version component may have.
Allow the parsing of version elements where invalid characters exist. e.g. 1.2.2a.1
If parsing succeeded, the parsed version. When is true a version with values up to the first invalid character set. Otherwise a version with all parts set to zero.
If contains * and wildcard is allowed the version build and/or revision numbers are set to .
True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise.
If build and/or revision numbers are 65535 they are replaced with time-based values.
This function defines whether an attribute is optional or not.
The attribute member.
Ids of well known runtime types.
Values should not intersect with SpecialType enum!
Number of well known types in WellKnownType enum
Array of names for types.
The names should correspond to ids from WellKnownType enum so
that we could use ids to index into the array
Resolves references to XML files specified in the source.
Resolves XML document file path.
Value of the "file" attribute of an <include> documentation comment element.
Path of the source file () or XML document that contains the .
If not null used as a base path of , if is relative.
If is relative is used as the base path of .
Normalized XML document file path or null if not found.
The XmlCharType class is used for quick character type recognition
which is optimized for the first 127 ascii characters.
start >= value <= end
Struct containing information about a source declaration.
Topmost syntax node for this declaration.
Syntax nodes for executable code blocks (method body, initializers, etc.) associated with this declaration.
Symbol declared by this declaration.
Constants for producing and consuming streams of binary custom debug info.
More than records added.
The kinds of custom debug info in Windows PDBs that we know how to interpret.
The values correspond to possible values of the "kind" byte
in the record header.
C# only. Encodes the sizes of using groups that are applicable to the method.
The actual import strings are stored separately trhu ISymUnmanagedWriter.UsingNamespace.
Represented by using
XML node in PDB tests.
C# only. Indicates that per-method debug information (import strings) is stored on another method,
whose token is specified.
Represented by forward
XML node in PDB tests.
C# only. Indicates that per-module debug information (assembly reference aliases) is stored on another method,
whose token is specified.
Represented by forwardToModule
XML node in PDB tests.
C# only. Specifies local scopes for state machine hoisted local variables.
Represented by hoistedLocalScopes
XML node in PDB tests.
Equivalent to in Portable PDB.
C# and VB. The name of the state machine type. Emitted for async and iterator kick-off methods.
Represented by forwardIterator
XML node in PDB tests.
C# only. Dynamic flags for local variables and constants.
Represented by dynamicLocals
XML node in PDB tests.
Equivalent to in Portable PDB.
C# and VB. Encodes EnC local variable slot map.
See https://github.com/dotnet/corefx/blob/main/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#EditAndContinueLocalSlotMap.
Represented by encLocalSlotMap
XML node in PDB tests.
Equivalent to in Portable PDB.
C# and VB. Encodes EnC lambda map.
See https://github.com/dotnet/corefx/blob/main/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#EditAndContinueLambdaAndClosureMap.
Represented by encLambdaMap
XML node in PDB tests.
Equivalent to in Portable PDB.
C# and VB. Tuple element names for local variables and constants.
Represented by tupleElementNames
XML node in PDB tests.
Equivalent to in Portable PDB.
C# and VB. Syntax offsets of nodes associated with state machine states in an async/iterator method and their corresponding state numbers.
Represented by encStateMachineStateMap
XML node in PDB tests.
Equivalent to in Portable PDB.
A collection of utility method for consuming custom debug info from a PDB.
This is not a public API, so we're just going to let bad offsets fail on their own.
This is the first header in the custom debug info blob.
After the global header (see comes list of custom debug info record.
Each record begins with a standard header.
Exposed for .
For each namespace declaration enclosing a method (innermost-to-outermost), there is a count
of the number of imports in that declaration.
There's always at least one entry (for the global namespace).
Exposed for .
This indicates that further information can be obtained by looking at the custom debug
info of another method (specified by token).
Appears when multiple method would otherwise have identical using records (see ).
Exposed for .
This indicates that further information can be obtained by looking at the custom debug
info of another method (specified by token).
Appears when there are extern aliases and edit-and-continue is disabled.
Exposed for .
Scopes of state machine hoisted local variables.
Exposed for .
Indicates that this method is the iterator state machine for the method named in the record.
Appears on kick-off methods of a state machine.
Exposed for .
Encodes NULL-terminated UTF16 name of the state machine type.
The ending NULL character might not be present if the PDB was generated by an older compiler.
Bad data.
Does for locals what System.Runtime.CompilerServices.DynamicAttribute does for parameters, return types, and fields.
In particular, indicates which occurrences of in the signature are really dynamic.
Appears when there are dynamic locals.
Exposed for .
Bad data.
Tuple element names for locals.
Get the import strings for a given method, following forward pointers as necessary.
For each namespace enclosing the method, a list of import strings, innermost to outermost.
There should always be at least one entry, for the global namespace.
Get the import strings for a given method, following forward pointers as necessary.
A list of import strings. There should always be at least one entry, for the global namespace.
Parse a string representing a C# using (or extern alias) directive.
"AS USystem" ->
"AC TSystem.Console" ->
"AS ESystem alias" ->
"XOldLib" ->
"ZOldLib assembly" ->
"ESystem alias" ->
"TSystem.Math" ->
]]>
Parse a string representing a VB import statement.
is null.
Format of is not valid.
Read UTF-8 string with null terminator.
C# or VB namespace import.
C# or VB type import.
VB namespace or type alias target (not specified).
C# extern alias.
VB XML import.
VB forwarding information (i.e. another method has the imports for this one).
VB containing namespace (not an import).
VB root namespace (not an import).
A kind that is no longer used.
The offset of the first operation in the scope.
The offset of the first operation outside of the scope, or the method body length.
If zero then is also zero and the slot represents a synthesized local.
See for an explanation of this constant value.
Realizes the array.
Realizes the array and clears the collection.
Write to slot .
Fills in unallocated slots preceding the , if any.
Realizes the array.
Realizes the array, downcasting each element to a derived type.
Realizes the array and disposes the builder in one operation.
struct enumerator used in foreach.
Generic implementation of object pooling pattern with predefined pool size limit. The main
purpose is that limited number of frequently used objects can be kept in the pool for
further recycling.
Notes:
1) it is not the goal to keep all returned objects. Pool is not meant for storage. If there
is no space in the pool, extra returned objects will be dropped.
2) it is implied that if object was obtained from a pool, the caller will return it back in
a relatively short time. Keeping checked out objects for long durations is ok, but
reduces usefulness of pooling. Just new up your own.
Not returning objects to the pool in not detrimental to the pool's work, but is a bad practice.
Rationale:
If there is no intent for reusing the object, do not use pool - just use "new".
Not using System.Func{T} because this file is linked into the (debugger) Formatter,
which does not have that type (since it compiles against .NET 2.0).
Produces an instance.
Search strategy is a simple linear probing which is chosen for it cache-friendliness.
Note that Free will try to store recycled objects close to the start thus statistically
reducing how far we will typically search.
Returns objects to the pool.
Search strategy is a simple linear probing which is chosen for it cache-friendliness.
Note that Free will try to store recycled objects close to the start thus statistically
reducing how far we will typically search in Allocate.
Removes an object from leak tracking.
This is called when an object is returned to the pool. It may also be explicitly
called if an object allocated from the pool is intentionally not being returned
to the pool. This can be of use with pooled arrays if the consumer wants to
return a larger array to the pool than was originally allocated.
Provides pooled delegate instances to help avoid closure allocations for delegates that require a state argument
with APIs that do not provide appropriate overloads with state arguments.
Gets an delegate, which calls with the specified
. The resulting may be called any number of times
until the returned is disposed.
The following example shows the use of a capturing delegate for a callback action that requires an
argument:
int x = 3;
RunWithActionCallback(() => this.DoSomething(x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
callback action:
int x = 3;
using var _ = GetPooledAction(arg => arg.self.DoSomething(arg.x), (self: this, x), out Action action);
RunWithActionCallback(action);
The type of argument to pass to .
The unbound action delegate.
The argument to pass to the unbound action delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Gets an delegate, which calls with the specified
. The resulting may be called any number of times
until the returned is disposed.
The following example shows the use of a capturing delegate for a callback action that requires an
argument:
int x = 3;
RunWithActionCallback(a => this.DoSomething(a, x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
callback action:
int x = 3;
using var _ = GetPooledAction((a, arg) => arg.self.DoSomething(a, arg.x), (self: this, x), out Action<int> action);
RunWithActionCallback(action);
The type of the first parameter of the bound action.
The type of argument to pass to .
The unbound action delegate.
The argument to pass to the unbound action delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Gets an delegate, which calls with the specified
. The resulting may be called any number of times
until the returned is disposed.
The following example shows the use of a capturing delegate for a callback action that requires an
argument:
int x = 3;
RunWithActionCallback((a, b) => this.DoSomething(a, b, x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
callback action:
int x = 3;
using var _ = GetPooledAction((a, b, arg) => arg.self.DoSomething(a, b, arg.x), (self: this, x), out Action<int, int> action);
RunWithActionCallback(action);
The type of the first parameter of the bound action.
The type of the second parameter of the bound action.
The type of argument to pass to .
The unbound action delegate.
The argument to pass to the unbound action delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Gets an delegate, which calls with the specified
. The resulting may be called any number of times
until the returned is disposed.
The following example shows the use of a capturing delegate for a callback action that requires an
argument:
int x = 3;
RunWithActionCallback((a, b, c) => this.DoSomething(a, b, c, x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
callback action:
int x = 3;
using var _ = GetPooledAction((a, b, c, arg) => arg.self.DoSomething(a, b, c, arg.x), (self: this, x), out Action<int, int, int> action);
RunWithActionCallback(action);
The type of the first parameter of the bound action.
The type of the second parameter of the bound action.
The type of the third parameter of the bound action.
The type of argument to pass to .
The unbound action delegate.
The argument to pass to the unbound action delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Gets a delegate, which calls with the
specified . The resulting may be called any
number of times until the returned is disposed.
The following example shows the use of a capturing delegate for a predicate that requires an
argument:
int x = 3;
RunWithPredicate(() => this.IsSomething(x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
predicate:
int x = 3;
using var _ = GetPooledFunction(arg => arg.self.IsSomething(arg.x), (self: this, x), out Func<bool> predicate);
RunWithPredicate(predicate);
The type of argument to pass to .
The type of the return value of the function.
The unbound function delegate.
The argument to pass to the unbound function delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Equivalent to ,
except typed such that it can be used to create a pooled .
Gets a delegate, which calls with the
specified . The resulting may be called any
number of times until the returned is disposed.
The following example shows the use of a capturing delegate for a predicate that requires an
argument:
int x = 3;
RunWithPredicate(a => this.IsSomething(a, x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
predicate:
int x = 3;
using var _ = GetPooledFunction((a, arg) => arg.self.IsSomething(a, arg.x), (self: this, x), out Func<int, bool> predicate);
RunWithPredicate(predicate);
The type of the first parameter of the bound function.
The type of argument to pass to .
The type of the return value of the function.
The unbound function delegate.
The argument to pass to the unbound function delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Gets a delegate, which calls with the
specified . The resulting may be called any
number of times until the returned is disposed.
The following example shows the use of a capturing delegate for a predicate that requires an
argument:
int x = 3;
RunWithPredicate((a, b) => this.IsSomething(a, b, x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
predicate:
int x = 3;
using var _ = GetPooledFunction((a, b, arg) => arg.self.IsSomething(a, b, arg.x), (self: this, x), out Func<int, int, bool> predicate);
RunWithPredicate(predicate);
The type of the first parameter of the bound function.
The type of the second parameter of the bound function.
The type of argument to pass to .
The type of the return value of the function.
The unbound function delegate.
The argument to pass to the unbound function delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
Gets a delegate, which calls with the
specified . The resulting may be called any
number of times until the returned is disposed.
The following example shows the use of a capturing delegate for a predicate that requires an
argument:
int x = 3;
RunWithPredicate((a, b, c) => this.IsSomething(a, b, c, x));
The following example shows the use of a pooled delegate to avoid capturing allocations for the same
predicate:
int x = 3;
using var _ = GetPooledFunction((a, b, c, arg) => arg.self.IsSomething(a, b, c, arg.x), (self: this, x), out Func<int, int, int, bool> predicate);
RunWithPredicate(predicate);
The type of the first parameter of the bound function.
The type of the second parameter of the bound function.
The type of the third parameter of the bound function.
The type of argument to pass to .
The type of the return value of the function.
The unbound function delegate.
The argument to pass to the unbound function delegate.
A delegate which calls with the specified
.
A disposable which returns the object to the delegate pool.
A releaser for a pooled delegate.
This type is intended for use as the resource of a using statement. When used in this manner,
should not be called explicitly.
If used without a using statement, calling is optional. If the call is
omitted, the object will not be returned to the pool. The behavior of this type if is
called multiple times is undefined.
The usage is:
var inst = PooledStringBuilder.GetInstance();
var sb = inst.builder;
... Do Stuff...
... sb.ToString() ...
inst.Free();
If someone need to create a private pool
The size of the pool.
Output kind not supported.
Path returned by {0}.ResolveMetadataFile must be absolute: '{1}'
Assembly must have at least one module.
Module copy can't be used to create an assembly metadata.
Unresolved:
assembly
class
constructor
delegate
enum
event
field
type parameter
interface
method
module
parameter
property, indexer
return
struct
Can't create a reference to a submission.
Can't create a reference to a module.
<in-memory assembly>
<in-memory module>
Size has to be positive.
Assembly file not found
Can't embed interop types from module.
Can't alias a module.
Invalid alias.
{0}.GetMetadata() must return an instance of {1}.
Value too large to be represented as a 30 bit unsigned integer.
Arrays with more than one dimension cannot be serialized.
Invalid assembly name: '{0}'
Absolute path expected.
A key in the pathMap is empty.
A value in the pathMap is null.
Compilation options must not have errors.
Return type can't be a value type, pointer, by-ref or open generic type
Return type can't be void, by-ref or open generic type
Type must be same as host object type of previous submission.
Previous submission has errors.
Invalid output kind for submission. DynamicallyLinkedLibrary expected.
Invalid compilation options -- submission can't be signed.
Resource stream provider should return non-null stream.
Reference resolver should return readable non-null stream.
Empty or invalid resource name
Empty or invalid file name
Resource data provider should return non-null stream
File not found.
Path returned by {0}.ResolveStrongNameKeyFile must be absolute: '{1}'
type must be a subclass of SyntaxAnnotation.
Invalid module name specified in metadata module '{0}': '{1}'
File size exceeds maximum allowed size of a valid metadata file.
Name cannot be null.
Name cannot be empty.
Name cannot start with whitespace.
Name contains invalid characters.
The span does not include the start of a line.
The span does not include the end of a line.
'start' must not be negative
'end' must not be less than 'start'. start='{0}' end='{1}'.
Invalid content type
Expected non-empty public key
Invalid size of public key token.
Invalid characters in assembly name
Invalid characters in assembly culture name
Stream must support read and seek operations.
Stream must be readable.
Stream must be writable.
PDB stream should not be given when embedding PDB into the PE stream.
PDB stream should not be given when emitting metadata only.
Metadata PE stream should not be given when emitting metadata only.
Including private members should not be used when emitting to the secondary assembly output.
Must include private members unless emitting a ref assembly.
Embedding PDB is not allowed when emitting metadata.
Cannot target net module when emitting ref assembly.
Invalid hash.
Unsupported hash algorithm.
Inconsistent language versions
Win32 resources, assumed to be in COFF object format, have one or more invalid relocation header values.
Win32 resources, assumed to be in COFF object format, have an invalid section size.
Win32 resources, assumed to be in COFF object format, have one or more invalid symbol values.
Win32 resources, assumed to be in COFF object format, are missing one or both of sections '.rsrc$01' and '.rsrc$02'
Icon stream is not in the expected format.
Invalid culture name: '{0}'
WindowsRuntime identity can't be retargetable
PE image not available.
Assembly signing not supported.
References to XML documents are not supported.
Could not locate the rule set file '{0}'.
An error occurred while loading the included rule set file {0} - {1}
Analyzer Failure
Analyzer '{0}' threw an exception of type '{1}' with message '{2}'.
{3}
Analyzer Driver Failure
Analyzer driver threw an exception of type '{0}' with message '{1}'.
{2}
PE image doesn't contain managed metadata.
The changes must not overlap.
A DiagnosticDescriptor must have an Id that is neither null nor an empty string nor a string that only contains white space.
A SuppressionDescriptor must have an Id that is neither null nor an empty string nor a string that only contains white space.
The rule set file has duplicate rules for '{0}' with differing actions '{1}' and '{2}'.
Can't create a module reference to an assembly.
Can't create a metadata reference to a dynamic assembly.
Can't create a metadata reference to an assembly without location.
Argument cannot be empty.
Argument cannot have a null element.
Reported diagnostic with ID '{0}' is not supported by the analyzer.
Reported suppression with ID '{0}' is not supported by the suppressor.
Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor.
Non-reported diagnostic with ID '{0}' cannot be suppressed.
Reported diagnostic has an ID '{0}', which is not a valid identifier.
Reported diagnostic '{0}' has a source location in file '{1}', which is not part of the compilation being analyzed.
Analyzer '{0}' contains a null descriptor in its 'SupportedDiagnostics'.
Analyzer '{0}' contains a null descriptor in its 'SupportedSuppressions'.
The type '{0}' is not understood by the serialization binder.
Cannot deserialize type '{0}'.
Cannot serialize type '{0}'.
Node to track is not a descendant of the root.
A node or token is out of sequence.
A node in the list is not of the expected type.
The item specified is not the element of a list.
Invalid public key.
Invalid public key token.
Invalid data at offset {0}: {1}{2}*{3}{4}
Windows PDB writer doesn't support deterministic compilation: '{0}'
The version of Windows PDB writer is older than required: '{0}'
Windows PDB writer doesn't support SourceLink feature: '{0}'
The attribute {0} has an invalid value of {1}.
The element {0} is missing an attribute named {1}.
Argument to '/keepalive' option is not a 32-bit integer.
Arguments to '/keepalive' option below -1 are invalid.
'/keepalive' option is only valid with '/shared' option.
Roslyn compiler server reports different protocol version than build task.
Missing argument for '/keepalive' option.
Total analyzer execution time: {0} seconds.
NOTE: Elapsed time may be less than analyzer execution time because analyzers can run concurrently.
Time (s)
Analyzer
No analyzers found
Argument contains duplicate analyzer instances.
Argument contains an analyzer instance that does not belong to the 'Analyzers' for this CompilationWithAnalyzers instance.
Syntax tree doesn't belong to the underlying 'Compilation'.
Additional file doesn't belong to the underlying 'CompilationWithAnalyzers'.
Resource stream ended at {0} bytes, expected {1} bytes.
Value for argument '/shared:' must not be empty
Exception occurred with following context:
{0}
{0} and {1} must have the same length.
{0} must either be 'default' or have the same length as {1}.
Inconsistent syntax tree features
Reference of type '{0}' is not valid for this compilation.
MetadataReference '{0}' not found to remove.
If tuple element names are specified, the number of element names must match the cardinality of the tuple.
Tuple element name cannot be an empty string.
If tuple element locations are specified, the number of locations must match the cardinality of the tuple.
If tuple element nullable annotations are specified, the number of annotations must match the cardinality of the tuple.
Tuples must have at least two elements.
The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers.
The underlying type for a tuple must be tuple-compatible.
Unrecognized resource file format.
SourceText cannot be embedded. Provide encoding or canBeEmbedded=true at construction.
Stream is too long.
Embedded texts are only supported when emitting a PDB.
The stream cannot be written to.
element is expected
separator is expected
The stream cannot be read from.
Deserialization reader for '{0}' read incorrect number of values.
Stream contains invalid data
Reported diagnostic '{0}' has a source location '{1}' in file '{2}', which is outside of the given file.
Warning: Could not enable multicore JIT due to exception: {0}.
Given operation has a non-null parent.
Given operation has a null semantic model.
Given operation block does not belong to the current analysis context.
Parameter '{0}' must be an 'INamedTypeSymbol' or an 'IAssemblySymbol'.
Parameter '{0}' must be a symbol from this compilation or some referenced assembly.
The provided operation must not be part of a Control Flow Graph.
A language name cannot be specified for this option.
A language name must be specified for this option.
The diagnostic '{0}' was given an invalid severity '{1}' in the analyzer config file at '{2}'.
Invalid severity in analyzer config file.
Programmatic suppression of an analyzer diagnostic
Diagnostic '{0}: {1}' was programmatically suppressed by a DiagnosticSuppressor with suppression ID '{2}' and justification '{3}'
Module has invalid attributes.
Unable to determine specific cause of the failure.
Changing the version of an assembly reference is not allowed during debugging: '{0}' changed version to '{1}'.
Suppress the following diagnostics to disable this analyzer: {0}
Only a single {0} can be registered per generator.
Multiple global analyzer config files set the same key '{0}' in section '{1}'. It has been unset. Key was set by the following files: '{2}'
Multiple global analyzer config files set the same key. It has been unset.
The hintName '{0}' of the added source file must be unique within a generator.
The hintName '{0}' contains an invalid character '{1}' at position {2}.
The SourceText with hintName '{0}' must have an explicit encoding set.
The assembly containing type '{0}' references .NET Framework, which is not supported.
Global analyzer config section name '{0}' is invalid as it is not an absolute path. Section will be ignored. Section was declared in file: '{1}'
Global analyzer config section name is invalid as it is not an absolute path. Section will be ignored.
Changes must be within bounds of SourceText
Edit and Continue can't resume suspended asynchronous method since the corresponding await expression has been deleted
Edit and Continue can't resume suspended iterator since the corresponding yield return statement has been deleted
Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running.
Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running.
Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0}
Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running
Generator
Total generator execution time: {0} seconds.
Illegal built-in operator name '{0}'
Unsupported built-in operator: {0}
'{0}' was not a valid built-in operator name
The hintName '{0}' contains an invalid segment '{1}' at position {2}.
Method symbol expected
Invalid instrumentation kind: {0}
The requested line number {0} must be less than the number of lines {1}.
Printing 'InternalsVisibleToAttribute' information for the current compilation and all referenced assemblies.
Current assembly: '{0}'
Assembly reference: '{0}'
Grants IVT to current assembly: {1}
Grants IVTs to:
Assembly name: '{0}'
Public Keys:
Nothing
The temporary path for legacy file signing is unavailable.
Resolves type reference.
The TypeRef metadata token to return the referenced type information for.
The IID of the interface to return in scope. Typically, this would be IID_IMetaDataImport.
An interface to the module scope in which the referenced type is defined.
A pointer to a TypeDef token that represents the referenced type.
TypeDefs define a type within a scope. TypeRefs refer to type-defs in other scopes
and allow you to import a type from another scope. This function attempts to determine
which type-def a type-ref points to.
This resolve (type-ref, this cope) --> (type-def=*ptd, other scope=*ppIScope)
However, this resolution requires knowing what modules have been loaded, which is not decided
until runtime via loader / fusion policy. Thus this interface can't possibly be correct since
it doesn't have that knowledge. Furthermore, when inspecting metadata from another process
(such as a debugger inspecting the debuggee's metadata), this API can be truly misleading.
This API usage should be avoided.
Minimal implementation of IMetadataImport that implements APIs used by SymReader and SymWriter.
A COM IStream implementation over memory. Supports just enough for DiaSymReader's PDB writing.
Also tuned for performance:
1. SetSize (and Seek beyond the length) is very fast and doesn't re-allocate the underlying memory.
2. Read and Write are optimized to avoid copying (see )
3. Allocates in chunks instead of a contiguous buffer to avoid re-alloc and copy costs when growing.
This is a re-definition of COM's IStream interface. The important change is that
the Read and Write methods take an instead of a byte[] to avoid the
allocation cost when called from native code.
Adds compiler version number and name.
The highest version of the interface available on Desktop FX 4.0+.
has type , rather than ,
so that we can do custom marshalling of . Unfortunately, .NET marshals
s as the number of days since 1899/12/30, whereas the native VB compiler
marshalled them as the number of ticks since the Unix epoch (i.e. a much, much larger number).
Open a special custom data section to emit token to source span mapping information into.
Opening this section while a method is already open or vice versa is an error.
Close the special custom data section for token to source span mapping
information. Once it is closed no more mapping information can be added.
Maps the given metadata token to the given source line span in the specified source file.
Must be called between calls to and .
The highest version of the interface available in Microsoft.DiaSymReader.Native.
A struct with the same size and layout as the native VARIANT type:
2 bytes for a discriminator (i.e. which type of variant it is).
6 bytes of padding
8 or 16 bytes of data
This field determines the size of the struct
(16 bytes on 32-bit platforms, 24 bytes on 64-bit platforms).
This type is 8 bytes on a 32-bit platforms and 16 bytes on 64-bit platforms.
Windows PDB writer.
Disposes the writer.
Gets the raw data blobs that comprise the written PDB content so far.
Writes the PDB data to specified stream. Once called no more changes to the data can be made using this writer.
May be called multiple times. Always writes the same data.
Stream to write PDB data to.
Error occurred while writing data to the stream.
The capacity of document table.
Whenever a document is defined an entry is added to this table.
If the number of documents is known upfront setting this value may reduce memory consumption.
Defines a source document.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Defines sequence points.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Opens a method.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Closes a method previously open using .
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Opens a local scope.
Object has been disposed.
Writes are not allowed to the underlying stream.
Closes a local scope previously open using .
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Defines a local variable.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Defines a local constant.
Name of the constant.
Value.
Standalone signature token encoding the static type of the constant.
False if the constant representation is too long (e.g. long string).
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
is null
Adds namespace import.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
is null
Sets method async information.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
or is null
or differ in length.
Associates custom debug information blob with the current method.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
is null
Designates specified method as an entry point.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Updates the current PDB signature.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Gets the current PDB signature.
Object has been disposed.
Error occurred while writing PDB data.
Sets source server data blob (srcsvr stream).
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
is null
Sets source link data blob (sourcelink stream).
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
is null
Opens a map of tokens to source spans.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Maps specified token to a source span.
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
doesn't correspond to any defined document.
Closes map of tokens to source spans previously opened using .
Object has been disposed.
Writes are not allowed to the underlying stream.
Error occurred while writing PDB data.
Writes compiler version and name to the PDB.
Major version
Minor version
Build
Revision
Compiler name
Object has been disposed.
Error occurred while writing PDB data.
The PDB writer does not support adding compiler info.
is null.
creation options.
Default options.
Use environment variable MICROSOFT_DIASYMREADER_NATIVE_ALT_LOAD_PATH to locate Microsoft.DiaSymReader.Native.{platform}.dll.
Use COM registry to locate an implementation of the writer.
Create a deterministic PDB writer.
Exception reported when PDB write operation fails.
The name of the module that implements the underlying PDB writer (e.g. diasymreader.dll), or null if not available.
Creates a Windows PDB writer.
implementation.
Options.
Tries to load the implementation of the PDB writer from Microsoft.DiaSymReader.Native.{platform}.dll library first.
It searches for this library in the directory Microsoft.DiaSymReader.dll is loaded from,
the application directory, the %WinDir%\System32 directory, and user directories in the DLL search path, in this order.
If not found in the above locations and option is specified
the directory specified by MICROSOFT_DIASYMREADER_NATIVE_ALT_LOAD_PATH environment variable is also searched.
If the Microsoft.DiaSymReader.Native.{platform}.dll library can't be found and
option is specified checks if the PDB reader is available from a globally registered COM object. This COM object is provided
by .NET Framework and has limited functionality (features like determinism and source link are not supported).
is null.
The SymWriter implementation is not available or failed to load.
Error creating the PDB writer. See inner exception for root cause.
Writes the content to the given stream. The writer is disposed and can't be used for further writing.
This class is used to store the module serialization properties for a compilation.
The alignment factor (in bytes) that is used to align the raw data of sections in the image file.
The value should be a power of 2 between 512 and 64K, inclusive. The default is 512.
The alignment (in bytes) of sections when they are loaded into memory.
It must be greater than or equal to .
The default is the page size for the architecture.
Identifies the version of the CLR that is required to load this module or assembly.
Specifies the target CPU. means AnyCPU.
A globally unique persistent identifier for this module.
The preferred memory address at which the module is to be loaded at runtime.
The size of the virtual memory to reserve for the initial process heap.
Must fit into 32 bits if the target platform is 32 bit.
The size of the virtual memory initially committed for the initial process heap.
Must fit into 32 bits if the target platform is 32 bit.
The size of the virtual memory to reserve for the initial thread's stack.
Must fit into 32 bits if the target platform is 32 bit.
The first part of a two part version number indicating the version of the linker that produced this module. For example, the 8 in 8.0.
The first part of a two part version number indicating the version of the linker that produced this module. For example, the 0 in 8.0.
Flags that control the behavior of the target operating system. CLI implementations are supposed to ignore this, but some operating system pay attention.
Write document entries for all debug documents that do not yet have an entry.
This is done after serializing method debug info to ensure that we embed all requested
text even if there are no corresponding sequence points.
Represents an assembly reference with an alias (C# only, /r:Name=Reference on command line).
An alias for the global namespace of the assembly.
The assembly reference.
Names for compilation options that get embedded as debug information
in the PDB as key-value pairs.
REMOVAL OR CHANGES TO EXISTING VALUES IS CONSIDERED A BREAKING CHANGE FOR PDB FORMAT
System.Runtime.InteropServices.VarEnum is obsolete.
An object corresponding to a metadata entity such as a type or a field.
True if the definition represents a definition deleted during EnC.
No-PIA embedded definition.
An object corresponding to reference to a metadata entity such as a type or a field.
A collection of metadata custom attributes that are associated with this definition.
Calls the visitor.Visit(T) method where T is the most derived object model node interface type implemented by the concrete type
of the object implementing IDefinition. The dispatch method does not invoke Dispatch on any child objects. If child traversal
is desired, the implementations of the Visit methods should do the subsequent dispatching.
Gets the definition object corresponding to this reference within the given context,
or null if the referenced entity isn't defined in the context.
Returns underlying internal symbol object, if any.
Returns true if the namespace scope for this method should be forwarded to another method.
Returns non-null if the forwarding should be done directly via UsingNamespace,
null if the forwarding is done via custom debug info.
Use to create a document when checksum is computed based on actual source stream.
Use to create a document when checksum is suggested via external checksum pragma/directive
returns true when checksum was computed base on an actual source stream
as opposed to be suggested via a checksum directive/pragma
Represents the portion of a that are derived
from the source document content, and which can be computed asynchronously.
The ID of the hash algorithm used.
The hash of the document content.
The source text to embed in the PDB. (If any, otherwise default.)
A region representing an exception handler clause. The region exposes the type (catch or
finally) and the bounds of the try block and catch or finally block as needed by
Label instruction corresponding to the start of try block
Label instruction corresponding to the end of try block
Label instruction corresponding to the start of handler block
Label instruction corresponding to the end of handler block
Handler kind for this SEH info
If HandlerKind == HandlerKind.Catch, this is the type of exception to catch. If HandlerKind == HandlerKind.Filter, this is System.Object.
Otherwise this is a Dummy.TypeReference.
Label instruction corresponding to the start of filter decision block
Info needed when emitting ExportedType table entry.
The target type reference.
True if this represents a type forwarder definition,
false if it represents a type from a linked netmodule.
If is a nested type defined in a linked netmodule,
the index of the entry that represents the enclosing type.
An expression that can be represented directly in metadata.
Calls the visitor.Visit(T) method where T is the most derived object model node interface type implemented by the concrete type
of the object implementing IStatement. The dispatch method does not invoke Dispatch on any child objects. If child traversal
is desired, the implementations of the Visit methods should do the subsequent dispatching.
The type of value the expression represents.
An expression that represents a (name, value) pair and that is typically used in method calls, custom attributes and object initializers.
The name of the parameter or property or field that corresponds to the argument.
The value of the argument.
True if the named argument provides the value of a field.
This PEBuilder adds an .mvid section.
A metadata custom attribute.
Zero or more positional arguments for the attribute constructor.
A reference to the constructor that will be used to instantiate this custom attribute during execution (if the attribute is inspected via Reflection).
Zero or more named arguments that specify values for fields and properties of the attribute.
The number of positional arguments.
The number of named arguments.
The type of the attribute. For example System.AttributeUsageAttribute.
Whether attribute allows multiple.
Represents a file referenced by an assembly.
True if the file has metadata.
File name with extension.
A hash of the file contents.
Represents a lexical scope that declares imports.
Zero or more used namespaces. These correspond to using directives in C# or Imports syntax in VB.
Multiple invocations return the same array instance.
Parent import scope, or null.
A range of CLR IL operations that comprise a lexical scope.
The offset of the first operation in the scope.
The offset of the first operation outside of the scope, or the method body length.
Returns zero or more local constant definitions that are local to the given scope.
Returns zero or more local variable definitions that are local to the given scope.
streamProvider callers will dispose result after use.
and are mutually exclusive.
Specifies how the caller passes parameters to the callee and who cleans up the stack.
C/C++ style calling convention for unmanaged methods. The call stack is cleaned up by the caller,
which makes this convention suitable for calling methods that accept extra arguments.
The convention for calling managed methods with a fixed number of arguments.
The convention for calling managed methods that accept extra arguments.
Arguments are passed in registers when possible. This calling convention is not yet supported.
Win32 API calling convention for calling unmanaged methods via PlatformInvoke. The call stack is cleaned up by the callee.
C++ member unmanaged method (non-vararg) calling convention. The callee cleans the stack and the this pointer is pushed on the stack last.
Extensible calling convention protocol. This represents either the union of calling convention modopts after the paramcount specifier
in IL, or platform default if none are present
The convention for calling a generic method.
The convention for calling an instance method with an implicit this parameter (the method does not have an explicit parameter definition for this).
The convention for calling an instance method that explicitly declares its first parameter to correspond to the this instance.
Compares calling conventions, ignoring calling convention attributes.
An event is a member that enables an object or class to provide notifications. Clients can attach executable code for events by supplying event handlers.
This interface models the metadata representation of an event.
A list of methods that are associated with the event.
The method used to add a handler to the event.
The method used to call the event handlers when the event occurs. May be null.
True if the event gets special treatment from the runtime.
This event is special in some way, as specified by the name.
The method used to add a handler to the event.
The (delegate) type of the handlers that will handle the event.
A field is a member that represents a variable associated with an object or class.
This interface models the metadata representation of a field.
The compile time value of the field. This value should be used directly in IL, rather than a reference to the field.
If the field does not have a valid compile time value, Dummy.Constant is returned.
Mapped field data, or null if the field is not mapped.
This field is a compile-time constant. The field has no runtime location and cannot be directly addressed from IL.
This field has associated field marshalling information.
The field does not have to be serialized when its containing instance is serialized.
This field can only be read. Initialization takes place in a constructor.
True if the field gets special treatment from the runtime.
This field is special in some way, as specified by the name.
This field is static (shared by all instances of its declaring type).
Specifies how this field is marshalled when it is accessed from unmanaged code.
Checked if IsMarshalledExplicitly == true and MarshallingInformation is null
Offset of the field.
A reference to a field.
The type of value that is stored in this field.
The list of custom modifiers, if any, associated with the ref modifier.
True if the field contains a managed pointer.
The Field being referred to.
True, if field is an IContextualNamedEntity, even if field reference implements the interface,
doesn't mean it is contextual.
An object that represents a local variable or constant.
The compile time value of the definition, if it is a local constant.
Custom modifiers associated with local variable definition.
TODO: use instead.
True if the value referenced by the local must not be moved by the actions of the garbage collector.
TODO: use instead.
True if the local contains a managed pointer (for example a reference to a local variable or a reference to a field of an object).
Each local has an attributes field in the PDB. To match the native compiler,
we emit for locals that should
definitely not bind in the debugger and
for all other locals.
A value of is a sufficient, but not a necessary, condition for hiding the
local in the debugger. Locals with value may also be hidden.
Hidden locals must still be emitted because they participate in evaluation.
The synthesized dynamic attributes of the local definition if any, or empty.
The tuple element names of the local definition if any, or empty.
The type of the local.
Location for reporting diagnostics about the local.
Use rather than null.
Slot index or -1 if not applicable.
Optional serialized local signature.
Local id, or if this is a local constant, short-lived temp variable,
or we are not emitting local variable ids (release builds).
A metadata (IL) level representation of the body of a method or of a property/event accessor.
A list exception data within the method body IL.
True if the locals are initialized by zeroing the stack upon method entry.
True if there's a stackalloc somewhere in the method.
The local variables of the method.
The definition of the method whose body this is.
If this is the body of an event or property accessor, this will hold the corresponding adder/remover/setter or getter method.
Debugging information associated with a MoveNext method of a state machine.
The maximum number of elements on the evaluation stack during the execution of the method.
Returns true if there is at least one dynamic local within the MethodBody
Returns zero or more local (block) scopes into which the CLR IL operations in the given method body is organized.
Returns an import scope the method is declared within, or null if there is none
(e.g. the method doesn't contain user code).
The chain is a spine of a tree in a forest of import scopes. A tree of import scopes is created by the language for each source file
based on namespace declarations. In VB each tree is trivial single-node tree that declares the imports of a file.
In C# the tree copies the nesting of namespace declarations in the file. There is a separate scope for each dotted component in
the namespace type name. For instance namespace type x.y.z will have two namespace scopes, the first is for the x and the second
is for the y.
Returns debug information for local variables hoisted to state machine fields,
or null if this method isn't MoveNext method of a state machine.
Returns zero or more local (block) scopes, each defining an IL range in which an iterator local is defined.
The scopes are returned for the MoveNext method of the object returned by the iterator method.
The index of the scope corresponds to the index of the local. Specifically local scope i corresponds
to the local stored in a field named <localName>5__i of the class used to store the local values in
between calls to MoveNext, where localName is the original name of the local variable. For example, if
the first local to be moved into the class is named "xyzzy", it will be stored in a field named
"<xyzzy>5__1", and the ILocalScope returned from this method at index 1 (i.e. the second one) will
have the scope information for where that variable is in scope.
The name of the state machine generated for the method,
or null if the method isn't the kickoff method of a state machine.
Returns information relevant to EnC on slots of local variables hoisted to state machine fields,
or null if the method isn't the kickoff method of a state machine.
Returns types of awaiter slots allocated on the state machine,
or null if the method isn't the kickoff method of a state machine.
Ordered by .
Code coverage spans produced by instrumentation.
if not applicable.
True if this is a body of a Primary Constructor.
This interface models the metadata representation of a method.
True if the method definition has a body.
Returns true regardless of whether the body ends up actually emitted or not.
A container for a list of IL instructions providing the implementation (if any) of this method.
When emitting metadata-only assemblies this returns null even if returns true.
If the method is generic then this list contains the type parameters.
True if this method has a non empty collection of SecurityAttributes or the System.Security.SuppressUnmanagedCodeSecurityAttribute.
True if the method does not provide an implementation.
True if the method can only be overridden when it is also accessible.
True if the method is a constructor.
True if the method has an external implementation (i.e. not supplied by this definition).
If the method is not external and not abstract it has to provide an IL body.
True if this method is hidden if a derived type declares a method with the same name and signature.
If false, any method with the same name hides this method. This flag is ignored by the runtime and is only used by compilers.
The method always gets a new slot in the virtual method table.
This means the method will hide (not override) a base type method with the same name and signature.
True if the method is implemented via the invocation of an underlying platform method.
True if the method gets special treatment from the runtime. For example, it might be a constructor.
True if the method may not be overridden.
True if the method is special in some way for tools. For example, it might be a property getter or setter.
True if the method does not require an instance of its declaring type as its first argument.
True if the method may be overridden (or if it is an override).
Implementation flags.
The parameters forming part of this signature.
Detailed information about the PInvoke stub. Identifies which method to call, which module has the method and the calling convention among other things.
True if the method calls another method containing security code. If this flag is set, the method
should have System.Security.DynamicSecurityMethodAttribute present in its list of custom attributes.
Custom attributes associated with the method's return value.
The return value has associated marshalling information.
Specifies how the return value is marshalled when the method is called from unmanaged code.
Checked if ReturnValueIsMarshalledExplicitly == true and ReturnValueMarshallingInformation is null
Declarative security actions for this method.
Namespace containing this method.
TODO: Ideally we would expose INamespace on INamespaceTypeDefinition. Right now we can only get the qualified namespace name.
This interface models the metadata representation of a method or property parameter.
A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
Null if the parameter doesn't have default value.
True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
True if the argument value must be included in the marshalled arguments passed to a remote callee.
This parameter has associated marshalling information.
True if the argument value must be included in the marshalled arguments passed to a remote callee only if it is different from the default value (if there is one).
True if the final value assigned to the parameter will be marshalled with the return values passed back from a remote callee.
Specifies how this parameter is marshalled when it is accessed from unmanaged code.
Checked if IsMarshalledExplicitly == true and MarshallingInformation is null
A property is a member that provides access to an attribute of an object or a class.
This interface models the metadata representation of a property.
A list of methods that are associated with the property.
A compile time constant value that provides the default value for the property. (Who uses this and why?)
The method used to get the value of this property. May be absent (null).
True if this property has a compile time constant associated with that serves as a default value for the property. (Who uses this and why?)
True if this property gets special treatment from the runtime.
True if this property is special in some way, as specified by the name.
The parameters forming part of this signature.
The method used to set the value of this property. May be absent (null).
The parameters and return type that makes up a method or property signature.
This interface models the metadata representation of a signature.
Calling convention of the signature.
The number of required parameters of the signature.
The parameters forming part of this signature.
Returns the list of custom modifiers, if any, associated with the return type.
Returns the list of custom modifiers, if any, associated with the ref modifier.
True if the return value is passed by reference (using a managed pointer).
The return type of the method or type of the property.
A member of a type definition, such as a field or a method.
This interface models the metadata representation of a type member.
The type definition that contains this member.
Indicates if the member is public or confined to its containing type, derived types and/or declaring assembly.
A reference to a member of a type, such as a field or a method.
This interface models the metadata representation of a type member reference.
A reference to the containing type of the referenced type member.
Represents the specialized event definition.
The event that has been specialized to obtain this event. When the containing type is an instance of type which is itself a specialized member (i.e. it is a nested
type of a generic type instance), then the unspecialized member refers to a member from the unspecialized containing type. (I.e. the unspecialized member always
corresponds to a definition that is not obtained via specialization.)
Represents reference specialized field.
A reference to the field definition that has been specialized to obtain the field definition referred to by this field reference.
When the containing type of the referenced specialized field definition is itself a specialized nested type of a generic type instance,
then the unspecialized field reference refers to the corresponding field definition from the unspecialized containing type definition.
(I.e. the unspecialized field reference always refers to a field definition that is not obtained via specialization.)
Represents reference specialized method.
A reference to the method definition that has been specialized to obtain the method definition referred to by this method reference.
When the containing type of the referenced specialized method definition is itself a specialized nested type of a generic type instance,
then the unspecialized method reference refers to the corresponding method definition from the unspecialized containing type definition.
(I.e. the unspecialized method reference always refers to a method definition that is not obtained via specialization.)
Represents the specialized property definition.
The property that has been specialized to obtain this property. When the containing type is an instance of type which is itself a specialized member (i.e. it is a nested
type of a generic type instance), then the unspecialized member refers to a member from the unspecialized containing type. (I.e. the unspecialized member always
corresponds to a definition that is not obtained via specialization.)
A reference to a method.
True if the call sites that references the method with this object supply extra arguments.
The number of generic parameters of the method. Zero if the referenced method is not generic.
The method being referred to.
Information about this types of the extra arguments supplied at the call sites that references the method with this object.
A reference to generic method instantiated with a list of type arguments.
The type arguments that were used to instantiate this.GenericMethod in order to create this method.
Returns the generic method of which this method is an instance.
Represents a global field in symbol table.
Represents a global method in symbol table.
The name of the method.
Default implementations for interface methods.
When emitting ref assemblies, some members will not be included.
A visitor base class that traverses the object model in depth first, left to right order.
Use this routine, rather than ITypeReference.Dispatch, to call the appropriate derived overload of an ITypeReference.
The former routine will call Visit(INamespaceTypeDefinition) rather than Visit(INamespaceTypeReference), etc.,
in the case where a definition is used as a reference to itself.
A reference to a type definition. Note that a type definition can serve as a reference to itself.
Use this routine, rather than IUnitReference.Dispatch, to call the appropriate derived overload of an IUnitReference.
The former routine will call Visit(IAssembly) rather than Visit(IAssemblyReference), etc.
in the case where a definition is used as the reference to itself.
A reference to a unit. Note that a unit can serve as a reference to itself.
This is the maximum length of a type or member name in metadata, assuming
the name is in UTF-8 format and not (yet) null-terminated.
Source names may have to be shorter still to accommodate mangling.
Used for event names, field names, property names, field names, method def names,
member ref names, type def (full) names, type ref (full) names, exported type
(full) names, parameter names, manifest resource names, and unmanaged method names
(ImplMap table).
See CLI Part II, section 22.
This is the maximum length of a path in metadata, assuming the path is in UTF-8
format and not (yet) null-terminated.
Used for file names, module names, and module ref names.
See CLI Part II, section 22.
This is the maximum length of a string in the PDB, assuming it is in UTF-8 format
and not (yet) null-terminated.
Used for import strings, locals, and local constants.
Returns true if writing full metadata, false if writing delta.
True if writing delta metadata in a minimal format.
NetModules and EnC deltas don't have AssemblyDef record.
We don't emit it for EnC deltas since assembly identity has to be preserved across generations (CLR/debugger get confused otherwise).
Returns metadata generation ordinal. Zero for
full metadata and non-zero for delta.
Returns unique Guid for this delta, or default(Guid)
if full metadata.
Returns Guid of previous delta, or default(Guid)
if full metadata or generation 1 delta.
Returns true and full metadata handle of the type definition
if the type definition is recognized. Otherwise returns false.
Get full metadata handle of the type definition.
The type definition corresponding to full metadata type handle.
Deltas are only required to support indexing into current generation.
The type definitions to be emitted, in row order. These
are just the type definitions from the current generation.
Get full metadata handle of the event definition.
The event definitions to be emitted, in row order. These
are just the event definitions from the current generation.
Get full metadata handle of the field definition.
The field definitions to be emitted, in row order. These
are just the field definitions from the current generation.
Returns true and handle of the method definition
if the method definition is recognized. Otherwise returns false.
The index is into the full metadata.
Get full metadata handle of the method definition.
The method definition corresponding to full metadata method handle.
Deltas are only required to support indexing into current generation.
The method definitions to be emitted, in row order. These
are just the method definitions from the current generation.
Get full metadata handle of the property definition.
The property definitions to be emitted, in row order. These
are just the property definitions from the current generation.
The full metadata handle of the parameter definition.
The parameter definitions to be emitted, in row order. These
are just the parameter definitions from the current generation.
The generic parameter definitions to be emitted, in row order. These
are just the generic parameter definitions from the current generation.
The handle of the first field of the type.
The handle of the first method of the type.
The handle of the first parameter of the method.
Return full metadata handle of the assembly reference, adding
the reference to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The assembly references to be emitted, in row order. These
are just the assembly references from the current generation.
Return full metadata handle of the module reference, adding
the reference to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The module references to be emitted, in row order. These
are just the module references from the current generation.
Return full metadata handle of the member reference, adding
the reference to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The member references to be emitted, in row order. These
are just the member references from the current generation.
Return full metadata handle of the method spec, adding
the spec to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The method specs to be emitted, in row order. These
are just the method specs from the current generation.
The greatest index given to any method definition.
Return true and full metadata handle of the type reference
if the reference is available in the current generation.
Deltas are not required to return rows from previous generations.
Return full metadata handle of the type reference, adding
the reference to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The type references to be emitted, in row order. These
are just the type references from the current generation.
Returns full metadata handle of the type spec, adding
the spec to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The type specs to be emitted, in row order. These
are just the type specs from the current generation.
Returns full metadata handle the standalone signature, adding
the signature to the index for this generation if missing.
Deltas are not required to return rows from previous generations.
The signature blob handles to be emitted, in row order. These
are just the signature indices from the current generation.
Return a visitor for traversing all references to be emitted.
Populate EventMap table.
Populate PropertyMap table.
Returns a reference to the unit that defines the given referenced type. If the referenced type is a structural type, such as a pointer or a generic type instance,
then the result is null.
The Microsoft CLR requires that {namespace} + "." + {name} fit in MAX_CLASS_NAME
(even though the name and namespace are stored separately in the Microsoft
implementation). Note that the namespace name of a nested type is always blank
(since comes from the container).
We're trying to add the containing namespace of this type to the string heap.
Namespace names are never used on their own - this is the type that is adding the namespace name.
Used only for length checking.
Test the given name to see if it fits in metadata.
String to test (non-null).
Max length for name. (Expected to be at least 5.)
True if the name is too long.
Internal for test purposes.
Serialize the method local signature to the blob.
Standalone signature token
Emit ldc.i4 of row id of an entity represented by the pseudo-token.
Emit ldc.i4 of the greatest row id assigned to a method definition in the module being built.
Emit ldc.i4 of row id of a source document represented by the pseudo-token.
Emit ldc.i4 of row id of the hoisted local variable or parameter field that the pseudo-token represents,
increased by .
Greater than any valid ordinal of a local variable or a parameter (0xffff).
Computes the string representing the strong name of the given assembly reference.
Import scopes are associated with binders (in C#) and thus multiple instances might be created for a single set of imports.
We consider scopes with the same parent and the same imports the same.
Internal for testing.
Write string as UTF-8 with null terminator.
Add document entries for all debug documents that do not yet have an entry.
This is done after serializing method debug info to ensure that we embed all requested
text even if there are no corresponding sequence points.
The version of the compilation options schema to be written to the PDB.
Capture the set of compilation options to allow a compilation
to be reconstructed from the pdb
Writes information about metadata references to the pdb so the same
reference can be found on sourcelink to create the compilation again
A container for static helper methods that are used for manipulating and computing iterators.
True if the given enumerable is not null and contains at least one element.
True if the given enumerable is null or contains no elements
Returns the number of elements in the given enumerable. A null enumerable is allowed and results in 0.
A declarative specification of a security action applied to a set of permissions. Used by the CLR loader to enforce security restrictions.
Each security attribute represents a serialized permission or permission set for a specified security action.
The union of the security attributes with identical security action, define the permission set to which the security action applies.
Information about how values of managed types should be marshalled to and from unmanaged types.
or a string (usually a fully-qualified type name of a type implementing the custom marshaller, but Dev11 allows any string).
An argument string (cookie) passed to the custom marshaller at run time.
The unmanaged element type of the unmanaged array.
-1 if it should be omitted from the marshal blob.
Specifies the index of the parameter that contains the value of the Interface Identifier (IID) of the marshalled object.
-1 if it should be omitted from the marshal blob.
The unmanaged type to which the managed type will be marshalled. This can be UnmanagedType.CustomMarshaler, in which case the unmanaged type
is decided at runtime.
The number of elements in the fixed size portion of the unmanaged array.
-1 if it should be omitted from the marshal blob.
The zero based index of the parameter in the unmanaged method that contains the number of elements in the variable portion of unmanaged array.
If -1, the variable portion is of size zero, or the caller conveys the size of the variable portion of the array to the unmanaged method in some other way.
The type to which the variant values of all elements of the safe array must belong. See also SafeArrayElementUserDefinedSubtype.
(The element type of a safe array is VARIANT. The "sub type" specifies the value of all of the tag fields (vt) of the element values. )
-1 if it should be omitted from the marshal blob.
A reference to the user defined type to which the variant values of all elements of the safe array must belong.
(The element type of a safe array is VARIANT. The tag fields will all be either VT_DISPATCH or VT_UNKNOWN or VT_RECORD.
The "user defined sub type" specifies the type of value the ppdispVal/ppunkVal/pvRecord fields of the element values may point to.)
Implemented by any entity that has a name.
The name of the entity.
The name of the entity depends on other metadata (tokens, signatures) originated from
PeWriter.
Method must be called before calling INamedEntity.Name.
Implemented by an entity that is always a member of a particular parameter list, such as an IParameterDefinition.
Provides a way to determine the position where the entity appears in the parameter list.
The position in the parameter list where this instance can be found.
Information that describes how a method from the underlying Platform is to be invoked.
Module providing the method/field.
Name of the method providing the implementation.
Flags that determine marshalling behavior.
A resource file formatted according to Win32 API conventions and typically obtained from a Portable Executable (PE) file.
See the Win32 UpdateResource method for more details.
A string that identifies what type of resource this is. Only valid if this.TypeId < 0.
An integer tag that identifies what type of resource this is. If the value is less than 0, this.TypeName should be used instead.
The name of the resource. Only valid if this.Id < 0.
An integer tag that identifies this resource. If the value is less than 0, this.Name should be used instead.
The language for which this resource is appropriate.
The code page for which this resource is appropriate.
The data of the resource.
Get a new instance of the that has of
at least
When true force zero out the backing buffer
The can be removed when moving to SRM 9.0 if it contains the bug fix for
https://github.com/dotnet/runtime/issues/99244
Set true before a type reference is visited but only if a token needs to be created for the type reference.
E.g. not set before return type of a method is visited since the type reference is encoded in the signature blob of the method.
On the other hand, it is true before the type of an event definition is visited since Event table stores the type of the event as a coded token (TypeDef/Ref/Spec).
Special type <Module>
Allows for the comparison of two instances or two
instances based on underlying symbols, if any.
Strip off *, &, and [].
Qualified name of namespace.
e.g. "A.B.C"
Visitor to force translation of all symbols that will be referred to
in metadata. Allows us to build the set of types that must be embedded
as local types (for NoPia).
This interface models the metadata representation of an array type reference.
The type of the elements of this array.
This type of array is a single dimensional array with zero lower bound for index values.
A possibly empty list of lower bounds for dimension indices. When not explicitly specified, a lower bound defaults to zero.
The first lower bound in the list corresponds to the first dimension. Dimensions cannot be skipped.
The number of array dimensions.
A possible empty list of upper bounds for dimension indices.
The first upper bound in the list corresponds to the first dimension. Dimensions cannot be skipped.
An unspecified upper bound means that instances of this type can have an arbitrary upper bound for that dimension.
Modifies the set of allowed values for a type, or the semantics of operations allowed on those values.
Custom modifiers are not associated directly with types, but rather with typed storage locations for values.
If true, a language may use the modified storage location without being aware of the meaning of the modification.
A type used as a tag that indicates which type of modification applies to the storage location.
Information that describes a method or property parameter, but does not include all the information in a IParameterDefinition.
The list of custom modifiers, if any, associated with the parameter type.
The list of custom modifiers, if any, associated with the ref modifier.
True if the parameter is passed by reference (using a managed pointer).
The type of argument value that corresponds to this parameter.
The definition of a type parameter of a generic type or method.
A list of classes or interfaces. All type arguments matching this parameter must be derived from all of the classes and implement all of the interfaces.
True if all type arguments matching this parameter are constrained to be reference types.
True if all type arguments matching this parameter are constrained to be value types.
True if all type arguments matching this parameter are constrained to be value types or concrete classes with visible default constructors.
Indicates if the generic type or method with this type parameter is co-, contra-, or non variant with respect to this type parameter.
A reference to the definition of a type parameter of a generic type or method.
The definition of a type parameter of a generic method.
The generic method that defines this type parameter.
A reference to a type parameter of a generic method.
A reference to the generic method that defines the referenced type parameter.
A generic type instantiated with a list of type arguments
The type arguments that were used to instantiate this.GenericType in order to create this type.
Returns the generic type of which this type is an instance.
Equivalent to Symbol.OriginalDefinition
The definition of a type parameter of a generic type.
The generic type that defines this type parameter.
A reference to a type parameter of a generic type.
A reference to the generic type that defines the referenced type parameter.
A reference to a named type, such as an INamespaceTypeReference or an INestedTypeReference.
The number of generic parameters. Zero if the type is not generic.
If true, the persisted type name is mangled by appending "`n" where n is the number of type parameters, if the number of type parameters is greater than 0.
Indicates that the type is scoped to the file it is declared in. Used as a prefix for the metadata name.
A named type definition, such as an INamespaceTypeDefinition or an INestedTypeDefinition.
A type definition that is a member of a namespace definition.
True if the type can be accessed from other assemblies.
Represents a namespace.
Containing namespace or null if this namespace is global.
Returns underlying internal symbol object, if any.
A reference to a type definition that is a member of a namespace definition.
A reference to the unit that defines the referenced type.
Fully qualified name of the containing namespace.
A type definition that is a member of another type definition.
A type definition that is a member of another type definition.
A reference to a type definition that is a specialized nested type.
A reference to the nested type that has been specialized to obtain this nested type reference. When the containing type is an instance of type which is itself a specialized member (i.e. it is a nested
type of a generic type instance), then the unspecialized member refers to a member from the unspecialized containing type. (I.e. the unspecialized member always
corresponds to a definition that is not obtained via specialization.)
Models an explicit implementation or override of a base class virtual method or an explicit implementation of an interface method.
The type that is explicitly implementing or overriding the base class virtual method or explicitly implementing an interface method.
A reference to the method that provides the implementation.
The type that is explicitly implementing or overriding the base class virtual method or explicitly implementing an interface method.
A type reference that has custom modifiers associated with it. For example a reference to the target type of a managed pointer to a constant.
Returns the list of custom modifiers associated with the type reference.
An unmodified type reference.
This interface models the metadata representation of a pointer to a location in unmanaged memory.
The type of value stored at the target memory location.
This interface models the metadata representation of a pointer to a function in unmanaged memory.
The signature of the function located at the target memory address.
A type ref with attributes attached directly to the type reference
itself. Unlike a
will never provide attributes
for the "pointed at" declaration, and all attributes will be emitted
directly on the type ref, rather than the declaration.
The type reference.
The attributes on the type reference itself.
This interface models the metadata representation of a type.
The byte alignment that values of the given type ought to have. Must be a power of 2. If zero, the alignment is decided at runtime.
Returns null for interfaces and System.Object.
Zero or more events defined by this type.
Zero or more implementation overrides provided by the class.
Zero or more fields defined by this type.
Zero or more parameters that can be used as type annotations.
The number of generic parameters. Zero if the type is not generic.
True if this type has a non empty collection of SecurityAttributes or the System.Security.SuppressUnmanagedCodeSecurityAttribute.
Zero or more interfaces implemented by this type.
True if the type may not be instantiated.
Is type initialized anytime before first access to static field
Is this imported from COM type library
True if this type is parameterized (this.GenericParameters is a non empty collection).
True if the type is an interface.
True if the type is a delegate.
True if this type gets special treatment from the runtime.
True if this type is serializable.
True if the type has special name.
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 may not be subtyped.
Layout of the type.
Zero or more methods defined by this type.
Zero or more nested types defined by this type.
Zero or more properties defined by this type.
Declarative security actions for this type. Will be empty if this.HasSecurity is false.
Size of an object of this type. In bytes. If zero, the size is unspecified and will be determined at runtime.
Default marshalling of the Strings in this class.
A reference to a type.
True if the type is an enumeration (it extends System.Enum and is sealed). Corresponds to C# enum.
True if the type is a value type.
Value types are sealed and extend System.ValueType or System.Enum.
A type parameter for which MustBeValueType (the struct constraint in C#) is true also returns true for this property.
The type definition being referred to.
Unless the value of TypeCode is PrimitiveTypeCode.NotPrimitive, the type corresponds to a "primitive" CLR type (such as System.Int32) and
the type code identifies which of the primitive types it corresponds to.
TypeDefs defined in modules linked to the assembly being emitted are listed in the ExportedTypes table.
A enumeration of all of the value types that are built into the Runtime (and thus have specialized IL instructions that manipulate them).
A single bit.
An unsigned 16 bit integer representing a Unicode UTF16 code point.
A signed 8 bit integer.
A 32 bit IEEE floating point number.
A 64 bit IEEE floating point number.
A signed 16 bit integer.
A signed 32 bit integer.
A signed 64 bit integer.
A signed 32 bit integer or 64 bit integer, depending on the native word size of the underlying processor.
A pointer to fixed or unmanaged memory.
A reference to managed memory.
A string.
An unsigned 8 bit integer.
An unsigned 16 bit integer.
An unsigned 32 bit integer.
An unsigned 64 bit integer.
An unsigned 32 bit integer or 64 bit integer, depending on the native word size of the underlying processor.
A type that denotes the absence of a value.
Not a primitive type.
A pointer to a function in fixed or managed memory.
Type is a dummy type.
Enumerates the different kinds of levels of visibility a type member can have.
The member is visible only within its own type.
The member is visible only within the intersection of its family (its own type and any subtypes) and assembly.
The member is visible only within its own assembly.
The member is visible only within its own type and any subtypes.
The member is visible only within the union of its family and assembly.
The member is visible everywhere its declaring type is visible.
Enumerates the different kinds of variance a generic method or generic type parameter may have.
Two type or method instances are compatible only if they have exactly the same type argument for this parameter.
A type or method instance will match another instance if it has a type for this parameter that is the same or a subtype of the type the
other instance has for this parameter.
A type or method instance will match another instance if it has a type for this parameter that is the same or a supertype of the type the
other instance has for this parameter.
A reference to a .NET assembly.
A reference to a .NET module.
The Assembly that contains this module. May be null if the module is not part of an assembly.
A unit of metadata stored as a single artifact and potentially produced and revised independently from other units.
Examples of units include .NET assemblies and modules, as well C++ object files and compiled headers.
A reference to a instance of .
Represents a single using directive (Imports clause).
This partial contains methods that must be shared by source with the workspaces layer
Given a path to an assembly, finds the paths to all of its satellite
assemblies.
If the file at does not exist or cannot be accessed.
If the file is not an assembly or is somehow corrupted.
Given a path to an assembly and a set of paths to possible dependencies,
identifies which of the assembly's references are missing. May throw.
If the files does not exist or cannot be accessed.
If one of the files is not an assembly or is somehow corrupted.
Given a path to an assembly, returns the for the assembly.
May throw.
If the file at does not exist or cannot be accessed.
If the file is not an assembly or is somehow corrupted.
Given a path to an assembly, returns its MVID (Module Version ID).
May throw.
If the file at does not exist or cannot be accessed.
If the file is not an assembly or is somehow corrupted.
Catches exceptions thrown during disposal of the underlying stream and
writes them to the given . Check
after disposal to see if any
exceptions were thrown during disposal.
Underlying stream
True if and only if an exception was thrown during a call to
Full case-insensitive path.
Last write time (UTC).
Constructor.
Full path.
Last write time (UTC).
Resolves relative path and returns absolute path.
The method depends only on values of its parameters and their implementation (for fileExists).
It doesn't itself depend on the state of the current process (namely on the current drive directories) or
the state of file system.
Path to resolve.
Base file path to resolve CWD-relative paths against. Null if not available.
Base directory to resolve CWD-relative paths against if isn't specified.
Must be absolute path.
Null if not available.
Sequence of paths used to search for unqualified relative paths.
Method that tests existence of a file.
The resolved path or null if the path can't be resolved or does not exist.
Normalizes an absolute path.
Path to normalize.
Normalized path.
Used to create a file given a path specified by the user.
paramName - Provided by the Public surface APIs to have a clearer message. Internal API just rethrow the exception
Preferred mechanism to obtain both length and last write time of a file. Querying independently
requires multiple i/o hits which are expensive, even if cached.
Abstraction over the file system that is useful for test hooks
Open a file and ensure common exception types are wrapped to .
Null or empty.
"file"
".\file"
"..\file"
"\dir\file"
"C:dir\file"
"C:\file" or "\\machine" (UNC).
True if the character is the platform directory separator character or the alternate directory separator.
True if the character is any recognized directory separator character.
Removes trailing directory separator characters
This will trim the root directory separator:
"C:\" maps to "C:", and "/" maps to ""
Ensures a trailing directory separator character
Get directory name from path.
Unlike it doesn't check for invalid path characters
Prefix of path that represents a directory
Gets the root part of the path.
Gets the specific kind of relative or absolute path.
True if the path is an absolute path (rooted to drive or network share)
Returns true if given path is absolute and starts with a drive specification ("C:\").
Combines an absolute path with a relative.
Absolute root path.
Relative path.
An absolute combined path, or null if is
absolute (e.g. "C:\abc", "\\machine\share\abc"),
relative to the current root (e.g. "\abc"),
or relative to a drive directory (e.g. "C:abc\def").
Combine two paths, the first of which may be absolute.
First path: absolute, relative, or null.
Second path: relative and non-null.
null, if is null; a combined path, otherwise.
Combines paths with the same semantics as
but does not throw on null paths or paths with invalid characters.
First path: absolute, relative, or null.
Second path: absolute, relative, or null.
The combined paths. If contains an absolute path, returns .
Relative and absolute paths treated the same as .
Determines whether an assembly reference is considered an assembly file path or an assembly name.
used, for example, on values of /r and #r.
Determines if "path" contains 'component' within itself.
i.e. asking if the path "c:\goo\bar\baz" has component "bar" would return 'true'.
On the other hand, if you had "c:\goo\bar1\baz" then it would not have "bar" as a
component.
A path contains a component if any file name or directory name in the path
matches 'component'. As such, if you had something like "\\goo" then that would
not have "goo" as a component. That's because here "goo" is the server name portion
of the UNC path, and not an actual directory or file name.
Gets a path relative to a directory.
True if the child path is a child of the parent path.
True if the two paths are the same.
True if the two paths are the same. (but only up to the specified length)
Unfortunately, we cannot depend on Path.GetInvalidPathChars() or Path.GetInvalidFileNameChars()
From MSDN: The array returned from this method is not guaranteed to contain the complete set of characters
that are invalid in file and directory names. The full set of invalid characters can vary by file system.
https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidfilenamechars.aspx
Additionally, Path.GetInvalidPathChars() doesn't include "?" or "*" which are invalid characters,
and Path.GetInvalidFileNameChars() includes ":" and "\" which are valid characters.
The more accurate way is to let the framework parse the path and throw on any errors.
If the current environment uses the '\' directory separator, replaces all uses of '\'
in the given string with '/'. Otherwise, returns the string.
This method is equivalent to Microsoft.CodeAnalysis.BuildTasks.GenerateMSBuildEditorConfig.NormalizeWithForwardSlash
Both methods should be kept in sync.
Replaces all sequences of '\' or '/' with a single '/' but preserves UNC prefix '//'.
Takes an absolute path and attempts to expand any '..' or '.' into their equivalent representation.
An equivalent path that does not contain any '..' or '.' path parts, or the original path.
This method handles unix and windows drive rooted absolute paths only (i.e /a/b or x:\a\b). Passing any other kind of path
including relative, drive relative, unc, or windows device paths will simply return the original input.
Search a sorted integer array for the target value in O(log N) time.
The array of integers which must be sorted in ascending order.
The target value.
An index in the array pointing to the position where should be
inserted in order to maintain the sorted order. All values to the right of this position will be
strictly greater than . Note that this may return a position off the end
of the array if all elements are less than or equal to .
A write-only memory stream backed by a .
The chunk size to be used by the underlying BlobBuilder.
The current single use case for this type is embedded sources in PDBs.
32 KB is:
* Large enough to handle 99.6% all VB and C# files in Roslyn and CoreFX
without allocating additional chunks.
* Small enough to avoid the large object heap.
* Large enough to handle the files in the 0.4% case without allocating tons
of small chunks. Very large source files are often generated in build
(e.g. Syntax.xml.Generated.vb is 390KB compressed!) and those are actually
attractive candidates for embedding, so we don't want to discount the large
case too heavily.)
* We pool the outer BlobBuildingStream but only retain the first allocated chunk.
Provide structural equality for ReadOnlyMemory{char} instances.
Split a command line by the same rules as Main would get the commands except the original
state of backslashes and quotes are preserved. For example in normal Windows command line
parsing the following command lines would produce equivalent Main arguments:
- /r:a,b
- /r:"a,b"
This method will differ as the latter will have the quotes preserved. The only case where
quotes are removed is when the entire argument is surrounded by quotes without any inner
quotes.
Rules for command line parsing, according to MSDN:
Arguments are delimited by white space, which is either a space or a tab.
A string surrounded by double quotation marks ("string") is interpreted
as a single argument, regardless of white space contained within.
A quoted string can be embedded in an argument.
A double quotation mark preceded by a backslash (\") is interpreted as a
literal double quotation mark character (").
Backslashes are interpreted literally, unless they immediately precede a
double quotation mark.
If an even number of backslashes is followed by a double quotation mark,
one backslash is placed in the argv array for every pair of backslashes,
and the double quotation mark is interpreted as a string delimiter.
If an odd number of backslashes is followed by a double quotation mark,
one backslash is placed in the argv array for every pair of backslashes,
and the double quotation mark is "escaped" by the remaining backslash,
causing a literal double quotation mark (") to be placed in argv.
Parse the value provided to an MSBuild Feature option into a list of entries. This will
leave name=value in their raw form.
NOTE!!! adding duplicates will result in exceptions.
Being concurrent only allows accessing the dictionary without taking locks.
Duplicate keys are still not allowed in the hashtable.
If unsure about adding unique items use APIs such as TryAdd, GetOrAdd, etc...
A concurrent, simplified HashSet.
The default concurrency level is 2. That means the collection can cope with up to two
threads making simultaneous modifications without blocking.
Note ConcurrentDictionary's default concurrency level is dynamic, scaling according to
the number of processors.
Taken from ConcurrentDictionary.DEFAULT_CAPACITY
The backing dictionary. The values are never used; just the keys.
Construct a concurrent set with the default concurrency level.
Construct a concurrent set using the specified equality comparer.
The equality comparer for values in the set.
Obtain the number of elements in the set.
The number of elements in the set.
Determine whether the set is empty.
true if the set is empty; otherwise, false.
Determine whether the given value is in the set.
The value to test.
true if the set contains the specified value; otherwise, false.
Attempts to add a value to the set.
The value to add.
true if the value was added to the set. If the value already exists, this method returns false.
Attempts to remove a value from the set.
The value to remove.
true if the value was removed successfully; otherwise false.
Clear the set
Obtain an enumerator that iterates through the elements in the set.
An enumerator for the set.
A custom awaiter that supports for
.
a simple Lisp-like immutable list. Good to use when lists are always accessed from the head.
Generally is a sufficient method for enforcing DEBUG
only invariants in our code. When it triggers that provides a nice stack trace for
investigation. Generally that is enough.
There are cases for which a stack is not enough and we need a full heap dump to
investigate the failure. This method takes care of that. The behavior is that when running
in our CI environment if the assert triggers we will rudely crash the process and
produce a heap dump for investigation.
Names of well-known XML attributes and elements.
Very cheap trivial comparer that never matches the keys,
should only be used in empty dictionaries.
This method is necessary to avoid an ambiguity between and .
This method is necessary to avoid an ambiguity between and .
Maps an immutable array through a function that returns ValueTask, returning the new ImmutableArray.
Maps an immutable array through a function that returns ValueTask, returning the new ImmutableArray.
Maps an immutable array through a function that returns ValueTask, returning the new ImmutableArray.
Returns the only element of specified sequence if it has exactly one, and default(TSource) otherwise.
Unlike doesn't throw if there is more than one element in the sequence.
Cached versions of commonly used delegates.
Cached versions of commonly used delegates.
Creates an with information about an unexpected value.
The unexpected value.
The , which should be thrown by the caller.
Determine if an exception was an , and that the provided token caused the cancellation.
The exception to test.
Checked to see if the provided token was cancelled.
if the exception was an and the token was canceled.
Implements a few file name utilities that are needed by the compiler.
In general the compiler is not supposed to understand the format of the paths.
In rare cases it needs to check if a string is a valid file name or change the extension
(embedded resources, netmodules, output name).
The APIs are intentionally limited to cover just these rare cases. Do not add more APIs.
Returns true if the string represents an unqualified file name.
The name may contain any characters but directory and volume separators.
Path.
True if is a simple file name, false if it is null or includes a directory specification.
Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension.
Returns 0 for path ".goo".
Returns -1 for path "goo.".
Returns an extension of the specified path string.
The same functionality as but doesn't throw an exception
if there are invalid characters in the path.
Removes extension from path.
Returns "goo" for path "goo.".
Returns "goo.." for path "goo...".
Returns path with the extension changed to .
Equivalent of
If is null, returns null.
If path does not end with an extension, the new extension is appended to the path.
If extension is null, equivalent to .
Returns the position in given path where the file name starts.
-1 if path is null.
Get file name from path.
Unlike doesn't check for invalid path characters.
This is how VB Anonymous Types combine hash values for fields.
This is how VB Anonymous Types combine hash values for fields.
PERF: Do not use with enum types because that involves multiple
unnecessary boxing operations. Unfortunately, we can't constrain
T to "non-enum", so we'll use a more restrictive constraint.
The offset bias value used in the FNV-1a algorithm
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The generative factor used in the FNV-1a algorithm
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
Compute the FNV-1a hash of a sequence of bytes
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The sequence of bytes
The FNV-1a hash of
Compute the FNV-1a hash of a sequence of bytes and determines if the byte
sequence is valid ASCII and hence the hash code matches a char sequence
encoding the same text.
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The sequence of bytes that are likely to be ASCII text.
True if the sequence contains only characters in the ASCII range.
The FNV-1a hash of
Compute the FNV-1a hash of a sequence of bytes
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The sequence of bytes
The FNV-1a hash of
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
Note: FNV-1a was developed and tuned for 8-bit sequences. We're using it here
for 16-bit Unicode chars on the understanding that the majority of chars will
fit into 8-bits and, therefore, the algorithm will retain its desirable traits
for generating hash codes.
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
Note: FNV-1a was developed and tuned for 8-bit sequences. We're using it here
for 16-bit Unicode chars on the understanding that the majority of chars will
fit into 8-bits and, therefore, the algorithm will retain its desirable traits
for generating hash codes.
The input string
The start index of the first character to hash
The number of characters, beginning with to hash
The FNV-1a hash code of the substring beginning at and ending after characters.
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
The input string
The start index of the first character to hash
The FNV-1a hash code of the substring beginning at and ending at the end of the string.
Compute the hashcode of a string using FNV-1a
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The input string
The FNV-1a hash code of
Compute the hashcode of a string using FNV-1a
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The input string
The FNV-1a hash code of
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
The input string as a char array
The start index of the first character to hash
The number of characters, beginning with to hash
The FNV-1a hash code of the substring beginning at and ending after characters.
Compute the hashcode of a single character using the FNV-1a algorithm
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
Note: In general, this isn't any more useful than "char.GetHashCode". However,
it may be needed if you need to generate the same hash code as a string or
substring with just a single character.
The character to hash
The FNV-1a hash code of the character.
Combine a string with an existing FNV-1a hash code
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The accumulated hash code
The string to combine
The result of combining with using the FNV-1a algorithm
Combine a char with an existing FNV-1a hash code
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The accumulated hash code
The new character to combine
The result of combining with using the FNV-1a algorithm
Combine a string with an existing FNV-1a hash code
See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
The accumulated hash code
The string to combine
The result of combining with using the FNV-1a algorithm
Ensure that the given target value is initialized (not null) in a thread-safe manner.
The type of the target value. Must be a reference type.
The target to initialize.
A factory delegate to create a new instance of the target value. Note that this delegate may be called
more than once by multiple threads, but only one of those values will successfully be written to the target.
The target value.
Ensure that the given target value is initialized (not null) in a thread-safe manner.
The type of the target value. Must be a reference type.
The target to initialize.
The type of the argument passed to the value factory.
A factory delegate to create a new instance of the target value. Note that this delegate may be called
more than once by multiple threads, but only one of those values will successfully be written to the target.
An argument passed to the value factory.
The target value.
Ensure that the given target value is initialized in a thread-safe manner.
The target to initialize.
The value indicating is not yet initialized.
A factory delegate to create a new instance of the target value. Note that this delegate may be called
more than once by multiple threads, but only one of those values will successfully be written to the target.
An argument passed to the value factory.
The type of the argument passed to the value factory.
If returns a value equal to , future
calls to the same method may recalculate the target value.
The target value.
Ensure that the given target value is initialized in a thread-safe manner. This overload supports the
initialization of value types, and reference type fields where is considered an
initialized value.
The type of the target value.
A target value box to initialize.
A factory delegate to create a new instance of the target value. Note that this delegate may be called
more than once by multiple threads, but only one of those values will successfully be written to the target.
The target value.
Ensure that the given target value is initialized in a thread-safe manner. This overload supports the
initialization of value types, and reference type fields where is considered an
initialized value.
The type of the target value.
A target value box to initialize.
The type of the argument passed to the value factory.
A factory delegate to create a new instance of the target value. Note that this delegate may be called
more than once by multiple threads, but only one of those values will successfully be written to the target.
An argument passed to the value factory.
The target value.
Initialize the value referenced by in a thread-safe manner.
The value is changed to only if the current value is null.
Type of value.
Reference to the target location.
The value to use if the target is currently null.
The new value referenced by . Note that this is
nearly always more useful than the usual return from
because it saves another read to .
Initialize the value referenced by in a thread-safe manner.
The value is changed to only if the current value
is .
Type of value.
Reference to the target location.
The value to use if the target is currently uninitialized.
The uninitialized value.
The new value referenced by . Note that this is
nearly always more useful than the usual return from
because it saves another read to .
Initialize the immutable array referenced by in a thread-safe manner.
Elemental type of the array.
Reference to the target location.
The value to use if the target is currently uninitialized (default).
The new value referenced by . Note that this is
nearly always more useful than the usual return from
because it saves another read to .
Initialize the immutable array referenced by in a thread-safe manner.
Elemental type of the array.
Callback to produce the array if is 'default'. May be
called multiple times in the event of concurrent initialization of . Will not be
called if 'target' is already not 'default' at the time this is called.
The value of after initialization. If is
already initialized, that value value will be returned.
Initialize the immutable array referenced by in a thread-safe manner.
Elemental type of the array.
The type of the argument passed to the value factory.
Callback to produce the array if is 'default'. May be
called multiple times in the event of concurrent initialization of . Will not be
called if 'target' is already not 'default' at the time this is called.
The value of after initialization. If is
already initialized, that value value will be returned.
A simple, forward-only JSON writer to avoid adding dependencies to the compiler.
Used to generate /errorlogger output.
Does not guarantee well-formed JSON if misused. It is the caller's responsibility
to balance array/object start/end, to only write key-value pairs to objects and
elements to arrays, etc.
Takes ownership of the given at construction and handles its disposal.
Represents a single item or many items (including none).
Used when a collection usually contains a single item but sometimes might contain multiple.
True if the collection has a single item. This item is stored in .
This class provides simple properties for determining whether the current platform is Windows or Unix-based.
We intentionally do not use System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(...) because
it incorrectly reports 'true' for 'Windows' in desktop builds running on Unix-based platforms via Mono.
Are we running on .NET 5 or later using the Mono runtime?
Will also return true when running on Mono itself; if necessary
we can use IsRunningOnMono to distinguish.
Compares objects based upon their reference identity.
Find a instance by first probing the contract name and then the name as it
would exist in mscorlib. This helps satisfy both the CoreCLR and Desktop scenarios.
A set that returns the inserted values in insertion order.
The mutation operations are not thread-safe.
A lazily initialized version of which uses the same space as a .
One of three values:
- 0. is not initialized yet.
- 1. is currently being initialized by some thread.
- 2. has been initialized.
Actual stored value. Only safe to read once is set to 2.
Ensure that the given target value is initialized in a thread-safe manner.
A factory delegate to create a new instance of the target value. Note that this
delegate may be called more than once by multiple threads, but only one of those values will successfully be
written to the target.
The target value.
An alternative approach here would be to pass and into
, and to only compute the value if the winning thread. However, this has two potential
downsides. First, the computation of the value might take an indeterminate amount of time. This would require
other threads to then busy-spin for that same amount of time. Second, we would have to make the code very
resilient to failure paths (including cancellation), ensuring that the type reset itself safely to the
initial state so that other threads were not perpetually stuck in the busy state.
Attempts to read all of the requested bytes from the stream into the buffer
The number of bytes read. Less than will
only be returned if the end of stream is reached before all bytes can be read.
Unlike it is not guaranteed that
the stream position or the output buffer will be unchanged if an exception is
returned.
Reads all bytes from the current position of the given stream to its end.
Checks if the given name is a sequence of valid CLR names separated by a dot.
Remove one set of leading and trailing double quote characters, if both are present.
Compares string based upon their ordinal equality.
We use this comparer for string identifiers because it does exactly what we need and nothing more
The StringComparer.Ordinal as implemented by StringComparer is more complex to support
case sensitive and insensitive compares depending on flags.
It also defers to the default string hash function that might not be the best for our scenarios.
This is basically a lossy cache of strings that is searchable by
strings, string sub ranges, character array ranges or string-builder.
Defines a set of helper methods to classify Unicode characters.
Returns true if the Unicode character can be a part of an identifier.
The Unicode character.
Check that the name is a valid Unicode identifier.
Returns true if the Unicode character is a formatting character (Unicode class Cf).
The Unicode character.
Returns true if the Unicode character is a formatting character (Unicode class Cf).
The Unicode character.
Implements and static members that are only available in .NET 5.
Explicitly indicates result is void
Represents an ordered sequence of weak references.
Copies all live references from to .
Assumes that all references prior are alive.
Returns the number of weak references in this list.
Note that some of them might not point to live objects anymore.
Implements ConfigureAwait(bool) for . The resulting behavior in asynchronous code
is the same as one would expect for .
The awaitable provided by .
An object used to await this yield.
Merges the new change ranges into the old change ranges, adjusting the new ranges to be with respect to the original text
(with neither old or new changes applied) instead of with respect to the original text after "old changes" are applied.
This may require splitting, concatenation, etc. of individual change ranges.
Both `oldChanges` and `newChanges` must contain non-overlapping spans in ascending order.
Represents a new change being processed by .
Such a new change must be adjusted before being added to the result list.
A value of this type may represent the intermediate state of merging of an old change into an unadjusted new change,
resulting in a temporary unadjusted new change whose is negative (not valid) until it is adjusted.
This tends to happen when we need to merge an old change deletion into a new change near the beginning of the text. (see TextChangeTests.Fuzz_4)
Indicates that a code element is performance sensitive under a known scenario.
When applying this attribute, only explicitly set the values for properties specifically indicated by the
test/measurement technique described in the associated .
Gets the location where the original problem is documented, likely with steps to reproduce the issue and/or
validate performance related to a change in the method.
Gets or sets a description of the constraint imposed by the original performance issue.
Constraints are normally specified by other specific properties that allow automated validation of the
constraint. This property supports documenting constraints which cannot be described in terms of other
constraint properties.
Gets or sets a value indicating whether captures are allowed.
Gets or sets a value indicating whether implicit boxing of value types is allowed.
Gets or sets a value indicating whether enumeration of a generic
is allowed.
Gets or sets a value indicating whether locks are allowed.
Gets or sets a value indicating whether the asynchronous state machine typically completes synchronously.
When , validation of this performance constraint typically involves analyzing
the method to ensure synchronous completion of the state machine does not require the allocation of a
, either through caching the result or by using
.
Gets or sets a value indicating whether this is an entry point to a parallel algorithm.
Parallelization APIs and algorithms, e.g. Parallel.ForEach, may be efficient for parallel entry
points (few direct calls but large amounts of iterative work), but are problematic when called inside the
iterations themselves. Performance-sensitive code should avoid the use of heavy parallelization APIs except
for known entry points to the parallel portion of code.
Represents a non-cryptographic hash algorithm.
Gets the number of bytes produced from this hash algorithm.
The number of bytes produced from this hash algorithm.
Called from constructors in derived classes to initialize the
class.
The number of bytes produced from this hash algorithm.
is less than 1.
When overridden in a derived class,
appends the contents of to the data already
processed for the current hash computation.
The data to process.
When overridden in a derived class,
resets the hash computation to the initial state.
When overridden in a derived class,
writes the computed hash value to
without modifying accumulated state.
The buffer that receives the computed hash value.
Implementations of this method must write exactly
bytes to .
Do not assume that the buffer was zero-initialized.
The class validates the
size of the buffer before calling this method, and slices the span
down to be exactly in length.
Appends the contents of to the data already
processed for the current hash computation.
The data to process.
is .
Appends the contents of to the data already
processed for the current hash computation.
The data to process.
is .
Asychronously reads the contents of
and appends them to the data already
processed for the current hash computation.
The data to process.
The token to monitor for cancellation requests.
The default value is .
A task that represents the asynchronous append operation.
is .
Gets the current computed hash value without modifying accumulated state.
The hash value for the data already provided.
Attempts to write the computed hash value to
without modifying accumulated state.
The buffer that receives the computed hash value.
On success, receives the number of bytes written to .
if is long enough to receive
the computed hash value; otherwise, .
Writes the computed hash value to
without modifying accumulated state.
The buffer that receives the computed hash value.
The number of bytes written to ,
which is always .
is shorter than .
Gets the current computed hash value and clears the accumulated state.
The hash value for the data already provided.
Attempts to write the computed hash value to .
If successful, clears the accumulated state.
The buffer that receives the computed hash value.
On success, receives the number of bytes written to .
and clears the accumulated state
if is long enough to receive
the computed hash value; otherwise, .
Writes the computed hash value to
then clears the accumulated state.
The buffer that receives the computed hash value.
The number of bytes written to ,
which is always .
is shorter than .
Writes the computed hash value to
then clears the accumulated state.
The buffer that receives the computed hash value.
Implementations of this method must write exactly
bytes to .
Do not assume that the buffer was zero-initialized.
The class validates the
size of the buffer before calling this method, and slices the span
down to be exactly in length.
The default implementation of this method calls
followed by .
Overrides of this method do not need to call either of those methods,
but must ensure that the caller cannot observe a difference in behavior.
This method is not supported and should not be called.
Call or
instead.
This method will always throw a .
In all cases.
Provides an implementation of the XXH128 hash algorithm for generating a 128-bit hash.
For methods that persist the computed numerical hash value as bytes,
the value is written in the Big Endian byte order.
XXH128 produces 16-byte hashes.
Initializes a new instance of the class using the default seed value 0.
Initializes a new instance of the class using the specified seed.
Computes the XXH128 hash of the provided data.
The data to hash.
The XXH128 128-bit hash code of the provided data.
is null.
Computes the XXH128 hash of the provided data using the provided seed.
The data to hash.
The seed value for this hash computation.
The XXH128 128-bit hash code of the provided data.
is null.
Computes the XXH128 hash of the provided data using the optionally provided .
The data to hash.
The seed value for this hash computation. The default is zero.
The XXH128 128-bit hash code of the provided data.
Computes the XXH128 hash of the provided data into the provided using the optionally provided .
The data to hash.
The buffer that receives the computed 128-bit hash code.
The seed value for this hash computation. The default is zero.
The number of bytes written to .
is shorter than (16 bytes).
Attempts to compute the XXH128 hash of the provided data into the provided using the optionally provided .
The data to hash.
The buffer that receives the computed 128-bit hash code.
When this method returns, contains the number of bytes written to .
The seed value for this hash computation. The default is zero.
if is long enough to receive the computed hash value (16 bytes); otherwise, .
Resets the hash computation to the initial state.
Appends the contents of to the data already processed for the current hash computation.
The data to process.
Writes the computed 128-bit hash value to without modifying accumulated state.
The buffer that receives the computed hash value.
The default secret for when no seed is provided.
This is the same as a custom secret derived from a seed of 0.
Calculates a 32-bit to 64-bit long multiply.
"This is a fast avalanche stage, suitable when input bits are already partially mixed."
Calculates a 64-bit to 128-bit multiply, then XOR folds it.
Optimized version of looping over .
The accumulators. Length is .
Used to store a custom secret generated from a seed. Length is .
The internal buffer. Length is .
The amount of memory in .
Number of stripes processed in the current block.
Total length hashed.
The seed employed (possibly 0).
This is a marker attribute that can be put on an interface to denote that only internal implementations
of that interface should exist.
Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
The name of the compiler feature.
If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
The used for the ref structs C# feature.
The used for the required members C# feature.
Indicates which arguments to a method involving an interpolated string handler should be passed to that handler.
Initializes a new instance of the class.
The name of the argument that should be passed to the handler.
may be used as the name of the receiver in an instance method.
Initializes a new instance of the class.
The names of the arguments that should be passed to the handler.
may be used as the name of the receiver in an instance method.
Gets the names of the arguments that should be passed to the handler.
may be used as the name of the receiver in an instance method.
Indicates the attributed type is to be used as an interpolated string handler.
Initializes the .
Reserved to be used by the compiler for tracking metadata.
This class should not be used by developers in source code.
Specifies that a type has required members or that a member is required.
Declare the following extension methods in System.Linq namespace to avoid accidental boxing of ImmutableArray{T} that implements IEnumerable{T}.
The boxing would occur if the methods were defined in Roslyn.Utilities and the file calling these methods has using Roslyn.Utilities
but not using System.Linq.
Indicates that an API is experimental and it may change in the future.
This attribute allows call sites to be flagged with a diagnostic that indicates that an experimental
feature is used. Authors can use this attribute to ship preview features in their assemblies.
Initializes a new instance of the class, specifying the ID that the compiler will use
when reporting a use of the API the attribute applies to.
The ID that the compiler will use when reporting a use of the API the attribute applies to.
Gets the ID that the compiler will use when reporting a use of the API the attribute applies to.
The unique diagnostic ID.
The diagnostic ID is shown in build output for warnings and errors.
This property represents the unique ID that can be used to suppress the warnings or errors, if needed.
Gets or sets the URL for corresponding documentation.
The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
The format string that represents a URL to corresponding documentation.
An example format string is https://contoso.com/obsoletion-warnings/{0}.
Specifies that null is allowed as an input even if the corresponding type disallows it.
Specifies that null is disallowed as an input even if the corresponding type allows it.
Specifies that an output may be null even if the corresponding type disallows it.
Specifies that an output will not be null even if the corresponding type allows it.
Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it.
Initializes the attribute with the specified return value condition.
The return value condition. If the method returns this value, the associated parameter may be null.
Gets the return value condition.
Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it.
Initializes the attribute with the specified return value condition.
The return value condition. If the method returns this value, the associated parameter will not be null.
Gets the return value condition.
Specifies that the output will be non-null if the named parameter is non-null.
Initializes the attribute with the associated parameter name.
The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
Gets the associated parameter name.
Applied to a method that will never return under any circumstance.
Specifies that the method will not return if the associated Boolean parameter is passed the specified value.
Initializes the attribute with the specified parameter value.
The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
the associated parameter matches this value.
Gets the condition parameter value.
Specifies that the method or property will ensure that the listed field and property members have not-null values.
Initializes the attribute with a field or property member.
The field or property member that is promised to be not-null.
Initializes the attribute with the list of field and property members.
The list of field and property members that are promised to be not-null.
Gets field or property member names.
Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition.
Initializes the attribute with the specified return value condition and a field or property member.
The return value condition. If the method returns this value, the associated parameter will not be null.
The field or property member that is promised to be not-null.
Initializes the attribute with the specified return value condition and list of field and property members.
The return value condition. If the method returns this value, the associated parameter will not be null.
The list of field and property members that are promised to be not-null.
Gets the return value condition.
Gets field or property member names.
Specifies that this constructor sets all required members for the current type, and callers
do not need to set any required members themselves.
Represent a type can be used to index a collection either from the start or the end.
Index is used by the C# compiler to support the new index syntax
int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ;
int lastElement = someArray[^1]; // lastElement = 5
Construct an Index using a value and indicating if the index is from the start or from the end.
The index value. it has to be zero or positive number.
Indicating if the index is from the start or from the end.
If the Index constructed from the end, index value 1 means pointing at the last element and index value 0 means pointing at beyond last element.
Create an Index pointing at first element.
Create an Index pointing at beyond last element.
Create an Index from the start at the position indicated by the value.
The index value from the start.
Create an Index from the end at the position indicated by the value.
The index value from the end.
Returns the index value.
Indicates whether the index is from the start or the end.
Calculate the offset from the start using the giving collection length.
The length of the collection that the Index will be used with. length has to be a positive value
For performance reason, we don't validate the input length parameter and the returned offset value against negative values.
we don't validate either the returned offset is greater than the input length.
It is expected Index will be used with collections which always have non negative length/count. If the returned offset is negative and
then used to index a collection will get out of range exception which will be same affect as the validation.
Indicates whether the current Index object is equal to another object of the same type.
An object to compare with this object
Indicates whether the current Index object is equal to another Index object.
An object to compare with this object
Returns the hash code for this instance.
Converts integer number to an Index.
Converts the value of the current Index object to its equivalent string representation.
Provides a readonly abstraction of a set.
The type of elements in the set.
Determines if the set contains a specific item
The item to check if the set contains.
if found; otherwise .
Determines whether the current set is a proper (strict) subset of a specified collection.
The collection to compare to the current set.
if the current set is a proper subset of other; otherwise .
other is .
Determines whether the current set is a proper (strict) superset of a specified collection.
The collection to compare to the current set.
if the collection is a proper superset of other; otherwise .
other is .
Determine whether the current set is a subset of a specified collection.
The collection to compare to the current set.
if the current set is a subset of other; otherwise .
other is .
Determine whether the current set is a super set of a specified collection.
The collection to compare to the current set
if the current set is a subset of other; otherwise .
other is .
Determines whether the current set overlaps with the specified collection.
The collection to compare to the current set.
if the current set and other share at least one common element; otherwise, .
other is .
Determines whether the current set and the specified collection contain the same elements.
The collection to compare to the current set.
if the current set is equal to other; otherwise, .
other is .
Represent a range has start and end indexes.
Range is used by the C# compiler to support the range syntax.
int[] someArray = new int[5] { 1, 2, 3, 4, 5 };
int[] subArray1 = someArray[0..2]; // { 1, 2 }
int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 }
Represent the inclusive start index of the Range.
Represent the exclusive end index of the Range.
Construct a Range object using the start and end indexes.
Represent the inclusive start index of the range.
Represent the exclusive end index of the range.
Indicates whether the current Range object is equal to another object of the same type.
An object to compare with this object
Indicates whether the current Range object is equal to another Range object.
An object to compare with this object
Returns the hash code for this instance.
Converts the value of the current Range object to its equivalent string representation.
Create a Range object starting from start index to the end of the collection.
Create a Range object starting from first element in the collection to the end Index.
Create a Range object starting from first element to the end.
Calculate the start offset and length of range object using a collection length.
The length of the collection that the range will be used with. length has to be a positive value.
For performance reason, we don't validate the input length parameter against negative values.
It is expected Range will be used with collections which always have non negative length/count.
We validate the range is inside the length scope though.