Microsoft.CodeAnalysis.Workspaces Specifies the desired placement of added imports. Place imports inside the namespace definition. Place imports outside the namespace definition. Returns true if the tree already has an existing import syntactically equivalent to in scope at . This includes global imports for VB. Given a context location in a provided syntax tree, returns the appropriate container that should be added to. The annotation normally used on nodes to request case correction. Case corrects all names found in the provided document. Case corrects all names found in the spans of any nodes annotated with the provided annotation. Case corrects all names found in the span. Case corrects all names found in the provided spans. Case correct only things that don't require semantic information Case corrects all names found in the spans in the provided document. Case corrects only things that don't require semantic information Additive classifications types supply additional context to other classifications. Classifies the provided in the given . This will do this using an appropriate if that can be found. will be returned if this fails. Produce the classifications for the span of text specified. Classification should be performed as quickly as possible, and should process the text in a lexical fashion. This allows classification results to be shown to the user when a file is opened before any additional compiler information is available for the text. Important: The classification should not consider the context the text exists in, and how that may affect the final classifications. This may result in incorrect classification (i.e. identifiers being classified as keywords). These incorrect results will be patched up when the lexical results are superseded by the calls to AddSyntacticClassifications. Produce the classifications for the span of text specified. The syntax of the document can be accessed to provide more correct classifications. For example, the syntax can be used to determine if a piece of text that looks like a keyword should actually be considered an identifier in its current context. Produce the classifications for the span of text specified. Semantics of the language can be used to provide richer information for constructs where syntax is insufficient. For example, semantic information can be used to determine if an identifier should be classified as a type, structure, or something else entirely. Adjust a classification from a previous version of text accordingly based on the current text. For example, if a piece of text was classified as an identifier in a previous version, but a character was added that would make it into a keyword, then indicate that here. This allows the classified to quickly fix up old classifications as the user types. These adjustments are allowed to be incorrect as they will be superseded by calls to get the syntactic and semantic classifications for this version later. The syntax node types this classifier is able to classify The syntax token kinds this classifier is able to classify This method will be called for all nodes that match the types specified by the property. This method will be called for all tokens that match the kinds specified by the property. Apply this annotation to a SyntaxNode to indicate a conflict may exist that requires user understanding and acknowledgment before taking action. Apply this annotation to an appropriate Syntax element to request that it should be navigated to by the user after a code action is applied. If present the host should try to place the user's caret at the beginning of the element. By using a this navigation location will be resilient to the transformations performed by the infrastructure. Namely it will be resilient to the formatting, reduction or case correction that automatically occures. This allows a code action to specify a desired location for the user caret to be placed without knowing what actual position that location will end up at when the action is finally applied. Apply this annotation to an appropriate SyntaxNode to request that it should be renamed by the user after the action. Apply this annotation to a SyntaxNode to indicate that a warning message should be presented to the user. An action produced by a or a . A short title describing the action that may appear in a menu. Two code actions are treated as equivalent if they have equal non-null values and were generated by the same or . Equivalence of code actions affects some Visual Studio behavior. For example, if multiple equivalent code actions result from code fixes or refactorings for a single Visual Studio light bulb instance, the light bulb UI will present only one code action from each set of equivalent code actions. Additionally, a Fix All operation will apply only code actions that are equivalent to the original code action. If two code actions that could be treated as equivalent do not have equal values, Visual Studio behavior may be less helpful than would be optimal. If two code actions that should be treated as distinct have equal values, Visual Studio behavior may appear incorrect. Descriptive tags from . These tags may influence how the item is displayed. The sequence of operations that define the code action. The sequence of operations that define the code action. The sequence of operations used to construct a preview. Override this method if you want to implement a subclass that includes custom 's. Override this method if you want to implement a that has a set of preview operations that are different than the operations produced by . Computes all changes for an entire solution. Override this method if you want to implement a subclass that changes more than one document. Computes changes for a single document. Override this method if you want to implement a subclass that changes a single document. used by batch fixer engine to get new solution Apply post processing steps to any 's. A list of operations. A cancellation token. A new list of operations with post processing steps applied to any 's. Apply post processing steps to solution changes, like formatting and simplification. The solution changed by the . A cancellation token Apply post processing steps to a single document: Reducing nodes annotated with Formatting nodes annotated with The document changed by the . A cancellation token. A document with the post processing changes applied. Called by the CodeActions on the UI thread to determine if the CodeAction is still applicable and should be presented to the user. CodeActions can override this if they need to do any final checking that must be performed on the UI thread (for example accessing and querying the Visual Studio DTE). Creates a for a change to a single . Use this factory when the change is expensive to compute and should be deferred until requested. Title of the . Function to create the . Optional value used to determine the equivalence of the with other s. See . Creates a for a change to more than one within a . Use this factory when the change is expensive to compute and should be deferred until requested. Title of the . Function to create the . Optional value used to determine the equivalence of the with other s. See . Creates a representing a group of code actions. Title of the group. The code actions within the group. to allow inlining the members of the group into the parent; otherwise, to require that this group appear as a group with nested actions. A that can vary with user specified options. Gets the options to use with this code action. This method is guaranteed to be called on the UI thread. A cancellation token. An implementation specific object instance that holds options for applying the code action. Gets the 's for this given the specified options. An object instance returned from a prior call to . A cancellation token. Override this method to compute the operations that implement this . An object instance returned from a call to . A cancellation token. A for applying solution changes to a workspace. may return at most one . Hosts may provide custom handling for s, but if a requires custom host behavior not supported by a single , then instead: Implement a custom and s Do not return any from Directly apply any workspace edits Handle any custom host behavior Produce a preview for by creating a custom or returning a single to use the built-in preview mechanism Represents a single operation of a multi-operation code action. A short title describing of the effect of the operation. Called by the host environment to apply the effect of the operation. This method is guaranteed to be called on the UI thread. Operations may make all sorts of changes that may not be appropriate during testing (like popping up UI). So, by default, we don't apply them unless the operation asks for that to happen. A code action operation for requesting a document be opened in the host environment. Represents a preview operation for generating a custom user preview for the operation. Gets a custom preview control for the operation. If preview is null and is non-null, then is used to generate the preview. Get the proper start position based on the span marker type. Get the proper end position based on the span marker type. Inject annotations into the node so that it can re-calculate spans for each code cleaner after each tree transformation. Make sure annotations are positioned outside of any spans. If not, merge two adjacent spans to one. Retrieves four tokens around span like below. [previousToken][startToken][SPAN][endToken][nextToken] Adjust provided span to align to either token's start position or end position. Find closest token (including one in structured trivia) right of given position Find closest token (including one in structured trivia) left of given position Enum that indicates type of span marker Normal case Span starts at the beginning of the tree Span ends at the end of the tree Internal annotation type to mark span location in the tree. Indicates the current marker type Indicates how to find the other side of the span marker if it is missing Static CodeCleaner class that provides default code cleaning behavior. Return default code cleaners for a given document. This can be modified and given to the Cleanup method to provide different cleaners. Cleans up the whole document. Optionally you can provide your own options and code cleaners. Otherwise, the default will be used. Cleans up the document marked with the provided annotation. Optionally you can provide your own options and code cleaners. Otherwise, the default will be used. Clean up the provided span in the document. Optionally you can provide your own options and code cleaners. Otherwise, the default will be used. Clean up the provided spans in the document. Optionally you can provide your own options and code cleaners. Otherwise, the default will be used. Clean up the provided span in the node. This will only cleanup stuff that doesn't require semantic information. Clean up the provided spans in the node. This will only cleanup stuff that doesn't require semantic information. Internal code cleanup service interface. This is not supposed to be used directly. It just provides a way to get the right service from each language. Returns the default code cleaners. This will run all provided code cleaners in an order that is given to the method. This will run all provided code cleaners in an order that is given to the method. This will do cleanups that don't require any semantic information. Specifies the exact type of the code cleanup exported. A code cleaner that requires semantic information to do its job. Returns the name of this provider. This should apply its code clean up logic to the spans of the document. This will run all provided code cleaners in an order that is given to the method. This will do cleanups that don't require any semantic information Helper class that implements using delegates passed to its constructor. Represents a single fix. This is essentially a tuple that holds on to a and the set of s that this will fix. This is the diagnostic that will show up in the preview pane header when a particular fix is selected in the light bulb menu. We also group all fixes with the same together (into a single SuggestedActionSet) in the light bulb menu. A given fix can fix one or more diagnostics. However, our light bulb UI (preview pane, grouping of fixes in the light bulb menu etc.) currently keeps things simple and pretends that each fix fixes a single . Implementation-wise the is always the first diagnostic that the supplied when registering the fix (). This could change in the future, if we decide to change the UI to depict the true mapping between fixes and diagnostics or if we decide to use some other heuristic to determine the . Code fix category for code fixes provided by a . Fixes code to adhere to code style. Fixes code to improve code quality. Fixes code to fix compiler diagnostics. Custom category for fix. Context for code fixes provided by a . Document corresponding to the to fix. Project corresponding to the diagnostics to fix. Text span within the to fix. Diagnostics to fix. NOTE: All the diagnostics in this collection have the same . CancellationToken. Creates a code fix context to be passed into method. Document to fix. Text span within the to fix. Diagnostics to fix. All the diagnostics must have the same . Additionally, the of each diagnostic must be in the set of the of the associated . Delegate to register a fixing a subset of diagnostics. Cancellation token. Throws this exception if any of the arguments is null. Throws this exception if the given is empty, has a null element or has an element whose span is not equal to . Creates a code fix context to be passed into method. Document to fix. Diagnostic to fix. The of this diagnostic must be in the set of the of the associated . Delegate to register a fixing a subset of diagnostics. Cancellation token. Throws this exception if any of the arguments is null. Add supplied to the list of fixes that will be offered to the user. The that will be invoked to apply the fix. The subset of being addressed / fixed by the . Add supplied to the list of fixes that will be offered to the user. The that will be invoked to apply the fix. The subset of being addressed / fixed by the . Add supplied to the list of fixes that will be offered to the user. The that will be invoked to apply the fix. The subset of being addressed / fixed by the . Implement this type to provide fixes for source code problems. Remember to use so the host environment can offer your fixes in a UI. A list of diagnostic IDs that this provider can provide fixes for. Computes one or more fixes for the specified . A containing context information about the diagnostics to fix. The context must only contain diagnostics with a included in the for the current provider. Gets an optional that can fix all/multiple occurrences of diagnostics fixed by this code fix provider. Return null if the provider doesn't support fix all/multiple occurrences. Otherwise, you can return any of the well known fix all providers from or implement your own fix all provider. Use this attribute to declare a implementation so that it can be discovered by the host. Optional name of the . The source languages this provider can provide fixes for. See . Attribute constructor used to specify automatic application of a code fix provider. One language to which the code fix provider applies. Additional languages to which the code fix provider applies. See . Helper class for "Fix all occurrences" code fix providers. Try to merge the changes between and into . If there is any conflicting change in with existing , then no changes are added Context for "Fix all occurrences" code fixes provided by a . Context for "Fix all occurrences" code fixes provided by a . Solution to fix all occurrences. Project within which fix all occurrences was triggered. Document within which fix all occurrences was triggered. Can be null if the context was created using . Underlying which triggered this fix all. to fix all occurrences. Diagnostic Ids to fix. Note that , and methods return only diagnostics whose IDs are contained in this set of Ids. The value expected of a participating in this fix all. CancellationToken for fix all session. Creates a new . Use this overload when applying fix all to a diagnostic with a source location. Document within which fix all occurrences was triggered. Underlying which triggered this fix all. to fix all occurrences. The value expected of a participating in this fix all. Diagnostic Ids to fix. to fetch document/project diagnostics to fix in a . Cancellation token for fix all computation. Creates a new . Use this overload when applying fix all to a diagnostic with no source location, i.e. . Project within which fix all occurrences was triggered. Underlying which triggered this fix all. to fix all occurrences. The value expected of a participating in this fix all. Diagnostic Ids to fix. to fetch document/project diagnostics to fix in a . Cancellation token for fix all computation. Gets all the diagnostics in the given document filtered by . Gets all the project-level diagnostics, i.e. diagnostics with no source location, in the given project filtered by . Gets all the diagnostics in the given project filtered by . This includes both document-level diagnostics for all documents in the given project and project-level diagnostics, i.e. diagnostics with no source location, in the given project. Gets all the project diagnostics in the given project filtered by . If is false, then returns only project-level diagnostics which have no source location. Otherwise, returns all diagnostics in the project, including the document diagnostics for all documents in the given project. Gets a new with the given cancellationToken. Diagnostic provider to fetch document/project diagnostics to fix in a . Gets all the diagnostics to fix in the given document in a . Gets all the project-level diagnostics to fix, i.e. diagnostics with no source location, in the given project in a . Gets all the diagnostics to fix in the given project in a . This includes both document-level diagnostics for all documents in the given project and project-level diagnostics, i.e. diagnostics with no source location, in the given project. Fix all occurrences logging. Implement this abstract type to provide fix all/multiple occurrences code fixes for source code problems. Alternatively, you can use any of the well known fix all providers from . Gets the supported scopes for fixing all occurrences of a diagnostic. By default, it returns the following scopes: (a) (b) and (c) Gets the diagnostic IDs for which fix all occurrences is supported. By default, it returns for the given . Original code fix provider that returned this fix all provider from method. Gets fix all occurrences fix for the given fixAllContext. Contains computed information for a given , such as supported diagnostic Ids and supported . Gets an optional for the given code fix provider or suppression fix provider. Gets an optional for the given code fix provider. Gets an optional for the given suppression fix provider. Indicates scope for "Fix all occurrences" code fixes provided by each . Diagnostic provider to fetch document/project diagnostics to fix in a . Contains well known implementations of . Default batch fix all provider. This provider batches all the individual diagnostic fixes across the scope of fix all action, computes fixes in parallel and then merges all the non-conflicting fixes into a single fix all code action. This fixer supports fixes for the following fix all scopes: , and . The batch fix all provider only batches operations (i.e. ) of type present within the individual diagnostic fixes. Other types of operations present within these fixes are ignored. Provides suppression or configuration code fixes. Returns true if the given diagnostic can be configured, suppressed or unsuppressed by this provider. Gets one or more add suppression, remove suppression, or configuration fixes for the specified diagnostics represented as a list of 's. A list of zero or more potential 'es. It is also safe to return null if there are none. Gets one or more add suppression, remove suppression, or configuration fixes for the specified no-location diagnostics represented as a list of 's. A list of zero or more potential 'es. It is also safe to return null if there are none. Gets an optional that can fix all/multiple occurrences of diagnostics fixed by this fix provider. Return null if the provider doesn't support fix all/multiple occurrences. Otherwise, you can return any of the well known fix all providers from or implement your own fix all provider. Whether or not this diagnostic should be included when performing a FixAll. This is useful for providers that create multiple diagnostics for the same issue (For example, one main diagnostic and multiple 'faded out code' diagnostics). FixAll can be invoked from any of those, but we'll only want perform an edit for only one diagnostic for each of those sets of diagnostics. This overload differs from in that it also passes along the in case that would be useful (for example if the is used. Only one of these two overloads needs to be overridden if you want to customize behavior. Whether or not this diagnostic should be included when performing a FixAll. This is useful for providers that create multiple diagnostics for the same issue (For example, one main diagnostic and multiple 'faded out code' diagnostics). FixAll can be invoked from any of those, but we'll only want perform an edit for only one diagnostic for each of those sets of diagnostics. By default, all diagnostics will be included in fix-all unless they are filtered out here. If only the diagnostic needs to be queried to make this determination, only this overload needs to be overridden. However, if information from is needed (for example ), then should be overridden instead. Only one of these two overloads needs to be overridden if you want to customize behavior. A simple implementation of that takes care of collecting all the diagnostics and fixes all documents in parallel. The only functionality a subclass needs to provide is how each document will apply all the fixes to all the diagnostics in that document. Return the most relevant declaration to namespaceOrType, it will first search the context node contained within, then the declaration in the same file, then non auto-generated file, then all the potential location. Return null if no declaration. Options for controlling the code produced by the . A location used to determine the best place to generate a member. This is only used for determining which part of a partial type to generate in. If a type only has one part, or an API is used that specifies the type, then this is not used. A part is preferred if it surrounds this context location. If no part surrounds this location then a part is preferred if it comes from the same SyntaxTree as this location. If there is no such part, then any part may be used for generation. This option is not necessary if or are provided. A hint to the code generation service to specify where the generated code should be placed. Code will be generated after this location if the location is valid in the type or symbol being generated into, and it is possible to generate the code after it. If this option is provided, neither nor are needed. A hint to the code generation service to specify where the generated code should be placed. Code will be generated before this location if the location is valid in the type or symbol being generated into, and it is possible to generate the code after it. If this option is provided, neither nor are needed. True if the code generation service should add , and when not generating directly into a declaration, should try to automatically add imports to the file for any generated code. Defaults to true. True if, when adding a System import, the import should be placed above non-System imports. Defaults to true. Only used if is true. Contains additional imports to be automatically added. This is useful for adding imports that are part of a list of statements. True if members of a symbol should also be generated along with the declaration. If false, only the symbol's declaration will be generated. True if the code generator should merge namespaces which only contain other namespaces into a single declaration with a dotted name. False if the nesting should be preserved and each namespace declaration should be nested and should only have a single non-dotted name. Merging can only occur if the namespace only contains a single member that is also a namespace. True if the code generation should put multiple attributes in a single attribute declaration, or if should have a separate attribute declaration for each attribute. For example, in C# setting this to True this would produce "[Goo, Bar]" while setting it to False would produce "[Goo][Bar]" True if the code generator should always generate accessibility modifiers, even if they are the same as the defaults for that symbol. For example, a private field in C# does not need its accessibility specified as it will be private by default. However, if this option is set to true 'private' will still be generated. True if the code generator should generate empty bodies for methods along with the method declaration. If false, only method declarations will be generated. True if the code generator should generate documentation comments where available True if the code generator should automatically attempt to choose the appropriate location to insert members. If false and a generation location is not specified by AfterThisLocation, or BeforeThisLocation, members will be inserted at the end of the destination definition. If is , determines if members will be sorted before being added to the end of the list of members. True if the code generator should attempt to reuse the syntax of the constituent entities, such as members, access modifier tokens, etc. while attempting to generate code. If any of the member symbols have zero declaring syntax references (non-source symbols) OR two or more declaring syntax references (partial definitions), then syntax is not reused. If false, then the code generator will always synthesize a new syntax node and ignore the declaring syntax references. Generates symbols that describe declarations to be generated. Determines if the symbol is purely a code generation symbol. Creates an event symbol that can be used to describe an event declaration. Creates a property symbol that can be used to describe a property declaration. Creates a field symbol that can be used to describe a field declaration. Creates a constructor symbol that can be used to describe a constructor declaration. Creates a destructor symbol that can be used to describe a destructor declaration. Creates a method symbol that can be used to describe a method declaration. Creates a method symbol that can be used to describe an operator declaration. Creates a method symbol that can be used to describe a conversion declaration. Creates a parameter symbol that can be used to describe a parameter declaration. Creates a parameter symbol that can be used to describe a parameter declaration. Creates a parameter symbol that can be used to describe a parameter declaration. Creates a type parameter symbol that can be used to describe a type parameter declaration. Creates a pointer type symbol that can be used to describe a pointer type reference. Creates an array type symbol that can be used to describe an array type reference. Creates an method type symbol that can be used to describe an accessor method declaration. Create attribute data that can be used in describing an attribute declaration. Creates a named type symbol that can be used to describe a named type declaration. Creates a method type symbol that can be used to describe a delegate type declaration. Creates a namespace symbol that can be used to describe a namespace declaration. A generator used for creating or modifying member declarations in source. Annotation placed on generated syntax. Returns a newly created event declaration node from the provided event. Returns a newly created field declaration node from the provided field. Returns a newly created method declaration node from the provided method. Returns a newly created property declaration node from the provided property. Returns a newly created named type declaration node from the provided named type. Returns a newly created namespace declaration node from the provided namespace. Create a new declaration node with an event declaration of the same signature as the specified symbol added to it. Create a new declaration node with a field declaration of the same signature as the specified symbol added to it. Create a new declaration node with a method declaration of the same signature as the specified symbol added to it. Create a new declaration node with a property declaration of the same signature as the specified symbol added to it. Create a new declaration node with a named type declaration of the same signature as the specified symbol added to it. Create a new declaration node with multiple member declarations of the same signatures as the specified symbols added to it. Create a new declaration node with one or more parameter declarations of the same signature as the specified symbols added to it. Create a new declaration node with the specified attributes added to it. Removes the specified attribute node from the given declaration node. Removes the specified attribute node from the given declaration node. Create a new declaration node with one or more statements added to its body. Create a new solution where the declaration of the destination symbol has an additional event of the same signature as the specified event symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional field of the same signature as the specified field symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional method of the same signature as the specified method symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional property of the same signature as the specified property symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional named type of the same signature as the specified named type symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional named type of the same signature as the specified named type symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional namespace of the same signature as the specified namespace symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has an additional namespace or type of the same signature as the specified namespace or type symbol. Returns the document in the new solution where the destination symbol is declared. Create a new solution where the declaration of the destination symbol has additional members of the same signature as the specified member symbols. Returns the document in the new solution where the destination symbol is declared. Returns true if additional declarations can be added to the destination symbol's declaration. Returns a newly created event declaration node from the provided event. Returns a newly created field declaration node from the provided field. Returns a newly created method declaration node from the provided method. Returns a newly created property declaration node from the provided property. Returns a newly created named type declaration node from the provided named type. Returns a newly created namespace declaration node from the provided namespace. Adds an event into destination. Adds a field into destination. Adds a method into destination. Adds a property into destination. Adds a named type into destination. Adds a namespace into destination. Adds members into destination. Adds the parameters to destination. Adds the attributes to destination. Remove the given attribute from destination. Remove the given attribute from destination. Update the modifiers list for the given declaration node. Update the accessibility modifiers for the given declaration node, retaining the trivia of the existing modifiers. Update the type for the given declaration node. Replace the existing members with the given newMembers for the given declaration node. Adds the statements to destination. Adds a field with the provided signature into destination. Adds a field with the provided signature into destination. Adds a method with the provided signature into destination. Adds a property with the provided signature into destination. Adds a named type into destination. Adds a named type into destination. Adds a namespace into destination. Adds a namespace or type into destination. Adds all the provided members into destination. true if destination is a location where other symbols can be added to. true if destination is a location where other symbols can be added to. Return the most relevant declaration to namespaceOrType, it will first search the context node contained within, then the declaration in the same file, then non auto-generated file, then all the potential location. Return null if no declaration. When we are generating literals, we sometimes want to emit code vs. the numeric literal. This class gives the constants for all ones we want to convert Context for code refactorings provided by a . Document corresponding to the to refactor. Text span within the to refactor. CancellationToken. Creates a code refactoring context to be passed into method. Creates a code refactoring context to be passed into method. Add supplied to the list of refactorings that will be offered to the user. The that will be invoked to apply the refactoring. Add supplied applicable to to the list of refactorings that will be offered to the user. The that will be invoked to apply the refactoring. The within original document the is applicable to. should represent a logical section within the original document that the is applicable to. It doesn't have to precisely represent the exact that will get changed. Inherit this type to provide source code refactorings. Remember to use so the host environment can offer your refactorings in a UI. Computes one or more refactorings for the specified . Use this attribute to declare a implementation so that it can be discovered by the host. The name of the . The source languages for which this provider can provide refactorings. See . Attribute constructor used to specify availability of a code refactoring provider. One language to which the code refactoring provider applies. Additional languages to which the code refactoring provider applies. See . Given an editor-config code-style-option, gives back the constituent parts of the option. For example, if the option is "true:error" then "true" will be returned in and will be returned in . Note that users are allowed to not provide a NotificationOption, so may be null. The caller of this method must decide what to do in that case. Represents a code style option and an associated notification option. Supports being instantiated with T as a or an enum type. CodeStyleOption also has some basic support for migration a option forward to an enum type option. Specifically, if a previously serialized bool-CodeStyleOption is then deserialized into an enum-CodeStyleOption then 'false' values will be migrated to have the 0-value of the enum, and 'true' values will be migrated to have the 1-value of the enum. Similarly, enum-type code options will serialize out in a way that is compatible with hosts that expect the value to be a boolean. Specifically, if the enum value is 0 or 1 then those values will write back as false/true. When user preferences are not yet set for a style, we fall back to the default value. One such default(s), is that the feature is turned on, so that codegen consumes it, but with silent enforcement, so that the user is not prompted about their usage. This option says if we should simplify away the . or . in field access expressions. This option says if we should simplify away the . or . in property access expressions. This option says if we should simplify away the . or . in method access expressions. This option says if we should simplify away the . or . in event access expressions. This option says if we should prefer keyword for Intrinsic Predefined Types in Declarations This option says if we should prefer keyword for Intrinsic Predefined Types in Member Access Expression Note: the order of this enum is important. We originally only supported two values, and we encoded this as a bool with 'true = WhenPossible' and 'false = never'. To preserve compatibility we map the false value to 0 and the true value to 1. All new values go after these. Offers different notification styles for enforcing a code style. Under the hood, it simply maps to This also supports various properties for databinding. Preferences for flagging unused parameters. Assignment preference for unused values from expression statements and assignments. Properties for a diagnostic generated by an explicit build. return TextSpan if it exists, otherwise it will throw some diagnostic data such as created from build will have original line/column but not text span in those cases, use GetTextSpan method instead to calculate one from original line/column Create a host/VS specific diagnostic with the given descriptor and message arguments for the given project. Note that diagnostic created through this API cannot be suppressed with in-source suppression due to performance reasons (see the PERF remark below for details). Returns true if the diagnostic was generated by an explicit build, not live analysis. Null if path is not mapped and contains the actual path. Note that the value might be a relative path. In that case should be used as a base path for path resolution. Returns the equivalent for a value. The value. The equivalent for a value; otherwise, if does not contain a direct equivalent for . If is not one of the expected values. Applies a default severity to a value. The value. The default severity. If is , returns . -or- Otherwise, returns if it has a non-default value. Returns the equivalent for a value. The value. The equivalent for the value. If is not one of the expected values. Given the original location of the diagnostic and the mapped line info based on line directives in source, apply any necessary adjustments to these diagnostic spans and returns the effective source span for the diagnostic. For example, for Venus, we might change the mapped location to be the location in the primary buffer. Additionally, if the secondary buffer location is outside visible user code, then the original location is also adjusted to be within visible user code. Predefined name of diagnostic property which shows in what compilation stage the diagnostic is created. Each word is capitalized Every word except the first word is capitalized Only the first word is capitalized Every character is capitalized No characters are capitalized The dictionary we get from the VS editorconfig API uses the same dictionary object if there are no changes, so we can cache based on dictionary Determines if matches a subset of the symbols matched by . The implementation determines which properties of are considered for this evaluation. The subset relation does not necessarily indicate a proper subset. The first naming rule. The second naming rule. if matches a subset of the symbols matched by on some implementation-defined properties; otherwise, . This does not handle the case where a method in a base type implicitly implements an interface method on behalf of one of its derived types. Contains all information related to Naming Style Preferences. 1. Symbol Specifications 2. Name Style 3. Naming Rule (points to Symbol Specification IDs) An implementation of for the compiler that wraps a . Create a from a . should be non-null. Resolved path of the document. Retrieves a with the contents of this file. This holds onto diagnostics for a specific version of project snapshot in a way each kind of diagnostics can be queried fast. We have this builder to avoid creating collections unnecessarily. Expectation is that, most of time, most of analyzers doesn't have any diagnostics. so no need to actually create any objects. Basically typed tuple. DiagnosticData serializer Provide a way for users to turn on and off analyzing workspace for compiler diagnostics Include syntax errors Include semantic errors Include script semantic errors Represents an edit operation on a tree or a sequence of nodes. Tree node. Insert: default(TNode). Delete: Deleted node. Move, Update: Node in the old tree/sequence. Insert: Inserted node. Delete: default(TNode) Move, Update: Node in the new tree/sequence. No change. Node value was updated. Node was inserted. Node was deleted. Node changed parent. Node changed position within its parent. The parent nodes of the old node and the new node are matching. Represents a sequence of tree edits. Calculates Longest Common Subsequence for immutable arrays. Calculates Longest Common Subsequence. Underlying storage for s allocated on . The LCS algorithm allocates s of sizes (3, 2*1 + 1, ..., 2*D + 1), always in this order, where D is at most the sum of lengths of the compared sequences. The arrays get pushed on a stack as they are built up, then all consumed in the reverse order (stack pop). Since the exact length of each array in the above sequence is known we avoid allocating each individual array. Instead we allocate a large buffer serving as a a backing storage of a contiguous sequence of arrays corresponding to stack depths to . If more storage is needed we chain next large buffer to the previous one in a linked list. We pool a few of these linked buffers on to conserve allocations. The max stack depth backed by the fist buffer. Size of the buffer for 100 is ~10K. For 150 it'd be 91KB, which would be allocated on LOH. The buffers grow by factor of , so the next buffer will be allocated on LOH. Returns a distance [0..1] of the specified sequences. The smaller distance the more similar the sequences are. Returns a distance [0..1] of the specified sequences. The smaller distance the more similar the sequences are. Calculates a list of "V arrays" using Eugene W. Myers O(ND) Difference Algorithm The algorithm was inspired by Myers' Diff Algorithm described in an article by Nicolas Butler: https://www.codeproject.com/articles/42279/investigating-myers-diff-algorithm-part-of The author has approved the use of his code from the article under the Apache 2.0 license. The algorithm works on an imaginary edit graph for A and B which has a vertex at each point in the grid(i, j), i in [0, lengthA] and j in [0, lengthB]. The vertices of the edit graph are connected by horizontal, vertical, and diagonal directed edges to form a directed acyclic graph. Horizontal edges connect each vertex to its right neighbor. Vertical edges connect each vertex to the neighbor below it. Diagonal edges connect vertex (i,j) to vertex (i-1,j-1) if (sequenceA[i-1],sequenceB[j-1]) is true. Move right along horizontal edge (i-1,j)-(i,j) represents a delete of sequenceA[i-1]. Move down along vertical edge (i,j-1)-(i,j) represents an insert of sequenceB[j-1]. Move along diagonal edge (i-1,j-1)-(i,j) represents an match of sequenceA[i-1] to sequenceB[j-1]. The number of diagonal edges on the path from (0,0) to (lengthA, lengthB) is the length of the longest common sub. The function does not actually allocate this graph. Instead it uses Eugene W. Myers' O(ND) Difference Algoritm to calculate a list of "V arrays" and returns it in a Stack. A "V array" is a list of end points of so called "snakes". A "snake" is a path with a single horizontal (delete) or vertical (insert) move followed by 0 or more diagonals (matching pairs). Unlike the algorithm in the article this implementation stores 'y' indexes and prefers 'right' moves instead of 'down' moves in ambiguous situations to preserve the behavior of the original diff algorithm (deletes first, inserts after). The number of items in the list is the length of the shortest edit script = the number of inserts/edits between the two sequences = D. The list can be used to determine the matching pairs in the sequences (GetMatchingPairs method) or the full editing script (GetEdits method). The algorithm uses O(ND) time and memory where D is the number of delete/inserts and N is the sum of lengths of the two sequences. VArrays store just the y index because x can be calculated: x = y + k. Calculates longest common substring using Wagner algorithm. Returns an edit script (a sequence of edits) that transform subtree to subtree. Returns an edit script (a sequence of edits) that transform a sequence of nodes to a sequence of nodes . or is a null reference. Represents an edit operation on a sequence of values. The kind of edit: , , or . Index in the old sequence, or -1 if the edit is insert. Index in the new sequence, or -1 if the edit is delete. Implements a tree differencing algorithm. Subclasses define relationships among tree nodes, and parameters to the differencing algorithm. Tree node. Returns an edit script that transforms to . Returns a match map of descendants to descendants. Calculates the distance [0..1] of two nodes. The more similar the nodes the smaller the distance. Used to determine whether two nodes of the same label match. Even if 0 is returned the nodes might be slightly different. Returns true if the specified nodes have equal values. Called with matching nodes (, ). Return true if the values of the nodes are the same, or their difference is not important. The number of distinct labels used in the tree. Returns an integer label corresponding to the given node. Returned value must be within [0, LabelCount). Returns N > 0 if the node with specified label can't change its N-th ancestor node, zero otherwise. 1st ancestor is the node's parent node. 2nd ancestor is the node's grandparent node. etc. May return null if the is a leaf. Enumerates all descendant nodes of the given node in depth-first prefix order. Returns a parent for the specified node. Return true if specified nodes belong to the same tree. Returns the position of the node. An editor for making changes to a document's syntax tree. Creates a new instance. The specified when the editor was first created. The of the original document. Returns the changed . Adds namespace imports / using directives for namespace references found in the document. Adds namespace imports / using directives for namespace references found in the document within the span specified. Adds namespace imports / using directives for namespace references found in the document within the sub-trees annotated with the . Adds namespace imports / using directives for namespace references found in the document within the spans specified. Adds namespace imports / using directives for namespace references found in the document. Adds namespace imports / using directives for namespace references found in the document within the span specified. Adds namespace imports / using directives for namespace references found in the document within the sub-trees annotated with the . Adds namespace imports / using directives for namespace references found in the document within the spans specified. Adds namespace imports / using directives for namespace references found in the document. Adds namespace imports / using directives for namespace references found in the document within the span specified. Adds namespace imports / using directives for namespace references found in the document within the sub-trees annotated with the . Adds namespace imports / using directives for namespace references found in the document within the spans specified. Fully qualifies parts of the document that may change meaning if namespaces are added, and marks them with so they can be reduced later. ref as we add simplifier annotations to nodes with explicit namespaces Checks if the namespace declaration is contained inside, or any of its ancestor namespaces are the same as The name assigned to an implicit (widening) conversion. The name assigned to an explicit (narrowing) conversion. The name assigned to the 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 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 Inequality operator. The name assigned to the LeftShift 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 Modulus operator. The name assigned to the Multiply operator. The name assigned to the OnesComplement operator. The name assigned to the RightShift operator. The name assigned to the Subtraction operator. The name assigned to the True operator. The name assigned to the UnaryNegation operator. The name assigned to the UnaryPlus operator. An editor for making changes to multiple documents in a solution. The that was specified when the was constructed. Gets the for the corresponding . Returns the changed . An editor for making changes to symbol source declarations. Creates a new instance. Creates a new instance. The original solution. The solution with the edits applied. The documents changed since the was constructed. Gets the current symbol for a source symbol. Gets the current declarations for the specified symbol. Gets the declaration syntax nodes for a given symbol. Gets the best declaration node for adding members. An action that make changes to a declaration node within a . The to apply edits to. The declaration to edit. An action that make changes to a declaration node within a . The to apply edits to. The declaration to edit. A cancellation token. Enables editing the definition of one of the symbol's declarations. Partial types and methods may have more than one declaration. The symbol to edit. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing the definition of one of the symbol's declarations. Partial types and methods may have more than one declaration. The symbol to edit. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing the definition of one of the symbol's declarations. Partial types and methods may have more than one declaration. The symbol to edit. A location within one of the symbol's declarations. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing the definition of one of the symbol's declarations. Partial types and methods may have more than one declaration. The symbol to edit. A location within one of the symbol's declarations. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing the symbol's declaration where the member is also declared. Partial types and methods may have more than one declaration. The symbol to edit. A symbol whose declaration is contained within one of the primary symbol's declarations. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing the symbol's declaration where the member is also declared. Partial types and methods may have more than one declaration. The symbol to edit. A symbol whose declaration is contained within one of the primary symbol's declarations. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing all the symbol's declarations. Partial types and methods may have more than one declaration. The symbol to be edited. The action that makes edits to the declaration. An optional . The new symbol including the changes. Enables editing all the symbol's declarations. Partial types and methods may have more than one declaration. The symbol to be edited. The action that makes edits to the declaration. An optional . The new symbol including the changes. Gets the reference to the declaration of the base or interface type as part of the symbol's declaration. Changes the base type of the symbol. Changes the base type of the symbol. An editor for making changes to a syntax tree. Creates a new instance. The that was specified when the was constructed. A to use to create and change 's. Returns the changed root node. Makes sure the node is tracked, even if it is not changed. Remove the node from the tree. The node to remove that currently exists as part of the tree. Remove the node from the tree. The node to remove that currently exists as part of the tree. Options that affect how node removal works. Replace the specified node with a node produced by the function. The node to replace that already exists in the tree. A function that computes a replacement node. The node passed into the compute function includes changes from prior edits. It will not appear as a descendant of the original root. Replace the specified node with a different node. The node to replace that already exists in the tree. The new node that will be placed into the tree in the existing node's location. Insert the new nodes before the specified node already existing in the tree. The node already existing in the tree that the new nodes will be placed before. This must be a node this is contained within a syntax list. The nodes to place before the existing node. These nodes must be of a compatible type to be placed in the same list containing the existing node. Insert the new node before the specified node already existing in the tree. The node already existing in the tree that the new nodes will be placed before. This must be a node this is contained within a syntax list. The node to place before the existing node. This node must be of a compatible type to be placed in the same list containing the existing node. Insert the new nodes after the specified node already existing in the tree. The node already existing in the tree that the new nodes will be placed after. This must be a node this is contained within a syntax list. The nodes to place after the existing node. These nodes must be of a compatible type to be placed in the same list containing the existing node. Insert the new node after the specified node already existing in the tree. The node already existing in the tree that the new nodes will be placed after. This must be a node this is contained within a syntax list. The node to place after the existing node. This node must be of a compatible type to be placed in the same list containing the existing node. A language agnostic factory for creating syntax nodes. This API can be used to create language specific syntax nodes that are semantically similar between languages. The trees generated by this API will try to respect user preferences when possible. For example, generating will be done in a way such that "this." or "Me." will be simplified according to user preference if any overload is called. Gets the for the specified language. Gets the for the language corresponding to the document. Gets the for the language corresponding to the project. Returns the node if it is a declaration, the immediate enclosing declaration if one exists, or null. Returns the enclosing declaration of the specified kind or null. Creates a field declaration. Creates a field declaration matching an existing field symbol. Creates a field declaration matching an existing field symbol. Creates a method declaration. Creates a method declaration matching an existing method symbol. Creates a method declaration. Creates a method declaration matching an existing method symbol. Creates a parameter declaration. Creates a parameter declaration matching an existing parameter symbol. Creates a property declaration. Creates a property declaration using an existing property symbol as a signature. Creates an indexer declaration. Creates an indexer declaration matching an existing indexer symbol. Creates a statement that adds the given handler to the given event. Creates a statement that removes the given handler from the given event. Creates an event declaration. Creates an event declaration from an existing event symbol Creates a custom event declaration. Creates a custom event declaration from an existing event symbol. Creates a constructor declaration. Create a constructor declaration using Converts method, property and indexer declarations into public interface implementations. This is equivalent to an implicit C# interface implementation (you can access it via the interface or directly via the named member.) Converts method, property and indexer declarations into public interface implementations. This is equivalent to an implicit C# interface implementation (you can access it via the interface or directly via the named member.) Converts method, property and indexer declarations into private interface implementations. This is equivalent to a C# explicit interface implementation (you can declare it for access via the interface, but cannot call it directly). Converts method, property and indexer declarations into private interface implementations. This is equivalent to a C# explicit interface implementation (you can declare it for access via the interface, but cannot call it directly). Creates a class declaration. Creates a struct declaration. Creates a interface declaration. Creates an enum declaration. Creates an enum member Creates a delegate declaration. Creates a declaration matching an existing symbol. Converts a declaration (method, class, etc) into a declaration with type parameters. Converts a declaration (method, class, etc) into a declaration with type parameters. Adds a type constraint to a type parameter of a declaration. Adds a type constraint to a type parameter of a declaration. Adds a type constraint to a type parameter of a declaration. Creates a namespace declaration. The name of the namespace. Zero or more namespace or type declarations. Creates a namespace declaration. The name of the namespace. Zero or more namespace or type declarations. Creates a namespace declaration. The name of the namespace. Zero or more namespace or type declarations. Creates a namespace declaration. The name of the namespace. Zero or more namespace or type declarations. Creates a compilation unit declaration Zero or more namespace import, namespace or type declarations. Creates a compilation unit declaration Zero or more namespace import, namespace or type declarations. Creates a namespace import declaration. The name of the namespace being imported. Creates a namespace import declaration. The name of the namespace being imported. Creates an alias import declaration. The name of the alias. The namespace or type to be aliased. Creates an alias import declaration. The name of the alias. The namespace or type to be aliased. Creates an attribute. Creates an attribute. Creates an attribute. Creates an attribute matching existing attribute data. Creates an attribute argument. Creates an attribute argument. Removes all attributes from the declaration, including return attributes. Removes comments from leading and trailing trivia, as well as potentially removing comments from opening and closing tokens. Gets the attributes of a declaration, not including the return attributes. Creates a new instance of the declaration with the attributes inserted. Creates a new instance of the declaration with the attributes inserted. Creates a new instance of a declaration with the specified attributes added. Creates a new instance of a declaration with the specified attributes added. Gets the return attributes from the declaration. Creates a new instance of a method declaration with return attributes inserted. Creates a new instance of a method declaration with return attributes inserted. Creates a new instance of a method declaration with return attributes added. Creates a new instance of a method declaration node with return attributes added. Gets the attribute arguments for the attribute declaration. Creates a new instance of the attribute with the arguments inserted. Creates a new instance of the attribute with the arguments added. Gets the namespace imports that are part of the declaration. Creates a new instance of the declaration with the namespace imports inserted. Creates a new instance of the declaration with the namespace imports inserted. Creates a new instance of the declaration with the namespace imports added. Creates a new instance of the declaration with the namespace imports added. Gets the current members of the declaration. Creates a new instance of the declaration with the members inserted. Creates a new instance of the declaration with the members inserted. Creates a new instance of the declaration with the members added to the end. Creates a new instance of the declaration with the members added to the end. Gets the accessibility of the declaration. Changes the accessibility of the declaration. Gets the for the declaration. Changes the for the declaration. Gets the for the declaration. Gets the name of the declaration. Changes the name of the declaration. Gets the type of the declaration. Changes the type of the declaration. Gets the list of parameters for the declaration. Inserts the parameters at the specified index into the declaration. Adds the parameters to the declaration. Gets the list of switch sections for the statement. Inserts the switch sections at the specified index into the statement. Adds the switch sections to the statement. Gets the expression associated with the declaration. Changes the expression associated with the declaration. Gets the statements for the body of the declaration. Changes the statements for the body of the declaration. Gets the accessors for the declaration. Gets the accessor of the specified kind for the declaration. Creates a new instance of the declaration with the accessors inserted. Creates a new instance of the declaration with the accessors added. Gets the statements for the body of the get-accessor of the declaration. Changes the statements for the body of the get-accessor of the declaration. Gets the statements for the body of the set-accessor of the declaration. Changes the statements for the body of the set-accessor of the declaration. Gets a list of the base and interface types for the declaration. Adds a base type to the declaration Adds an interface type to the declaration Replaces the node in the root's tree with the new node. Inserts the new node before the specified declaration. Inserts the new node before the specified declaration. Removes the node from the sub tree starting at the root. Removes the node from the sub tree starting at the root. Removes all the declarations from the sub tree starting at the root. Creates a new instance of the node with the leading and trailing trivia removed and replaced with elastic markers. Creates statement that allows an expression to execute in a statement context. This is typically an invocation or assignment expression. The expression that is to be executed. This is usually a method invocation expression. Creates a statement that can be used to return a value from a method body. An optional expression that can be returned. Creates a statement that can be used to yield a value from an iterator method. An expression that can be yielded. Creates a statement that can be used to throw an exception. An optional expression that can be thrown. Creates an expression that can be used to throw an exception. True if can be used Creates a statement that declares a single local variable. Creates a statement that declares a single local variable. Creates a statement that declares a single local variable. Creates a statement that declares a single local variable. Creates an if-statement A condition expression. The statements that are executed if the condition is true. The statements that are executed if the condition is false. Creates an if statement A condition expression. The statements that are executed if the condition is true. A single statement that is executed if the condition is false. Creates a switch statement that branches to individual sections based on the value of the specified expression. Creates a switch statement that branches to individual sections based on the value of the specified expression. Creates a section for a switch statement. Creates a single-case section a switch statement. Creates a default section for a switch statement. Create a statement that exits a switch statement and continues after it. Creates a statement that represents a using-block pattern. Creates a statement that represents a using-block pattern. Creates a statement that represents a using-block pattern. Creates a statement that represents a lock-block pattern. Creates a try-catch or try-catch-finally statement. Creates a try-catch or try-catch-finally statement. Creates a try-finally statement. Creates a catch-clause. Creates a catch-clause. Creates a while-loop statement Creates a block of statements. Not supported in VB. An expression that represents the default value of a type. This is typically a null value for reference types or a zero-filled value for value types. Creates an expression that denotes the containing method's this-parameter. Creates an expression that denotes the containing method's base-parameter. Creates a literal expression. This is typically numeric primitives, strings or chars. Creates an expression for a typed constant. Creates an expression that denotes the boolean false literal. Creates an expression that denotes the boolean true literal. Creates an expression that denotes the null literal. Creates an expression that denotes a simple identifier name. Creates an expression that denotes a generic identifier name. Creates an expression that denotes a generic identifier name. Creates an expression that denotes a generic identifier name. Creates an expression that denotes a generic identifier name. Converts an expression that ends in a name into an expression that ends in a generic name. If the expression already ends in a generic name, the new type arguments are used instead. Converts an expression that ends in a name into an expression that ends in a generic name. If the expression already ends in a generic name, the new type arguments are used instead. Creates a name expression that denotes a qualified name. The left operand can be any name expression. The right operand can be either and identifier or generic name. Returns a new name node qualified with the 'global' alias ('Global' in VB). Creates a name expression from a dotted name string. Creates a name that denotes a type or namespace. The symbol to create a name for. Creates an expression that denotes a type. Creates an expression that denotes a type. If addImport is false, adds a which will prevent any imports or usings from being added for the type. Creates an expression that denotes a special type name. Creates an expression that denotes an array type. Creates an expression that denotes a nullable type. Creates an expression that denotes a tuple type. Creates an expression that denotes a tuple type. Creates an expression that denotes a tuple type. Creates an expression that denotes a tuple element. Creates an expression that denotes a tuple element. Creates an expression that denotes an assignment from the right argument to left argument. Creates an expression that denotes a value-type equality test operation. Creates an expression that denotes a reference-type equality test operation. Creates an expression that denotes a value-type inequality test operation. Creates an expression that denotes a reference-type inequality test operation. Creates an expression that denotes a less-than test operation. Creates an expression that denotes a less-than-or-equal test operation. Creates an expression that denotes a greater-than test operation. Creates an expression that denotes a greater-than-or-equal test operation. Creates an expression that denotes a unary negation operation. Creates an expression that denotes an addition operation. Creates an expression that denotes an subtraction operation. Creates an expression that denotes a multiplication operation. Creates an expression that denotes a division operation. Creates an expression that denotes a modulo operation. Creates an expression that denotes a bitwise-and operation. Creates an expression that denotes a bitwise-or operation. Creates an expression that denotes a bitwise-not operation Creates an expression that denotes a logical-and operation. Creates an expression that denotes a logical-or operation. Creates an expression that denotes a logical not operation. Creates an expression that denotes a conditional evaluation operation. Creates an expression that denotes a coalesce operation. Creates a member access expression. Creates a member access expression. Creates an array creation expression for a single dimensional array of specified size. Creates an array creation expression for a single dimensional array with specified initial element values. Creates an object creation expression. Creates an object creation expression. Creates an object creation expression. Creates an object creation expression. Creates a invocation expression. Creates a invocation expression Creates a node that is an argument to an invocation. Creates a node that is an argument to an invocation. Creates a node that is an argument to an invocation. Creates an expression that access an element of an array or indexer. Creates an expression that access an element of an array or indexer. Creates an expression that evaluates to the type at runtime. Creates an expression that denotes an is-type-check operation. Creates an expression that denotes an is-type-check operation. Creates an expression that denotes an try-cast operation. Creates an expression that denotes an try-cast operation. Creates an expression that denotes a type cast operation. Creates an expression that denotes a type cast operation. Creates an expression that denotes a type conversion operation. Creates an expression that denotes a type conversion operation. Creates an expression that declares a value returning lambda expression. Creates an expression that declares a void returning lambda expression Creates an expression that declares a value returning lambda expression. Creates an expression that declares a void returning lambda expression. Creates an expression that declares a single parameter value returning lambda expression. Creates an expression that declares a single parameter void returning lambda expression. Creates an expression that declares a single parameter value returning lambda expression. Creates an expression that declares a single parameter void returning lambda expression. Creates an expression that declares a zero parameter value returning lambda expression. Creates an expression that declares a zero parameter void returning lambda expression. Creates an expression that declares a zero parameter value returning lambda expression. Creates an expression that declares a zero parameter void returning lambda expression. Creates a lambda parameter. Creates a lambda parameter. Creates an await expression. Wraps with parens. Creates an nameof expression. Creates an tuple expression. Has the reference type constraint (i.e. 'class' constraint in C#) Has the value type constraint (i.e. 'struct' constraint in C#) Has the constructor constraint (i.e. 'new' constraint in C#) Represents an error in a embedded language snippet. The error contains the message to show a user as well as the span of the error. This span is in actual user character coordinates. For example, if the user has the string "...\\p{0}..." then the span of the error would be for the range of characters for '\\p{0}' (even though the regex engine would only see the \\ translated as a virtual char to the single \ character. Root of the embedded language syntax hierarchy. EmbeddedSyntaxNodes are very similar to Roslyn Red-Nodes in concept, though there are differences for ease of implementation. Similarities: 1. Fully representative of the original source. All source VirtualChars are contained in the Regex nodes. 2. Specific types for Nodes, Tokens and Trivia. 3. Uniform ways of deconstructing Nodes (i.e. ChildCount + ChildAt). Differences: Note: these differences are not required, and can be changed if felt to be valuable. 1. No parent pointers. These have not been needed yet. 2. No Update methods. These have not been needed yet. 3. No direct ways to get Positions/Spans of node/token/trivia. Instead, that information can be acquired from the VirtualChars contained within those constructs. This does mean that an empty node (for example, an empty RegexSequenceNode) effect has no way to simply ascertain its location. So far that hasn't been a problem. 4. No null nodes. Haven't been needed so far, and it keeps things extremely simple. For example where Roslyn might have chosen an optional null child, the Regex hierarchy just has multiple nodes. For example there are distinct nodes to represent the very similar {a} {a,} {a,b} constructs. Returns the value of the token. For example, if the token represents an integer capture, then this property would return the actual integer. Trivia on an . A place for diagnostics to be stored during parsing. Not intended to be accessed directly. These will be collected and aggregated into Abstract implementation of the C# and VB embedded language providers. A 'fallback' embedded language that can classify normal escape sequences in C# or VB strings if no other embedded languages produce results. Services related to a specific embedded language. A optional classifier that can produce s for an embedded language string. Service that returns all the embedded languages supported. Each embedded language can expose individual language services through the interface. Helper class to detect regex pattern tokens in a document efficiently. Helps match patterns of the form: language=regex,option1,option2,option3 All matching is case insensitive, with spaces allowed between the punctuation. 'regex' or 'regexp' are both allowed. Option values will be or'ed together to produce final options value. If an unknown option is encountered, processing will stop with whatever value has accumulated so far. Option names are the values from the enum. Finds public, static methods in that have a parameter called 'pattern'. These are helpers (like where at least one (but not necessarily more) of the parameters should be treated as a pattern. Classifier impl for embedded regex strings. Minimal copy of https://github.com/dotnet/corefx/blob/master/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs Used to accurately determine if something is a WordChar according to the .NET regex engine. Determines a character's membership in a character class (via the string representation of the class). This is used for categories which are composed of other categories - L, N, Z, W... These groups need special treatment when they are negated Maps an escaped character to the actual character it was escaping. For something like 'a' this will map to actual '\a' char (the bell character). However, for something like '(' this will just map to '(' as that's all that \( does in a regex. Produces tokens from the sequence of characters. Unlike the native C# and VB lexer, this lexer is much more tightly controlled by the parser. For example, while C# can have trivia on virtual every token, the same is not true for RegexTokens. As such, instead of automatically lexing out tokens to make them available for the parser, the parser asks for each token as necessary passing the right information to indicate which types and shapes of tokens are allowed. The tight coupling means that the parser is allowed direct control of the position of the lexer. Note: most of the time, tokens returned are just a single character long, including for long sequences of text characters (like ```"goo"```). This is just three s in a row (each containing a a single character long). There are multi-character tokens though. For example ```10``` in ```a{10,}``` or ```name``` in ```\k'name'``` Represents a possibly-empty sequence of regex expressions. For example, the regex "" will produce an empty RegexSequence nodes, and "a|" will produce an alternation with an empty sequence on the right side. Having a node represent the empty sequence is actually appropriate as these are legal regexes and the empty sequence represents 'a pattern that will match any position'. Not having a node for this would actually end up complicating things in terms of dealing with nulls in the tree. This does not deviate from Roslyn principles. While nodes for empty text are rare, they are allowed (for example, OmittedTypeArgument in C#). Represents a chunk of text (usually just a single char) from the original pattern. Base type for [...] and [^...] character classes. [...] node. [^...] node ```a-z``` node in a character class. ```-[f-m]``` in a pattern like ```[a-z-[f-m]]```. A subtraction must come last in a character class, and removes some range of chars from the character class built up so far. Represents a ```[:...:]``` node in a character class. Note: the .NET regex parser simply treats this as the character ```[``` and ignores the rest of the ```:...:]```. They latter part has no impact on the actual match engine that is produced. Root of all expression nodes. Root of all the primary nodes (similar to unary nodes in C#). A ```.``` expression. Root of all quantifier nodes: ```?```, ```*``` etc. ```expr*``` ```expr+``` ```expr?``` Quantifiers can be optionally followed by a ? to make them lazy. i.e. ```a*?``` or ```a+?```. You can even have ```a??``` (zero or one 'a', lazy). However, only one lazy modifier is allowed ```a*??``` or ```a???``` is not allowed. Base type of all regex numeric quantifier nodes. i.e. ```a{5}```, ```a{5,}``` and ```a{5,10}``` ```a{5}``` ```a{5,}``` ```a{5,10}``` ```$``` or ```^```. ```expr1|expr2``` node. Base type of all non-trivia ```(...)``` nodes The ```(...)``` node you get when the group does not start with ```(?``` Base type of all ```(?...)``` groupings. Base type of ```(?inmsx)``` or ```(?inmsx:...)``` nodes. ```(?inmsx)``` node. Changes options in a sequence for all subsequence nodes. ```(?inmsx:expr)``` node. Changes options for the parsing of 'expr'. ```(?:expr)``` node. ```(?=expr)``` node. ```(?!expr)``` node. ```(?<=expr)``` node. ```(?<!expr)``` node. ```(?>expr)``` node. ```(?'name'expr)``` or ```(?<name>expr)``` node. ```(?'name1-name2'expr)``` or ```(?<name1-name2>expr)``` node. ```(?(capture_name)result)``` ```(?(group)result)``` Base type of all regex primitives that start with \ Base type of all regex escapes that start with \ and some informative character (like \v \t \c etc.). A basic escape that just has \ and one additional character and needs no further information. One of \b \B \A \G \z \Z One of \s \S \d \D \w \W ```\cX``` escape ```\xFF``` escape. ```\uFFFF``` escape. ```\'name'``` or ```\<name>``` escape. ```\k'name'``` or ```\k<name>``` escape. ```\1``` escape. In contexts where back-references are not allowed. ```\1``` ```\p{...}``` Produces a from a sequence of characters. Importantly, this parser attempts to replicate diagnostics with almost the exact same text as the native .NET regex parser. This is important so that users get an understandable experience where it appears to them that this is all one cohesive system and that the IDE will let them discover and fix the same issues they would encounter when previously trying to just compile and execute these regexes. Invariants we try to maintain (and should consider a bug if we do not): l 1. If the .NET regex parser does not report an error for a given pattern, we should not either. it would be very bad if we told the user there was something wrong with there pattern when there really wasn't. 2. If the .NET regex parser does report an error for a given pattern, we should either not report an error (not recommended) or report the same error at an appropriate location in the pattern. Not reporting the error can be confusing as the user will think their pattern is ok, when it really is not. However, it can be acceptable to do this as it's not telling them that something is actually wrong, and it may be too difficult to find and report the same error. Note: there is only one time we do this in this parser (see the deviation documented in ). Note1: "report the same error" means that we will attempt to report the error using the same text the .NET regex parser uses for its error messages. This is so that the user is not confused when they use the IDE vs running the regex by getting different messages for the same issue. Note2: the above invariants make life difficult at times. This happens due to the fact that the .NET parser is multi-pass. Meaning it does a first scan (which may report errors), then does the full parse. This means that it might report an error in a later location during the initial scan than it would during the parse. We replicate that behavior to follow the second invariant. Note3: It would be nice if we could check these invariants at runtime, so we could control our behavior by the behavior of the real .NET regex engine. For example, if the .NET regex engine did not report any issues, we could suppress any diagnostics we generated and we could log an NFW to record which pattern we deviated on so we could fix the issue for a future release. However, we cannot do this as the .NET regex engine has no guarantees about its performance characteristics. For example, certain regex patterns might end up causing that engine to consume unbounded amounts of CPU and memory. This is because the .NET regex engine is not just a parser, but something that builds an actual recognizer using techniques that are not necessarily bounded. As such, while we test ourselves around it during our tests, we cannot do the same at runtime as part of the IDE. This parser was based off the corefx RegexParser based at: https://github.com/dotnet/corefx/blob/f759243d724f462da0bcef54e86588f8a55352c6/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs#L1 Note4: The .NET parser itself changes over time (for example to fix behavior that even it thinks is buggy). When this happens, we have to make a choice as to which behavior to follow. In general, the overall principle is that we should follow the more lenient behavior. If we end up taking the more strict interpretation we risk giving people an error during design time that they would not get at runtime. It's far worse to have that than to not report an error, even though one might happen later. Analyzes the first parsed tree to determine the set of capture numbers and names. These are then used to do the second parsing pass as they can change how the regex engine interprets some parts of the pattern (though not the groups themselves). Give numbers to all named captures. They will get successive values that have not already been handed out to existing numbered capture groups. Returns the latest token the lexer has produced, and then asks the lexer to produce the next token after that. Whether or not trivia is allowed on the next token produced. In the .NET parser trivia is only allowed on a few constructs, and our parser mimics that behavior. Note that even if trivia is allowed, the type of trivia that can be scanned depends on the current RegexOptions. For example, if is currently enabled, then '#...' comments are allowed. Otherwise, only '(?#...)' comments are allowed. Given an input text, and set of options, parses out a fully representative syntax tree and list of diagnostics. Parsing should always succeed, except in the case of the stack overflowing. It's very common to have duplicated diagnostics. For example, consider "((". This will have two 'missing )' diagnostics, both at the end. Reporting both isn't helpful, so we filter duplicates out here. Parses out code of the form: ...|...|... This is the type of code you have at the top level of a regex, or inside any grouping contruct. Note that sequences can be empty in .NET regex. i.e. the following is legal: ...||... An empty sequence just means "match at every position in the test string". Parses out an escape sequence. Escape sequences are allowed in top level sequences and in character classes. In a top level sequence trivia will be allowed afterwards, but in a character class trivia is not allowed afterwards. Helper to convert simple string literals that escape quotes by doubling them. This is how normal VB literals and c# verbatim string literals work. The start characters string. " in VB and @" in C# Helper service that takes the raw text of a string token and produces the individual characters that raw string token represents (i.e. with escapes collapsed). The difference between this and the result from token.ValueText is that for each collapsed character returned the original span of text in the original token can be found. i.e. if you had the following in C#: "G\u006fo" Then you'd get back: 'G' -> [0, 1) 'o' -> [1, 7) 'o' -> [7, 1) This allows for embedded language processing that can refer back to the users' original code instead of the escaped value we're processing. Takes in a string token and return the s corresponding to each char of the tokens . In other words, for each char in ValueText there will be a VirtualChar in the resultant array. Each VirtualChar will specify what char the language considers them to represent, as well as the span of text in the original that the language created that char from. For most chars this will be a single character span. i.e. 'c' -> 'c'. However, for escapes this may be a multi character span. i.e. 'c' -> '\u0063' If the token is not a string literal token, or the string literal has any diagnostics on it, then will be returned. Additionally, because a VirtualChar can only represent a single char, while some escape sequences represent multiple chars, will also be returned in those cases. All these cases could be relaxed in the future. But they greatly simplify the implementation. If this function succeeds, certain invariants will hold. First, each character in the sequence of characters in .ValueText will become a single VirtualChar in the result array with a matching property. Similarly, each VirtualChar's will abut each other, and the union of all of them will cover the span of the token's *not* including the start and quotes. In essence the VirtualChar array acts as the information explaining how the of the token between the quotes maps to each character in the token's . The Regex and Json parsers wants to work over an array of characters, however this array of characters is not the same as the array of characters a user types into a string in C# or VB. For example In C# someone may write: @"\z". This should appear to the user the same as if they wrote "\\z" and the same as "\\\u007a". However, as these all have wildly different presentations for the user, there needs to be a way to map back the characters it sees ( '\' and 'z' ) back to the ranges of characters the user wrote. VirtualChar serves this purpose. It contains the interpreted value of any language character/character-escape-sequence, as well as the original SourceText span where that interpreted character was created from. This allows the regex and json parsers to both process input from any language uniformly, but then also produce trees and diagnostics that map back properly to the original source text locations that make sense to the user. Represents the individual characters that raw string token represents (i.e. with escapes collapsed). The difference between this and the result from token.ValueText is that for each collapsed character returned the original span of text in the original token can be found. i.e. if you had the following in C#: "G\u006fo" Then you'd get back: 'G' -> [0, 1) 'o' -> [1, 7) 'o' -> [7, 1) This allows for embedded language processing that can refer back to the user's original code instead of the escaped value we're processing. Abstraction over a contiguous chunk of s. This is used so we can expose s over an or over a . The latter is especially useful for reducing memory usage in common cases of string tokens without escapes. Thin wrapper over an actual . This will be the common construct we generate when getting the for a string token that has escapes in it. Represents a on top of a normal string. This is the common case of the type of the sequence we would create for a normal string token without any escapes in it. The underlying string that we're returning virtual chars from. Note: this will commonly include things like quote characters. Clients who do not want that should then ask for an appropriate back that does not include those characters. The actual characters that this is a portion of. The portion of that is being exposed. This span is `[inclusive, exclusive)`. Combines two s, producing a final sequence that points at the same underlying data, but spans from the start of to the end of . this is not real option set. it doesn't have all options defined in host. but only those we pre-selected. This is collection of asset storage This is collection of root checksum tree node global asset is an asset which life time is same as host map from solution checksum scope to its associated asset storage root tree node of checksum tree Asset that is not part of solution, but want to participate in helper type for custom asset workspace analyzer specific asset. we need this to prevent dlls from other languages such as typescript, f#, xaml and etc from loading at OOP start up. unlike project analyzer, analyzer that got installed from vsix doesn't do shadow copying so we don't need to load assembly to find out actual filepath. builder to create custom asset which is not part of solution but want to participate in this is desktop implementation of IReferenceSerializationService This is assembly loader for serialized analyzer reference. this will record display path ( returns) and actual path ( ) assembly needed to be loaded when requested, it will load from actual path. This deal with serializing/deserializing language specific data This deals with how to serialize/deserialize references that we have multiple implementations between different layers such as workspace, host - ex, VS. a service that lets one to create that can be used to pin solution while working on remote host Add global which stays alive while host is alive. this asset can be something that is not part of TODO: currently, this asset must be something can understand this should be changed so that custom serializer can be discoverable by Get saved global associated with given Remove saved global associated with given Create from . Get corresponding to given . Get s corresponding to given s. This lets consumer to get to inner temporary storage that references use as its shadow copy storage Information related to pinned solution Unique ID for this pinned solution This later used to find matching solution between VS and remote host This indicates whether this scope is for primary branch or not (not forked solution) Features like OOP will use this flag to see whether caching information related to this solution can benefit other requests or not This indicates a Solution.WorkspaceVersion of this solution. remote host engine uses this version to decide whether caching this solution will benefit other requests or not checksum scope that one can use to pin assets in memory while working on remote host Add asset that is not part of solution to be part of this snapshot. TODO: currently, this asset must be something can understand this should be changed so that custom serializer can be discoverable by This is just internal utility type to reduce allocations and reduntant code this is default implementation of IReferenceSerializationService Base for object that will use framework to synchronize data to remote host Indicates what kind of object it is for examples. this will be used in tranportation framework and deserialization service to hand shake how to send over data and deserialize serialized data Checksum of this object This will write out this object's data (the data the checksum is associated with) to bits this hide how each data is serialized to bits null asset indicating things that doesn't actually exist Asset that is part of solution Provides corresponding data of the given checksum return data of type T whose checksum is the given checksum Temporarily stores text and streams in memory mapped files. The maximum size in bytes of a single storage unit in a memory mapped file which is shared with other storage units. This value was arbitrarily chosen and appears to work well. Can be changed if data suggests something better. The size in bytes of a memory mapped file created to store multiple temporary objects. This value was arbitrarily chosen and appears to work well. Can be changed if data suggests something better. The synchronization object for accessing the memory mapped file related fields (indicated in the remarks of each field). PERF DEV NOTE: A concurrent (but complex) implementation of this type with identical semantics is available in source control history. The use of exclusive locks was not causing any measurable performance overhead even on 28-thread machines at the time this was written. The most recent memory mapped file for creating multiple storage units. It will be used via bump-pointer allocation until space is no longer available in it. Access should be synchronized on . The name of the current memory mapped file for multiple storage units. Access should be synchronized on . The total size of the current memory mapped file for multiple storage units. Access should be synchronized on . The offset into the current memory mapped file where the next storage unit can be held. Access should be synchronized on . Allocate shared storage of a specified size. "Small" requests are fulfilled from oversized memory mapped files which support several individual storage units. Larger requests are allocated in their own memory mapped files. The size of the shared storage block to allocate. A describing the allocated block. Our own abstraction on top of memory map file so that we can have shared views over mmf files. Otherwise, each view has minimum size of 64K due to requirement forced by windows. most of our view will have short lifetime, but there are cases where view might live a bit longer such as metadata dll shadow copy. shared view will help those cases. Instances of this class should be disposed when they are no longer needed. After disposing this instance, it should no longer be used. However, streams obtained through or will not be invalidated until they are disposed independently (which may occur before or after the is disposed. This class and its nested types have familiar APIs and predictable behavior when used in other code, but are non-trivial to work on. The implementations of adhere to the best practices described in DG Update: Dispose, Finalization, and Resource Management. Additional notes regarding operating system behavior leveraged for efficiency are given in comments. The memory mapped file. It is possible for this accessor to be disposed prior to the view and/or the streams which use it. However, the operating system does not actually close the views which are in use until the view handles are closed as well, even if the is disposed first. A weak reference to a read-only view for the memory mapped file. This holds a weak counted reference to current , which allows additional accessors for the same address space to be obtained up until the point when no external code is using it. When the memory is no longer being used by any objects, the view of the memory mapped file is unmapped, making the process address space it previously claimed available for other purposes. If/when it is needed again, a new view is created. This view is read-only, so it is only used by . The name of the memory mapped file. The offset into the memory mapped file of the region described by the current . The size of the region of the memory mapped file described by the current . Caller is responsible for disposing the returned stream. multiple call of this will not increase VM. Caller is responsible for disposing the returned stream. multiple call of this will increase VM. Run a function which may fail with an if not enough memory is available to satisfy the request. In this case, a full compacting GC pass is forced and the function is attempted again. and will use a native memory map, which can't trigger a GC. In this case, we'd otherwise crash with OOM, so we don't care about creating a UI delay with a full forced compacting GC. If it crashes the second try, it means we're legitimately out of resources. The type of argument to pass to the callback. The type returned by the function. The function to execute. The argument to pass to the function. The value returned by . Get underlying native memory directly. A value source that cache's its value weakly once obtained from its source. The source must allow repeatable accesses. This class is a that holds onto a value weakly, but can save its value and recover it on demand if needed. The initial value comes from the specified in the constructor. Derived types implement SaveAsync and RecoverAsync. Override this to save the state of the instance so it can be recovered. This method will only ever be called once. Override this method to implement asynchronous recovery semantics. This method may be called multiple times. Override this method to implement synchronous recovery semantics. This method may be called multiple times. Service used to enable recoverable object caches for a given Caches recoverable objects Compilations are put into a conditional weak table. Recoverable SyntaxTrees implement since they are numerous and putting them into a conditional weak table greatly increases GC costs in clr.dll!PromoteDependentHandle. If caching is enabled for key, the instance is added to a conditional weak table. It will not be collected until either caching is disabled for the project or the owner object is collected. If caching is not enabled for the project, the instance is added to a fixed-size cache. The instance passed in is always returned If caching is enabled for key, will be set to instance. The instance passed in is always returned Workspace service for cache implementations. May be raised by a Workspace host when available memory is getting low in order to request that caches be flushed. Extensible document properties specified via a document service. True if the source code contained in the document is only used in design-time (e.g. for completion), but is not passed to the compiler when the containing project is built. excerpt some part of return of given and the result might not be an exact copy of the given source or contains more then given span this mode shows intention not actual behavior. it is up to implementation how to interpret the intention. Result of excerpt excerpt content span on that given got mapped to classification information on the this excerpt is from should be same document in span on this excerpt is from should be same text span in TODO: Merge into . Used by Razor via IVT. document version of indicates whether this document supports diagnostics or not Empty interface just to mark document services. Gets a document specific service provided by the host identified by the service type. If the host does not provide the service, this method returns null. Map spans in a document to other spans even in other document this will be used by various features if provided to convert span in one document to other spans. for example, it is used to show spans users expect in a razor file rather than spans in auto generated file that is implementation detail or navigate to the right place rather than the generated file and etc. Map spans in the document to more appropriate locations in current design, this can NOT map a span to a span that is not backed by a file. for example, roslyn supports someone to have a document that is not backed by a file. and current design doesn't allow such document to be returned from this API for example, span on razor secondary buffer document in roslyn solution mapped to a span on razor cshtml file is possible but a span on razor cshtml file to a span on secondary buffer document is not possible since secondary buffer document is not backed by a file Document given spans belong to Spans in the document Cancellation token Return mapped span. order of result should be same as the given span Result of span mapping Path to mapped file LinePosition representation of the Span Mapped span MEF metadata class used to find exports declared for a specific . helper type to track whether has been initialized. currently, this helper only supports services whose lifetime is same as Host (ex, VS) TService for Workspace kind this event listener is initialized for MEF export attribute for one of values from indicating which service this event listener is for indicate which workspace kind this event listener is for provide a way for features to lazily subscribe to a service event for particular workspace see for supported services provide a way for to mark it as stoppable for example, if the service is used for is a disposable service, the service can call Stop when the service go away provide a way for features to lazily subscribe to a service event for particular workspace see for supported services Ensure is called for the workspace list of well known types Provide host specific information if host supports it. Per language services provided by the host environment. The that originated this language service. The name of the language Gets a language specific service provided by the host identified by the service type. If the host does not provide the service, this method returns null. Gets a language specific service provided by the host identified by the service type. If the host does not provide the service, this method returns throws . A factory for creating compilations instances. Services provided by the host environment. Creates a new workspace service. Per workspace services provided by the host environment. The host services this workspace services originated from. The workspace corresponding to this workspace services instantiation Gets a workspace specific service provided by the host identified by the service type. If the host does not provide the service, this method returns null. Gets a workspace specific service provided by the host identified by the service type. If the host does not provide the service, this method throws . The host does not provide the service. A service for storing information across that can be retrieved in a separate process. A service for storing information in a temporary location that only lasts for the duration of the process. A factory that constructs . A list of language names for supported language services. Returns true if the language is supported. Gets the for the language name. Thrown if the language isn't supported. Finds all language services of the corresponding type across all supported languages that match the filter criteria. Empty interface just to mark language services. Empty interface just to mark workspace services. Use this attribute to declare a implementation for MEF file extensions this can handle such as cshtml match will be done by Use this attribute to declare a implementation for inclusion in a MEF-based workspace. The assembly qualified name of the service's type. The language that the service is target for; LanguageNames.CSharp, etc. The layer that the service is specified for; ServiceLayer.Default, etc. Declares a implementation for inclusion in a MEF-based workspace. The type that will be used to retrieve the service from a . The language that the service is target for; LanguageNames.CSharp, etc. The layer that the service is specified for; ServiceLayer.Default, etc. Use this attribute to declare a implementation for inclusion in a MEF-based workspace. The assembly qualified name of the service's type. The language that the service is target for; LanguageNames.CSharp, etc. The layer that the service is specified for; ServiceLayer.Default, etc. Declares a implementation for inclusion in a MEF-based workspace. The type that will be used to retrieve the service from a . The language that the service is target for; LanguageNames.CSharp, etc. The layer that the service is specified for; ServiceLayer.Default, etc. Use this attribute to declare a implementation for inclusion in a MEF-based workspace. The assembly qualified name of the service's type. The layer that the service is specified for; ServiceLayer.Default, etc. Declares a implementation for inclusion in a MEF-based workspace. The type that will be used to retrieve the service from a . The layer that the service is specified for; , etc. Use this attribute to declare a implementation for inclusion in a MEF-based workspace. The assembly qualified name of the service's type. The layer that the service is specified for; ServiceLayer.Default, etc. Declares a implementation for inclusion in a MEF-based workspace. The type that will be used to retrieve the service from a . The layer or workspace kind that the service is specified for; , etc. MEF metadata class used to find exports declared for a specific file extensions. This interface is provided purely to enable some shared logic that handles multiple kinds of metadata that share the Language property. It should not be used to find exports via MEF, use LanguageMetadata instead. A factory that creates instances of a specific . Implement a when you want to provide instances that use other services. Creates a new instance. The that can be used to access other services. This interface is provided purely to enable some shared logic that handles multiple kinds of metadata that share the Languages property. It should not be used to find exports via MEF, use LanguageMetadata instead. A factory that creates instances of a specific . Implement a when you want to provide instances that use other services. Creates a new instance. Returns null if the service is not applicable to the given workspace. The that can be used to access other services. MEF metadata class used to find exports declared for a specific language. MEF metadata class used for finding and exports. This delegate allows test code to override the behavior of . Injects replacement behavior for the method. The layer of an exported service. If there are multiple definitions of a service, the is used to determine which is used. Service layer that overrides , and . Service layer that overrides and . Service layer that overrides . The base service layer. MEF metadata class used to find exports declared for a specific . MEF metadata class used for finding and exports. Provides a way to map from an assembly name to the actual path of the .NET Framework assembly with that name in the context of a specified project. For example, if the assembly name is "System.Data" then a project targeting .NET 2.0 would resolve this to a different path than a project targeting .NET 4.5. Returns null if the assembly name could not be resolved. An optional type name for a type that must exist in the assembly. The project context to search within. The name of the assembly to try to resolve. A cache for metadata references. A collection of references to the same underlying metadata, each with different properties. Reads the existing checksum we have for the solution with the given , or if we do not have a checksum persisted. Reads the existing checksum we have for the given with the given , or if we do not have a checksum persisted. Reads the existing checksum we have for the given with the given , or if we do not have a checksum persisted. Reads the stream for the solution with the given . If is provided, the persisted checksum must match it. If there is no such stream with that name, or the checksums do not match, then will be returned. Reads the stream for the with the given . If is provided, the persisted checksum must match it. If there is no such stream with that name, or the checksums do not match, then will be returned. Reads the stream for the with the given . If is provided, the persisted checksum must match it. If there is no such stream with that name, or the checksums do not match, then will be returned. Reads the stream for the solution with the given . An optional can be provided to store along with the data. This can be used along with ReadStreamAsync with future reads to ensure the data is only read back if it matches that checksum. Reads the stream for the with the given . An optional can be provided to store along with the data. This can be used along with ReadStreamAsync with future reads to ensure the data is only read back if it matches that checksum. Reads the stream for the with the given . An optional can be provided to store along with the data. This can be used along with ReadStreamAsync with future reads to ensure the data is only read back if it matches that checksum. A synchronous event raised prior to the location that would return changes. The new location. May be null if there is no longer a location. Specifies if any consumers must immediately start using the new storage location. Sometimes, the storage location is moving due to a user operation which requires components to immediately release any file locks on the old location. A good example is renaming a solution, which changes the storage location. In that case, the storage location is going to get moved synchronously after this event is fired. Other times, it's because we closed the solution and we're simply giving a hint to people that they should start shutting down. This service allows you to persist information relative to solution, projects and documents. A service that enables storing and retrieving of information associated with solutions, projects or documents across runtime sessions. provides info on the given file this will be used to provide dynamic content such as generated content from cshtml to workspace we acquire this from exposed from external components such as razor for cshtml for now, return null. in future, we will use this to get right options from editorconfig return for this file return to load content for the dynamic file return for the content it provided Provider for the implementer of this service should be pure free-thread meaning it can't switch to UI thread underneath. otherwise, we can get into dead lock if we wait for the dynamic file info from UI thread return for the context given this file belongs to full path to project file (ex, csproj) full path to non source file (ex, cshtml) null if this provider can't handle the given file let provider know certain file has been removed this file belongs to full path to project file (ex, csproj) full path to non source file (ex, cshtml) indicate content of a file has updated. the event argument "string" should be same as "filepath" given to Provides workspace status this is an work in-progress interface, subject to be changed as we work on prototype. it can completely removed at the end or new APIs can added and removed as prototype going on no one except one in the prototype group should use this interface. tracking issue - https://github.com/dotnet/roslyn/issues/34415 Indicate that status has changed Wait until workspace is fully loaded unfortunately, some hosts, such as VS, use services (ex, IVsOperationProgressStatusService) that require UI thread to let project system to proceed to next stages. what that means is that this method should only be used with either await or JTF.Run, it should be never used with Task.Wait otherwise, it can deadlock Indicates whether workspace is fully loaded unfortunately, some hosts, such as VS, use services (ex, IVsOperationProgressStatusService) that require UI thread to let project system to proceed to next stages. what that means is that this method should only be used with either await or JTF.Run, it should be never used with Task.Wait otherwise, it can deadlock Factory service for creating syntax trees. An abstraction for running tasks either in sequence or in parallel. Execute the task action on a thread owned by a task scheduler. Execute the task function on a thread owned by a task scheduler and return the schedule task that can be used to wait for the result. Execute the task function on a thread owned by a task scheduler and return the schedule task that can be used to wait for the result. Execute the task function on a thread owned by a task scheduler and return the schedule task that can be used to wait for the result. A factory that creates either sequential or parallel task schedulers. Creates a workspace task scheduler that schedules tasks to run in parallel on the background. Creates a workspace task scheduler that schedules task to run in sequence to be used for raising workspace events. support direct memory access pointer TemporaryStorage can be used to read and write text to a temporary storage location. This service allows you to access temporary storage. This service allows you to access temporary storage. Attach to existing with given name. Attach to existing with given name. TemporaryStorage can be used to read and write text to a temporary storage location. Get name of the temporary storage Get offset of the temporary storage Get size of the temporary storage A factory for creating instances. Creates from a stream. The stream to read the text from. Must be readable and seekable. The text is read from the start of the stream. 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 the system encoding. Note that if the stream starts with Byte Order Mark the value of is ignored. Cancellation token. 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. Creates from a reader with given . The to read the text from. Specifies an encoding for the SourceText. it could be null. but if null is given, it won't be able to calculate checksum Cancellation token. serialize and deserialize objects to straem. some of these could be moved into actual object, but putting everything here is a bit easier to find I believe. also, consider moving this serializer to use C# BOND serializer https://github.com/Microsoft/bond serialize and deserialize objects to stream. some of these could be moved into actual object, but putting everything here is a bit easier to find I believe. serialize and deserialize objects to straem. some of these could be moved into actual object, but putting everything here is a bit easier to find I believe. collection which children is checksum. this is a collection that has its own checksum and contains only checksum or checksum collection as its children. hold onto object checksum that currently doesn't have a place to hold onto checksum Show error info in an active view. Different host can have different definition on what active view means. Show global error info. this kind error info should be something that affects whole roslyn such as background compilation is disabled due to memory issue and etc Show an info bar in the current active view. Different hosts can have different definitions on what active view means. Show global info bar Runs dataflow analysis for the given on the given . Control flow graph on which to execute analysis. Dataflow analyzer. Block analysis data at the end of the exit block. Algorithm for this CFG walker has been forked from 's internal implementation for basic block reachability computation: "MarkReachableBlocks", we should keep them in sync as much as possible. Analyzer to execute custom dataflow analysis on a control flow graph. Custom data tracked for each basic block with values at start of the block. Gets current analysis data for the given basic block, or an empty analysis data. Gets empty analysis data for first analysis pass on a basic block. Updates the current analysis data for the given basic block. Analyze the given basic block and return the block analysis data at the end of the block for its successors. Analyze the non-conditional fallthrough successor branch for the given basic block and return the block analysis data for the branch destination. Analyze the given conditional branch for the given basic block and return the block analysis data for the branch destinations for the fallthrough and conditional successor branches. Merge the given block analysis data instances to produce the resultant merge data. Returns true if both the given block analysis data instances should be considered equivalent by analysis. Flag indicating if the dataflow analysis should run on unreachable blocks. Indicates the kind of flow capture in an . Indicates an R-Value flow capture, i.e. capture of a symbol's value. Indicates an L-Value flow capture, i.e. captures of a symbol's location/address. Indicates both an R-Value and an L-Value flow capture, i.e. captures of a symbol's value and location/address. These are generated for left of a compound assignment operation, such that there is conditional code on the right side of the compound assignment. Helper class to detect s that are l-value captures. L-value captures are essentially captures of a symbol's location/address. Corresponding s which share the same as this flow capture, dereferences and writes to this location subsequently in the flow graph. For example, consider the below code: a[i] = x ?? a[j]; The control flow graph contains an initial flow capture of "a[i]" to capture the l-value of this array element: FC0 (a[i]) Then it evaluates the right hand side, which can have different values on different control flow paths, and the resultant value is then written to the captured location: FCR0 = result NOTE: This type is a workaround for https://github.com/dotnet/roslyn/issues/31007 and it can be deleted once that feature is implemented. Analysis to compute all the symbol writes for local and parameter symbols in an executable code block, along with the information of whether or not the definition may be read on some control flow path. Core analysis data to drive the operation for operation tree based analysis OR control flow graph based analysis. Pooled allocated during analysis with the current instance, which will be freed during . Map from each (symbol, write) to a boolean indicating if the value assigned at the write is read on some control flow path. For example, consider the following code: int x = 0; x = 1; Console.WriteLine(x); This map will have two entries for 'x': 1. Key = (symbol: x, write: 'int x = 0') Value = 'false', because value assigned to 'x' here **is never** read. 2. Key = (symbol: x, write: 'x = 1') Value = 'true', because value assigned to 'x' here **may be** read on some control flow path. Set of locals/parameters that are read at least once. Set of lambda/local functions whose invocations are currently being analyzed to prevent infinite recursion for analyzing code with recursive lambda/local function calls. Current block analysis data used for analysis. Block analysis data used for an additional conditional branch. Creates an immutable for the current analysis data. Resets all the currently tracked symbol writes to be conservatively marked as read. Analysis data for a particular for based dataflow analysis OR for the entire executable code block for high level operation tree based analysis. Map from each symbol to possible set of reachable write operations that are live at current program point. A write is live if there is no intermediate write operation that overwrites it. Gets the currently reachable writes for the given symbol. Marks the given symbol write as a new unread write operation, potentially clearing out the prior write operations if is false. Runs dataflow analysis on the given control flow graph to compute symbol usage results for symbol read/writes. Runs a fast, non-precise operation tree based analysis to compute symbol usage results for symbol read/writes. Dataflow analysis to compute symbol usage information (i.e. reads/writes) for locals/parameters in a given control flow graph, along with the information of whether or not the writes may be read on some control flow path. Map from basic block to current for dataflow analysis. Callback to analyze lambda/local function invocations and return new block analysis data. Map from flow capture ID to set of captured symbol addresses along all possible control flow paths. Map from operations to potential delegate creation targets that could be invoked via delegate invocation on the operation. Used to analyze delegate creations/invocations of lambdas and local/functions defined in a method. Map from local functions to the where the local function was accessed to create an invocable delegate. This control flow graph is required to lazily get or create the control flow graph for this local function at delegate invocation callsite. Map from lambdas to the where the lambda was defined to create an invocable delegate. This control flow graph is required to lazily get or create the control flow graph for this lambda at delegate invocation callsite. Map from basic block range to set of writes within this block range. Used for try-catch-finally analysis, where start of catch/finally blocks should consider all writes in the corresponding try block as reachable. Flow captures for l-value or address captures. Special handling to ensure that at start of catch/filter/finally region analysis, we mark all symbol writes from the corresponding try region as reachable in the catch/filter/finally region. Operations walker used for walking high-level operation tree as well as control flow graph based operations. Map from each symbol write to a boolean indicating if the value assinged at write is used/read on some control flow path. For example, consider the following code: int x = 0; x = 1; Console.WriteLine(x); This map will have two entries for 'x': 1. Key = (symbol: x, write: 'int x = 0') Value = 'false', because value assigned to 'x' here **is never** read. 2. Key = (symbol: x, write: 'x = 1') Value = 'true', because value assigned to 'x' here **may be** read on some control flow path. Set of locals/parameters that are read at least once. Gets symbol writes that have are never read. WriteOperation will be null for the initial value write to parameter symbols from the callsite. Returns true if the initial value of the parameter from the caller is used. Gets the write count for a given local/parameter symbol. Returns the for the given operation. This extension can be removed once https://github.com/dotnet/roslyn/issues/25057 is implemented. Retursn true if the given operation is a regular compound assignment, i.e. such as a += b, or a special null coalescing compoud assignment, i.e. such as a ??= b. Provides information about the way a particular symbol is being used at a symbol reference node. For namespaces and types, this corresponds to values from . For methods, fields, properties, events, locals and parameters, this corresponds to values from . Represents default value indicating no usage. Represents a reference to a namespace or type on the left side of a dotted name (qualified name or member access). For example, 'NS' in NS.Type x = new NS.Type(); or NS.Type.StaticMethod(); or 'Type' in Type.NestedType x = new Type.NestedType(); or Type.StaticMethod(); Represents a generic type argument reference. For example, 'Type' in Generic{Type} x = ...; or class Derived : Base{Type} { } Represents a type parameter constraint that is a type. For example, 'Type' in class Derived{T} where T : Type { } Represents a base type or interface reference in the base list of a named type. For example, 'Base' in class Derived : Base { }. Represents a reference to a type whose instance is being created. For example, 'C' in var x = new C();, where 'C' is a named type. Represents a reference to a namespace or type within a using or imports directive. For example, using NS; or using static NS.Extensions or using Alias = MyType. Represents a reference to a namespace name in a namespace declaration context. For example, 'N1' or namespaces N1.N2 { }. Represents default value indicating no usage. Represents a value read. For example, reading the value of a local/field/parameter. Represents a value write. For example, assigning a value to a local/field/parameter. Represents a reference being taken for the symbol. For example, passing an argument to an "in", "ref" or "out" parameter. Represents a name-only reference that neither reads nor writes the underlying value. For example, 'nameof(x)' or reference to a symbol 'x' in a documentation comment does not read or write the underlying value stored in 'x'. Represents a value read and/or write. For example, an increment or compound assignment operation. Represents a readable reference being taken to the value. For example, passing an argument to an "in" or "ref readonly" parameter. Represents a readable reference being taken to the value. For example, passing an argument to an "out" parameter. Represents a value read or write. For example, passing an argument to a "ref" parameter. The name to pattern match against, and to show in a final presentation layer. An optional suffix to be shown in a presentation layer appended to . Can be null. Container of the symbol that can be shown in a final presentation layer. For example, the container of a type "KeyValuePair" might be "System.Collections.Generic.Dictionary<TKey, TValue>". This can then be shown with something like "type System.Collections.Generic.Dictionary<TKey, TValue>" to indicate where the symbol is located. Dotted container name of the symbol, used for pattern matching. For example The fully qualified container of a type "KeyValuePair" would be "System.Collections.Generic.Dictionary" (note the lack of type parameters). This way someone can search for "D.KVP" and have the "D" part of the pattern match against this. This should not be shown in a presentation layer. The names directly referenced in source that this type inherits from. Provides helper methods for finding dependent projects across a solution that a given symbol can be referenced within. A helper struct used for keying in . Dependent projects cache. For a given solution, maps from an assembly (source/metadata) to the set of projects referencing it. Key: DefinitionProject, which contains the assembly name and a flag indicating whether assembly is source or metadata assembly. Value: List of DependentProjects, where each DependentProject contains a dependent project ID and a flag indicating whether the dependent project has internals access to definition project. Used to create a new concurrent dependent projects map for a given assembly when needed. This method computes the dependent projects that need to be searched for references of the given . This computation depends on the given symbol's visibility: 1) Public: Dependent projects include the symbol definition project and all the referencing projects. 2) Internal: Dependent projects include the symbol definition project and all the referencing projects that have internals access to the definition project. 3) Private: Dependent projects include the symbol definition project and all the referencing submission projects (which are special and can reference private fields of the previous submission). We perform this computation in two stages: 1) Compute all the dependent projects (submission + non-submission) and their InternalsVisibleTo semantics to the definition project. 2) Filter the above computed dependent projects based on symbol visibility. Dependent projects computed in stage (1) are cached to avoid recomputation. This method creates an initial cheap InternalsVisibleTo map from the given to the assembly names that have friend access to this assembly. This map is a superset of the actual InternalsVisibleTo map and is used for performance reasons only. While identifying depend projects that can reference a given symbol (see method ), we need to know a symbol's accessibility from referencing projects. This requires us to create a compilation for the referencing project just to check accessibility and can be performance intensive. Instead, we crack the assembly attributes just for the symbol's containing assembly here to enable cheap checks for friend assemblies in . Determines if this project has a reference to an assembly matching a passed in predicate. The predicate returns 'null' to indicate no match, and non-null to indicate a match of some kind. If any match is found, that value is returned as the value of this function. Otherwise 'null' is returned. Provides helper methods for finding dependent types (derivations, implementations, etc.) across a solution. The results found are returned in pairs of s and s. The Ids specify what project we were searching in when we found the symbol. That project has the compilation that we found the specific source or metadata symbol within. Note that for metadata symbols there could be many projects where the same symbol could be found. However, we only return the first instance we found. Used for implementing the Inherited-By relation for progression. This is an internal implementation of , which is a publically callable method. Implementation of for s Implementation of for s Used for implementing the Inherited-By relation for progression. Finds all the documents in the provided project that contain the requested string values If the `node` implicitly matches the `symbol`, then it will be added to `locations`. The actual node that we found the reference on. Normally the 'Name' portion of any piece of syntax. Might also be something like a 'foreach' statement node when finding results for something like GetEnumerator. The location we want want to return through the FindRefs API. The location contains additional information (like if this was a Write, or if it was Implicit). This value also has a property. Importantly, this value is not necessarily the same location you would get by calling .. Instead, this location is where we want to navigate the user to. A case where this can be different is with an indexer reference. The will be the node for the full 'ElementAccessExpression', whereas the location we will take the user to will be the zero-length position immediately preceding the `[` character. Extensibility interface to allow individual languages to extend the 'Find References' service. Languages can use this to provide specialized cascading logic between symbols that 'Find References' is searching for. Extensibility interface to allow extending the IFindReferencesService service. Implementations must be thread-safe as the methods on this interface may be called on multiple threads simultaneously. Implementations should also respect the provided cancellation token and should try to cancel themselves quickly when requested. Called by the find references search engine when a new symbol definition is found. Implementations can then choose to request more symbols be searched for. For example, an implementation could choose for the find references search engine to cascade to constructors when searching for standard types. Implementations of this method must be thread-safe. Called by the find references search engine to determine which projects should be searched for a given symbol. The returned projects will then be searched in parallel. If the implementation does not care about the provided symbol then null can be returned from this method. Implementations should endeavor to keep the list of returned projects as small as possible to keep search time down to a minimum. Returning the entire list of projects in a solution is not recommended (unless, of course, there is reasonable reason to believe there are references in every project). Implementations of this method must be thread-safe. Called by the find references search engine to determine which documents in the supplied project need to be searched for references. Only projects returned by DetermineProjectsToSearch will be passed to this method. Implementations should endeavor to keep the list of returned documents as small as possible to keep search time down to a minimum. Returning the entire list of documents in a project is not recommended (unless, of course, there is reasonable reason to believe there are references in every document). Implementations of this method must be thread-safe. Called by the find references search engine to determine the set of reference locations in the provided document. Only documents returned by DetermineDocumentsToSearch will be passed to this method. Implementations of this method must be thread-safe. The list of common reference finders. A class that reports the current progress made when finding references to symbols. Mapping from a document to the list of reference locations found in it. Kept around so we only notify the callback once when a location is found for a reference (in case multiple finders find the same reference location for a symbol). When searching for property, associate specific references we find to the relevant accessor symbol (if there is one). For example, in C#, this would result in: P = 0; // A reference to the P.set accessor var v = P; // A reference to the P.get accessor P++; // A reference to P.get and P.set accessors nameof(P); // A reference only to P. Not associated with a particular accessor. The default for this is false. With that default, all of the above references are associated with the property P and not the accessors. For IDE features, if the user starts searching on an accessor, then we want to give results associated with the specific accessor. Otherwise, if they search on a property, then associate everything with the property. A class that reports the current progress made when finding references to symbols. Wraps an into an so it can be used from the new streaming find references APIs. Reports the progress of the FindReferences operation. Note: these methods may be called on any thread. Reports the progress of the FindReferences operation. Note: these methods may be called on any thread. Represents a single result of the call to the synchronous IFindReferencesService.FindReferences method. Finding the references to a symbol will result in a set of definitions being returned (containing at least the symbol requested) as well as any references to those definitions in the source. Multiple definitions may be found due to how C# and VB allow a symbol to be both a definition and a reference at the same time (for example, a method which implements an interface method). The symbol definition that these are references to. The set of reference locations in the solution. Information about a reference to a symbol. The document that the reference was found in. If the symbol was bound through an alias, then this is the alias that was used. The actual source location for a given symbol. Indicates if this is an implicit reference to the definition. i.e. the definition wasn't explicitly stated in the source code at this position, but it was still referenced. For example, this can happen with special methods like GetEnumerator that are used implicitly by a 'for each' statement. Indicates if this is a location where the reference is written to. Symbol usage info for this reference. Additional properties for this reference Indicates if this was not an exact reference to a location, but was instead a possible location that was found through error tolerance. For example, a call to a method like "Goo()" could show up as an error tolerance location to a method "Goo(int i)" if no actual "Goo()" method existed. Use an case-sensitive comparison when searching for matching items. Use a case-insensitive comparison when searching for matching items. Use a fuzzy comparison when searching for matching items. Fuzzy matching allows for a certain amount of misspellings, missing words, etc. See for more details. Search term is matched in a custom manner (i.e. with a user provided predicate). The name being searched for. Is null in the case of custom predicate searching.. But can be used for faster index based searching when it is available. The kind of search this is. Faster index-based searching can be used if the SearchKind is not . The predicate to fall back on if faster index searching is not possible. Collects all the definitions and references that are reported independently and packages them up into the final list of . This is used by the old non-streaming Find-References APIs to return all the results at the end of the operation, as opposed to broadcasting the results as they are found. Represents a symbol and the project it was acquired from. It should always be the case that if you have the original solution that this symbol came from, that you'll be able to find this symbol in the compilation for the specified project. Note that the 'Same' symbol could be acquired from many different projects (after all, each project sees, at least, all the public symbols for all the projects it references). As such, a single ISymbol could be found in many places. The ProjectId at least gives us a single place to look for it again. The purpose of this type is to support serializing/deserializing symbols and allowing features to work out-of-process (OOP). In OOP scenarios, we will need to marshal s to and from the host and the external process. That means being able to recover the on either side. With the this becomes possible. Accordingly, it is ok to have a that does not have a . It just means that that data cannot be marshalled in an OOP scenario. Existing features, and third party clients will then have code that still works (albeit just in-process). However, code that updates to use this can then opt-into working OOP. Note: for purposes of Equality/Hashing, all that we use is the underlying Symbol. That's because nearly all IDE features only care if they're looking at the same symbol, they don't care if hte symbol came from a different project or not. i.e. a feature like FAR doesn't want to cascade into the "same" symbol even if it hits it in another project. As such, we do not include the ProjectId when computing the result. Provides a way for us to store and compare SymbolAndProjectId in the sets that we're using. For the purposes of the operations in these entities are the same if they point to Symbols that are considered the same. For example, if we find a derived type of 'X' called 'Y' in a metadata assembly 'M' in project A and we also find a derived type of 'X' called 'Y' in a metadata assembly 'M' in project B, then we consider these the same. What project we were searching in does not matter to us in terms of deciding if these symbols are the same or not. We're only keeping the projects to return to the caller information about what project we were searching when we found the symbol. Note(cyrusn): We're using SymbolEquivalenceComparer.Instance as the underlying way of comparing symbols. That's probably not correct as it won't appropriately deal with forwarded types. However, that's the behavior that we've already had in this type for a while, so this is just preserving that logic. If this is an issue in the future, this underlying comparer can absolutely be changed to something more appropriate. Note(cyrusn): We're using SymbolEquivalenceComparer.Instance as the underlying way of comparing symbols. That's probably not correct as it won't appropriately deal with forwarded types. However, that's the behavior that we've already had in this type for a while, so this is just preserving that logic. If this is an issue in the future, this underlying comparer can absolutely be changed to something more appropriate. Contains information about a call from one symbol to another. The symbol making the call is stored in CallingSymbol and the symbol that the call was made to is stored in CalledSymbol. Whether or not the call is direct or indirect is also stored. A direct call is a call that does not go through any other symbols in the inheritance hierarchy of CalledSymbol, while an indirect call does go through the inheritance hierarchy. For example, calls through a base member that this symbol overrides, or through an interface member that this symbol implements will be considered 'indirect'. The symbol that is calling the symbol being called. The locations inside the calling symbol where the called symbol is referenced. The symbol being called. True if the CallingSymbol is directly calling CalledSymbol. False if it is calling a symbol in the inheritance hierarchy of the CalledSymbol. For example, if the called symbol is a class method, then an indirect call might be through an interface method that the class method implements. Obsolete. Use . Finds the symbol that is associated with a position in the text of a document. The semantic model associated with the document. The character position within the document. A workspace to provide context. A CancellationToken. Finds the definition symbol declared in source code for a corresponding reference symbol. Returns null if no such symbol can be found in the specified solution. Finds symbols in the given compilation that are similar to the specified symbol. A found symbol may be the exact same symbol instance if the compilation is the origin of the specified symbol, or it may be a different symbol instance if the compilation is not the originating compilation. Multiple symbols may be returned if there are ambiguous matches. No symbols may be returned if the compilation does not define or have access to a similar symbol. The symbol to find corresponding matches for. A compilation to find the corresponding symbol within. The compilation may or may not be the origin of the symbol. A CancellationToken. Callback object we pass to the OOP server to hear about the result of the FindReferencesEngine as it executes there. Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name. Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name. Find the symbols for declarations made in source with a matching name. Find the symbols for declarations made in source with a matching name. Find the symbols for declarations made in source with a matching name. Find the symbols for declarations made in source with a matching name. Find the symbols for declarations made in source with the specified name. Find the symbols for declarations made in source with the specified name. Find the symbols for declarations made in source with the specified name. Find the symbols for declarations made in source with the specified name. Find the symbols for declarations made in source with the specified pattern. This pattern is matched using heuristics that may change from release to release. So, the set of symbols matched by a given pattern may change between releases. For example, new symbols may be matched by a pattern and/or symbols previously matched by a pattern no longer are. However, the set of symbols matched by a specific release will be consistent for a specific pattern. Find the symbols for declarations made in source with the specified pattern. This pattern is matched using heuristics that may change from release to release. So, the set of symbols matched by a given pattern may change between releases. For example, new symbols may be matched by a pattern and/or symbols previously matched by a pattern no longer are. However, the set of symbols matched by a specific release will be consistent for a specific pattern. Find the symbols for declarations made in source with the specified pattern. This pattern is matched using heuristics that may change from release to release. So, the set of symbols matched by a given pattern may change between releases. For example, new symbols may be matched by a pattern and/or symbols previously matched by a pattern no longer are. However, the set of symbols matched by a specific release will be consistent for a specific pattern. Find the symbols for declarations made in source with the specified pattern. This pattern is matched using heuristics that may change from release to release. So, the set of symbols matched by a given pattern may change between releases. For example, new symbols may be matched by a pattern and/or symbols previously matched by a pattern no longer are. However, the set of symbols matched by a specific release will be consistent for a specific pattern. Finds all references to a symbol throughout a solution The symbol to find references to. The solution to find references within. A cancellation token. Finds all references to a symbol throughout a solution The symbol to find references to. The solution to find references within. A set of documents to be searched. If documents is null, then that means "all documents". A cancellation token. Finds all references to a symbol throughout a solution The symbol to find references to. The solution to find references within. An optional progress object that will receive progress information as the search is undertaken. An optional set of documents to be searched. If documents is null, then that means "all documents". An optional cancellation token. Find symbols for members that override the specified member symbol. Find symbols for declarations that implement members of the specified interface symbol Finds the derived classes of the given type. Implementations of an interface are not considered "derived", but can be found with . The symbol to find derived types of. The solution to search in. The projects to search. Can be null to search the entire solution. The derived types of the symbol. The symbol passed in is not included in this list. Finds the symbols that implement an interface or interface member. Finds all the callers of a specified symbol. Finds all the callers of a specified symbol. Returns null if the info cannot be retrieved from the cache. Returns null if the info cannot be retrieved from the cache. To prevent lots of allocations, we concatenate all the names in all our Nodes into one long string. Each Node then just points at the span in this string with the portion they care about. The list of nodes that represent symbols. The primary key into the sorting of this list is the name. They are sorted case-insensitively with the . Finding case-sensitive matches can be found by binary searching for something that matches insensitively, and then searching around that equivalence class for one that matches. Inheritance information for the types in this assembly. The mapping is between a type's simple name (like 'IDictionary') and the simple metadata names of types that implement it or derive from it (like 'Dictionary'). Note: to save space, all names in this map are stored with simple ints. These ints are the indices into _nodes that contain the nodes with the appropriate name. This mapping is only produced for metadata assemblies. The task that produces the spell checker we use for fuzzy match queries. We use a task so that we can generate the without having to wait for the spell checker construction to finish. Features that don't need fuzzy matching don't want to incur the cost of the creation of this value. And the only feature which does want fuzzy matching (add-using) doesn't want to block waiting for the value to be created. Finds symbols in this assembly that match the provided name in a fuzzy manner. Get all symbols that have a name matching the specified name. Gets all the node indices with matching names per the . Searches for a name in the ordered list that matches per the . Used to produce the simple-full-name components of a type from metadata. The name is 'simple' in that it does not contain things like backticks, generic arguments, or nested type + separators. Instead just hte name of the type, any containing types, and the component parts of its namespace are added. For example, for the type "X.Y.O`1.I`2, we will produce [X, Y, O, I] s are produced when initially creating our indices. They store Names of symbols and the index of their parent symbol. When we produce the final though we will then convert these to s. Those nodes will not point to individual strings, but will instead point at . Span in of the Name of this Node. Index in of the parent Node of this Node. Value will be if this is the Node corresponding to the root symbol. Produces a for a given . Note: will never return null; Loads the SpellChecker for a given assembly symbol (metadata or project). If the info can't be loaded, it will be created (and persisted if possible). Generalized function for loading/creating/persisting data. Used as the common core code for serialization of SymbolTreeInfos and SpellCheckers. Cache of project to the checksum for it so that we don't have to expensively recompute this each time we get a project. Returns true when the identifier is probably (but not guaranteed) to be within the syntax tree. Returns false when the identifier is guaranteed to not be within the syntax tree. Returns true when the identifier is probably (but not guaranteed) escaped within the text of the syntax tree. Returns false when the identifier is guaranteed to not be escaped within the text of the syntax tree. An identifier that is not escaped within the text can be found by searching the text directly. An identifier that is escaped can only be found by parsing the text and syntactically interpreting any escaping mechanisms found in the language ("\uXXXX" or "@XXXX" in C# or "[XXXX]" in Visual Basic). Returns true when the identifier is probably (but not guaranteed) to be within the syntax tree. Returns false when the identifier is guaranteed to not be within the syntax tree. String interning table so that we can share many more strings in our DeclaredSymbolInfo buckets. Keyed off a Project instance so that we share all these strings as we create the or load the index items for this a specific Project. This helps as we will generally be creating or loading all the index items for the documents in a Project at the same time. Once this project is let go of (which happens with any solution change) then we'll dump this string table. The table will have already served its purpose at that point and doesn't need to be kept around further. Base implementation of C# and VB formatting services. a tweaked version of our interval tree to meet the formatting engine's need it now has an ability to return a smallest span that contains a position rather than all Intersecting or overlapping spans this class maintain contextual information such as indentation of current position, based token to follow in current position and etc. data that will be used in an interval tree related to Anchor. data that will be used in an interval tree related to indentation. data that will be used in an interval tree related to suppressing spacing operations. data that will be used in an interval tree related to suppressing wrapping operations. rewrite the node with the given trivia information in the map return summary for current formatting work this actually applies formatting operations to trivia between two tokens span in the tree to format rewrite the tree info root node with the trivia information in the map represents a general trivia between two tokens. slightly more expensive than others since it needs to calculate stuff unlike other cases this collector gathers formatting operations that are based on a node it represents a token that is inside of token stream not also outside of token stream it uses an index to navigate previous and after tokens in the stream to make navigation faster. and regular Previous/NextToken for tokens outside of the stream. this object is supposed to be live very short but created a lot of time. that is why it is struct. (same reason why SyntaxToken is struct - to reduce heap allocation) it holds onto space and wrapping operation need to run between two tokens. This class takes care of tokens consumed in the formatting engine. It will maintain information changed compared to original token information. and answers information about tokens. Thread-safe collection that holds onto changes Get column of the token * column means text position on a line where all tabs are converted to spaces that first position on a line becomes 0 this provides information about the syntax tree formatting service is formatting. this provides necessary abstraction between different kinds of syntax trees so that ones that contain actual text or cache can answer queries more efficiently. it holds onto trivia information between two tokens Formats whitespace in documents or syntax trees. The annotation used to mark portions of a syntax tree to be formatted. Gets the formatting rules that would be applied if left unspecified. Gets the formatting rules that would be applied if left unspecified. Formats the whitespace in a document. The document to format. An optional set of formatting options. If these options are not supplied the current set of options from the document's workspace will be used. An optional cancellation token. The formatted document. Formats the whitespace in an area of a document corresponding to a text span. The document to format. The span of the document's text to format. An optional set of formatting options. If these options are not supplied the current set of options from the document's workspace will be used. An optional cancellation token. The formatted document. Formats the whitespace in areas of a document corresponding to multiple non-overlapping spans. The document to format. The spans of the document's text to format. An optional set of formatting options. If these options are not supplied the current set of options from the document's workspace will be used. An optional cancellation token. The formatted document. Formats the whitespace in areas of a document corresponding to annotated nodes. The document to format. The annotation used to find on nodes to identify spans to format. An optional set of formatting options. If these options are not supplied the current set of options from the document's workspace will be used. An optional cancellation token. The formatted document. Formats the whitespace in areas of a syntax tree corresponding to annotated nodes. The root node of a syntax tree to format. The annotation used to find nodes to identify spans to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The formatted tree's root node. Formats the whitespace of a syntax tree. The root node of a syntax tree to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The formatted tree's root node. Formats the whitespace in areas of a syntax tree identified by a span. The root node of a syntax tree to format. The span within the node's full span to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The formatted tree's root node. Formats the whitespace in areas of a syntax tree identified by multiple non-overlapping spans. The root node of a syntax tree to format. The spans within the node's full span to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The formatted tree's root node. Determines the changes necessary to format the whitespace of a syntax tree. The root node of a syntax tree to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The changes necessary to format the tree. Determines the changes necessary to format the whitespace of a syntax tree. The root node of a syntax tree to format. The span within the node's full span to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The changes necessary to format the tree. Determines the changes necessary to format the whitespace of a syntax tree. The root node of a syntax tree to format. The spans within the node's full span to format. A workspace used to give the formatting context. An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. An optional cancellation token. The changes necessary to format the tree. Organizes the imports in the document. The document to organize. The cancellation token that the operation will observe. The document with organized imports. If the language does not support organizing imports, or if no changes were made, this method returns . This is the ID reported for formatting diagnostics. This spacial diagnostic can be suppressed via #pragma to prevent the formatter from making changes to code formatting within the span where the diagnostic is suppressed. Default value of 120 was picked based on the amount of code in a github.com diff at 1080p. That resolution is the most common value as per the last DevDiv survey as well as the latest Steam hardware survey. This also seems to a reasonable length default in that shorter lengths can often feel too cramped for .NET languages, which are often starting with a default indentation of at least 16 (for namespace, class, member, plus the final construct indentation). Contains changes that can be either applied to different targets such as a buffer or a tree or examined to be used in other places such as quick fix. Formats the whitespace in areas of a document corresponding to multiple non-overlapping spans. The document to format. The spans of the document's text to format. If null, the entire document should be formatted. An optional set of formatting options. If these options are not supplied the current set of options from the document's workspace will be used. An optional cancellation token. The formatted document. Provide a custom formatting operation provider that can intercept/filter/replace default formatting operations. All methods defined in this class can be called concurrently. Must be thread-safe. Returns SuppressWrappingIfOnSingleLineOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns AnchorIndentationOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns IndentBlockOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns AlignTokensOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns AdjustNewLinesOperation between two tokens either by itself or by filtering/replacing a operation returned by NextOperation returns AdjustSpacesOperation between two tokens either by itself or by filtering/replacing a operation returned by NextOperation Returns SuppressWrappingIfOnSingleLineOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns AnchorIndentationOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns IndentBlockOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns AlignTokensOperations under a node either by itself or by filtering/replacing operations returned by NextOperation returns AdjustNewLinesOperation between two tokens either by itself or by filtering/replacing a operation returned by NextOperation returns AdjustSpacesOperation between two tokens either by itself or by filtering/replacing a operation returned by NextOperation indicate how many lines are needed between two tokens Options for AdjustNewLinesOperation. PreserveLines means the operation will leave lineBreaks as it is if original lineBreaks are equal or greater than given lineBreaks ForceLines means the operation will force existing lineBreaks to the given lineBreaks. indicate how many spaces are needed between two spaces Options for AdjustSpacesOperation. Preserve spaces as it is DefaultSpacesIfOnSingleLine means a default space operation created by the formatting engine by itself. It has its own option kind to indicates that this is an operation generated by the engine itself. ForceSpaceIfOnSingleLine means forcing the specified spaces between two tokens if two tokens are on a single line. ForceSpaces means forcing the specified spaces regardless of positions of two tokens. If two tokens are on a single line, second token will be placed at current indentation if possible align first tokens on lines among the given tokens to the base token option to control AlignTokensOperation behavior preserve relative spaces between anchor token and first tokens on lines within the given text span as long as it doesn't have explicit line operations associated with them create anchor indentation region around start and end token start token will act as anchor token and right after anchor token to end of end token will become anchor region create anchor indentation region more explicitly by providing all necessary information. create suppress region around start and end token create suppress region around the given text span create indent block region around the start and end token with the given indentation delta added to the existing indentation at the position of the start token create indent block region around the given text span with the given indentation delta added to the existing indentation at the position of the start token create indent block region around the start and end token with the given indentation delta added to the column of the base token create indent block region around the given text span with the given indentation delta added to the column of the base token instruct the engine to try to align first tokens on the lines among the given tokens to be aligned to the base token instruct the engine to try to put the give lines between two tokens instruct the engine to try to put the given spaces between two tokens return SuppressOperation for the node provided by the given formatting rules return AnchorIndentationOperation for the node provided by the given formatting rules return IndentBlockOperation for the node provided by the given formatting rules return AlignTokensOperation for the node provided by the given formatting rules return AdjustNewLinesOperation for the node provided by the given formatting rules return AdjustSpacesOperation for the node provided by the given formatting rules set indentation level for the given text span. it can be relative, absolute or dependent to other tokens Options for IndentBlockOperation This indentation will be a delta to the first token in the line in which the base token is present IndentationDeltaOrPosition will be interpreted as delta of its enclosing indentation IndentationDeltaOrPosition will be interpreted as absolute position Mask for relative position options Mask for position options suppress formatting operations within the given text span Options for SuppressOperation NoWrappingIfOnSingleLine means no wrapping if given tokens are on same line NoWrapping means no wrapping regardless of relative positions of two tokens NoSpacing means no spacing regardless of relative positions of two tokens Completely disable formatting within a span. set up space string caches format the trivia at the line column and put changes to the changes create whitespace for the delta at the line column and put changes to the changes return whether this formatting succeeded or not for example, if there is skipped tokens in one of trivia between tokens we consider formatting this region is failed check whether given trivia is whitespace trivia or not check whether given trivia is end of line trivia or not check whether given string is either null or whitespace check whether given char is whitespace check whether given char is new line char create whitespace trivia create end of line trivia return line column rule for the given two trivia format the given trivia at the line column position and put result to the changes list format the given trivia at the line column position and put text change result to the changes list returns true if the trivia contains a Line break get line column rule between two trivia if the given trivia is the very first or the last trivia between two normal tokens and if the trivia is structured trivia, get one token that belongs to the structured trivia and one belongs to the normal token stream check whether string between start and end position only contains whitespace check whether first line between two tokens contains only whitespace return 0 or 1 based on line column of the trivia1's end point this is based on our structured trivia's implementation detail that some structured trivia can have one new line at the end of the trivia Returns if the language specific should be deferred to figure out indentation. If so, it will be asked to the resultant provided by this method. An indentation result represents where the indent should be placed. It conveys this through a pair of values. A position in the existing document where the indent should be relative, and the number of columns after that the indent should be placed at. This pairing provides flexibility to the implementor to compute the indentation results in a variety of ways. For example, one implementation may wish to express indentation of a newline as being four columns past the start of the first token on a previous line. Another may wish to simply express the indentation as an absolute amount from the start of the current line. With this tuple, both forms can be expressed, and the implementor does not have to convert from one to the other. The base position in the document that the indent should be relative to. This position can occur on any line (including the current line, or a previous line). The number of columns the indent should be at relative to the BasePosition's column. Determines the desired indentation of a given line. Returns the precedence of the given expression, mapped down to one of the values. The mapping is language specific. Returns the precedence of this expression in a scale specific to a particular language. These values cannot be compared across languages, but relates the precedence of expressions in the same language. A smaller value means lower precedence. Retrieves all symbols that could collide with a symbol at the specified location. A symbol can possibly collide with the location if it is available to that location and/or could cause a compiler error if its name is re-used at that location. True if this language supports implementing an interface by signature only. If false, implementations must specific explicitly which symbol they're implementing. True if anonymous functions in this language have signatures that include named parameters that can be referenced later on when the function is invoked. Or, if the anonymous function is simply a signature that will be assigned to a delegate, and the delegate's parameter names are used when invoking. For example, in VB one can do this: dim v = Sub(x as Integer) Blah() v(x:=4) However, in C# that would need to be: Action<int> v = (int x) => Blah(); v(obj:=4) Note that in VB one can access 'x' outside of the declaration of the anonymous type. While in C# 'x' can only be accessed within the anonymous type. True if a write is performed to the given expression. Note: reads may also be performed to the expression as well. For example, "++a". In this expression 'a' is both read from and written to. True if a write is performed to the given expression. Note: unlike IsWrittenTo, this will not return true if reads are performed on the expression as well. For example, "++a" will return 'false'. However, 'a' in "out a" or "a = 1" will return true. return speculative semantic model for supported node. otherwise, it will return null get all alias names defined in the semantic model Given a symbol in source, returns the syntax nodes that compromise its declarations. This differs from symbol.Locations in that Locations returns a list of ILocations that normally correspond to the name node of the symbol. Determines if there is preprocessor trivia *between* any of the provided. The will be deduped and then ordered by position. Specifically, the first token will not have it's leading trivia checked, and the last token will not have it's trailing trivia checked. All other trivia will be checked to see if it contains a preprocessor directive. Tries to get an ancestor of a Token on current position or of Token directly to left: e.g.: tokenWithWantedAncestor[||]tokenWithoutWantedAncestor Returns 'true' if this a 'reserved' keyword for the language. A 'reserved' keyword is a identifier that is always treated as being a special keyword, regardless of where it is found in the token stream. Examples of this are tokens like and in C# and VB respectively. Importantly, this does *not* include contextual keywords. If contextual keywords are important for your scenario, use or . Also, consider using if all you need is the ability to know if this is effectively any identifier in the language, regardless of whether the language is treating it as a keyword or not. Returns if this a 'contextual' keyword for the language. A 'contextual' keyword is a identifier that is only treated as being a special keyword in certain *syntactic* contexts. Examples of this is 'yield' in C#. This is only a keyword if used as 'yield return' or 'yield break'. Importantly, identifiers like , and are *not* 'contextual' keywords. This is because they are not treated as keywords depending on the syntactic context around them. Instead, the language always treats them identifiers that have special *semantic* meaning if they end up not binding to an existing symbol. Importantly, if is not in the syntactic construct where the language thinks an identifier should be contextually treated as a keyword, then this will return . Or, in other words, the parser must be able to identify these cases in order to be a contextual keyword. If identification happens afterwards, it's not contextual. The set of identifiers that have special meaning directly after the `#` token in a preprocessor directive. For example `if` or `pragma`. Returns the expression node the member is being accessed off of. If is , this will be the node directly to the left of the dot-token. If is , then this can return another node in the tree that the member will be accessed off of. For example, in VB, if you have a member-access-expression of the form ".Length" then this may return the expression in the surrounding With-statement. True if this is an argument with just an expression and nothing else (i.e. no ref/out, no named params, no omitted args). Returns true for nodes that represent the body of a method. For VB this will be MethodBlockBaseSyntax. This will be true for things like constructor, method, operator bodies as well as accessor bodies. It will not be true for things like sub() function() lambdas. For C# this will be the BlockSyntax or ArrowExpressionSyntax for a method/constructor/deconstructor/operator/accessor. It will not be included for local functions. Returns true if the given character is a character which may be included in an identifier to specify the type of a variable. A block that has no semantics other than introducing a new scope. That is only C# BlockSyntax. A node that contains a list of statements. In C#, this is BlockSyntax and SwitchSectionSyntax. In VB, this includes all block statements such as a MultiLineIfBlockSyntax. A node that can host a list of statements or a single statement. In addition to every "executable block", this also includes C# embedded statement owners. Given a , return the representing the span of the member body it is contained within. This is used to determine whether speculative binding should be used in performance-critical typing scenarios. Note: if this method fails to find a relevant span, it returns an empty at position 0. Returns the parent node that binds to the symbols that the IDE prefers for features like Quick Info and Find All References. For example, if the token is part of the type of an object creation, the parenting object creation expression is returned so that binding will return constructor symbols. Given a , that represents and argument return the string representation of that arguments name. Provides a uniform view of SyntaxKinds over C# and VB for constructs they have in common. A short-circuiting logical 'and'. In C#, 'LogicalAndExpression'. In VB, 'AndAlsoExpression'. A short-circuiting logical 'or'. In C#, 'LogicalOrExpression'. In VB, 'OrElseExpression'. Helper service for telling you what type can be inferred to be viable in a particular location in code. This is useful for features that are starting from code that doesn't bind, but would like to know type that code should be in the location that it can be found in. For example: int i = Here(); If 'Here()' doesn't bind, then this class can be used to say that it is currently in a location whose type has been inferred to be 'int' from the surrounding context. Note: this is simply a best effort guess. 'byte/short/etc.' as well as any user convertible types to int would also be valid here, however 'int' seems the most reasonable when considering user intuition. helper class to aggregate some numeric value log in client side maximum value minimum value middle value of the total data set average value of the total data set most frequent value in the total data set difference between max and min value number of data points in the total data set a logger that aggregate multiple loggers no op log block a logger that doesn't do anything A logger that publishes events to ETW using an EventSource. Enum to uniquely identify each function location. Defines a log aggregator to create a histogram logger interface actual logger should implements answer whether it is enabled or not for the specific function id log a specific event with context message log a start event with context message log an end event An interaction class defines how much time is expected to reach a time point, the response time point being the most commonly used. The interaction classes correspond to human perception, so, for example, all interactions in the Fast class are perceived as fast and roughly feel like they have the same performance. By defining these interaction classes, we can describe performance using adjectives that have a precise, consistent meaning. LogMessage that creates key value map lazily Type of log it is making. Log some traces of an activity (default) Log an user explicit action provide a way to log activities to various back end such as etl, code marker and etc next unique block id that will be given to each LogBlock give a way to explicitly set/replace the logger ensure we have a logger by putting one from workspace service if one is not there already. log a specific event with a simple context message which should be very cheap to create log a specific event with a context message that will only be created when it is needed. the messageGetter should be cheap to create. in another word, it shouldn't capture any locals log a specific event with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a specific event with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a specific event with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a specific event with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a specific event with a context message. return next unique pair id simplest way to log a start and end pair simplest way to log a start and end pair with a simple context message which should be very cheap to create log a start and end pair with a context message that will only be created when it is needed. the messageGetter should be cheap to create. in another word, it shouldn't capture any locals log a start and end pair with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a start and end pair with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a start and end pair with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a start and end pair with a context message that requires some arguments to be created when requested. given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals log a start and end pair with a context message. This tracks the logged message. On instantiation, it logs 'Started block' with other event data. On dispose, it logs 'Ended block' with the same event data so we can track which block started and ended when looking at logs. log message that can generate string lazily Logger will call this to return LogMessage to its pool This EventSource exposes our events to ETW. RoslynEventSource GUID is {bf965e67-c7fb-5c5b-d98f-cdf68f8154c2}. When updating this class, use the following to also update Main\Source\Test\Performance\Log\RoslynEventSourceParser.cs: Main\Tools\Source\TraceParserGen\bin\Debug\TraceParserGen.exe Microsoft.CodeAnalysis.Workspaces.dll -eventsource:RoslynEventSource Use this command to register the ETW manifest on any machine where you need to decode events in xperf/etlstackbrowse: "\\clrmain\tools\managed\etw\eventRegister\bin\Debug\eventRegister.exe" Microsoft.CodeAnalysis.Workspaces.dll Logs an informational block with given 's representation as the message and specified . On dispose of the returned disposable object, it logs the 'tick' count between the start and end of the block. Unlike other logging methods on , this method does not check if the specified was explicitly enabled. Instead it checks if the was enabled at level. Logs an informational message block with the given > and specified . On dispose of the returned disposable object, it logs the 'tick' count between the start and end of the block. Unlike other logging methods on , this method does not check if the specified was explicitly enabled. Instead it checks if the was enabled at level. This tracks the logged message. On instantiation, it logs 'Started block' with other event data. On dispose, it logs 'Ended block' with the same event data so we can track which block started and ended when looking at logs. next unique block id that will be given to each LogBlock return next unique pair id Implementation of that produce timing debug output. raised when global operation is started raised when global operation is stopped start new global operation An that comes from . It behaves just like a normal but remembers which language the is, so you don't have to pass that information redundantly when calling . Creates a new that contains the changed value. Specifies that an option should be read from an .editorconfig file. Gets the editorconfig string representation for this storage location. Gets the editorconfig string representation for this storage location. Returned from a Attempts to fetch the value for the given option. The value returned. May be null even if the function returns true as "null" may be valid value for some options. True if this provider had a specific value for this option. False to indicate other providers should be queried. Implemented to provide options that apply to specific documents, like from .editorconfig files. This is passed to to activate it for a workspace. This instance then lives around for the lifetime of the workspace. Fetches a for the given document. Any asynchronous work (looking for config files, etc.) should be done here. Can return a null-valued task to mean there is no options being provided for this document. A MEF-exported factory which produces s for s. Provides services for reading and writing options. This will provide support for options at the global level (i.e. shared among all workspaces/services). In general you should not import this type directly, and should instead get an from Gets the current value of the specific option. Gets the current value of the specific option. Gets the current value of the specific option. Applies a set of options, invoking serializers if needed. Returns the set of all registered options. Refreshes the stored value of a serialized option. This should only be called from serializers. Exportable by a host to specify the save and restore behavior for a particular set of values. Provides services for reading and writing options. This will provide support for customizations workspaces need to perform around options. Note that options will normally still be offered through implementations of this. However, implementations may customize things differently depending on their needs. Gets the current value of the specific option. Gets the current value of the specific option. Gets the current value of the specific option. Fetches an immutable set of all current options. Applies a set of options. Returns the set of all registered options. Registers a provider that can modify the result of . Providers registered earlier are queried first for options, and the first provider to give a value wins. Returns the that applies to a specific document, given that document and the global options. Group/sub-feature associated with an . Group/sub-feature for this option. Interface used for exposing functionality from the option service that we don't want to ever be public. Specifies that the option should be stored into the user's local registry hive. Group/sub-feature associated with an . A localizable resource description string for the option group. Relative priority of the option group with respect to other option groups within the same feature. Wraps an underlying and exposes its data to workspace clients. Also takes the notifications and forwards them along using the same used by the this is connected to. i.e. instead of synchronously just passing along the underlying events, these will be enqueued onto the workspace's eventing queue. Gate guarding and . Gets the value of the option. Gets the value of the option. Gets the value of the option. Creates a new that contains the changed value. Creates a new that contains the changed value. Creates a new that contains the changed value. The base type of all types that specify where options are stored. Marker interface for An global option. An instance of this class can be used to access an option value from an OptionSet. Feature this option is associated with. Optional group/sub-feature for this option. The name of the option. The default value of the option. The type of the option value. Marker interface for An option that can be specified once per language. Feature this option is associated with. Optional group/sub-feature for this option. The name of the option. The type of the option value. The default option value. The name of the providers for .editorconfig. Both the current and legacy providers will use this name, so that way any other clients can order relative to the pair. The two factories are unordered themselves because only one ever actually gives a real provider. Specifies that the option should be stored into a roamed profile across machines. Creates a that has different key names for different languages. A function that maps from a value to the key name. An implementation of that fetches values it doesn't know about to the workspace's option service. It ensures a contract that values are immutable from this instance once observed. Gets a list of all the options that were accessed. The pattern matcher is thread-safe. However, it maintains an internal cache of information as it is used. Therefore, you should not keep it around forever and should get and release the matcher appropriately once you no longer need it. Also, while the pattern matcher is culture aware, it uses the culture specified in the constructor. Encapsulated matches responsible for matching an all lowercase pattern against a candidate using CamelCase matching. i.e. this code is responsible for finding the match between "cofipro" and "CodeFixProvider". Returns null if no match was found, 1 if a contiguous match was found, 2 if a match as found that starts at the beginning of the candidate, and 3 if a contiguous match was found that starts at the beginning of the candidate. Updates the currently stored 'best result' if the current result is better. Returns 'true' if no further work is required and we can break early, or 'false' if we need to keep on going. If 'weight' is better than 'bestWeight' and matchSpanToAdd is not null, then matchSpanToAdd will be added to matchedSpansInReverse. Construct a new PatternMatcher using the specified culture. The culture to use for string searching and comparison. Whether or not the matching parts of the candidate should be supplied in results. Whether or not close matches should count as matches. Internal helper for MatchPatternInternal PERF: Designed to minimize allocations in common cases. If there's no match, then null is returned. If there's a single match, or the caller only wants the first match, then it is returned (as a Nullable) If there are multiple matches, and the caller wants them all, then a List is allocated. The word being tested. The segment of the pattern to check against the candidate. The result array to place the matches in. If a fuzzy match should be performed If there's only one match, then the return value is that match. Otherwise it is null. Do the two 'parts' match? i.e. Does the candidate part start with the pattern part? The candidate text The span within the text The pattern text The span within the text Options for doing the comparison (case sensitive or not) True if the span identified by within starts with the span identified by within . Does the given part start with the given pattern? The candidate text The span within the text The pattern text Options for doing the comparison (case sensitive or not) True if the span identified by within starts with First we break up the pattern given by dots. Each portion of the pattern between the dots is a 'Segment'. The 'Segment' contains information about the entire section of text between the dots, as well as information about any individual 'Words' that we can break the segment into. Information about a chunk of text from the pattern. The chunk is a piece of text, with cached information about the character spans within in. Character spans separate out capitalized runs and lowercase runs. i.e. if you have AAbb, then there will be two character spans, one for AA and one for BB. Character spans separate out capitalized runs and lowercase runs. i.e. if you have AAbb, then there will be two character spans, one for AA and one for BB. Determines if a given candidate string matches under a multiple word query text, as you would find in features like Navigate To. If this was a match, a set of match types that occurred while matching the patterns. If it was not a match, it returns null. True if this was a case sensitive match. The type of match that occurred. The spans in the original text that were matched. Only returned if the pattern matcher is asked to collect these spans. Note(cyrusn): this enum is ordered from strongest match type to weakest match type. The candidate string matched the pattern exactly. The pattern was a prefix of the candidate string. The pattern was a substring of the candidate string, but in a way that wasn't a CamelCase match. All camel-humps in the pattern matched a camel-hump in the candidate. All camel-humps in the candidate were matched by a camel-hump in the pattern. Example: "CFPS" matching "CodeFixProviderService" Example: "cfps" matching "CodeFixProviderService" Example: "CoFiPrSe" matching "CodeFixProviderService" All camel-humps in the pattern matched a camel-hump in the candidate. The first camel-hump in the pattern matched the first camel-hump in the candidate. There was no gap in the camel- humps in the candidate that were matched. Example: "CFP" matching "CodeFixProviderService" Example: "cfp" matching "CodeFixProviderService" Example: "CoFiPRo" matching "CodeFixProviderService" All camel-humps in the pattern matched a camel-hump in the candidate. The first camel-hump in the pattern matched the first camel-hump in the candidate. There was at least one gap in the camel-humps in the candidate that were matched. Example: "CP" matching "CodeFixProviderService" Example: "cp" matching "CodeFixProviderService" Example: "CoProv" matching "CodeFixProviderService" All camel-humps in the pattern matched a camel-hump in the candidate. The first camel-hump in the pattern did not match the first camel-hump in the pattern. There was no gap in the camel- humps in the candidate that were matched. Example: "FP" matching "CodeFixProviderService" Example: "fp" matching "CodeFixProviderService" Example: "FixPro" matching "CodeFixProviderService" All camel-humps in the pattern matched a camel-hump in the candidate. The first camel-hump in the pattern did not match the first camel-hump in the pattern. There was at least one gap in the camel-humps in the candidate that were matched. Example: "FS" matching "CodeFixProviderService" Example: "fs" matching "CodeFixProviderService" Example: "FixSer" matching "CodeFixProviderService" The pattern matches the candidate in a fuzzy manner. Fuzzy matching allows for a certain amount of misspellings, missing words, etc. See for more details. Tries to get a type of its' lambda parameter of argument for each candidate symbol. symbols corresponding to or Here, some_args can be multi-variables lambdas as well, e.g. f((a,b) => a+b, (a,b,c)=>a*b*c.Length) ordinal of the arguments of function: (a,b) or (a,b,c) in the example above ordinal of the lambda parameters, e.g. a, b or c. If container is a tuple type, any of its tuple element which has a friendly name will cause the suppression of the corresponding default name (ItemN). In that case, Rest is also removed. Obsolete. Use . Default implementation of IRemoteHostClientService Create new . will use this to create new Returns a that a user can use to communicate with a remote host (i.e. ServiceHub) Request new remote host. this is designed to be not disruptive to existing callers and to support scenarios where features required to reload user extension dlls without re-launching VS. if someone requests new remote host, all new callers for will receive a new remote host client that connects to a new remote host. existing remoteHostClient will still remain connected to old host and that old host will eventually go away once all existing clients are done with their requests. callers can subscribe to event to see whether client is going away if caller is designed to hold onto a service for a while to react to remote host change. Get to current RemoteHost This is only for debugging this lets remote side to set same logging options as VS side JsonRPC seems to have a problem with empty parameter lists. So passing a dummy parameter just to make it work properly. Synchronize data to OOP proactively without anyone asking for it to make most of operation faster This represents client in client/servier model. user can create a connection to communicate with the server (remote host) through this client Return an unique string per client. one can use this to distinguish different clients that are connected to different RemoteHosts including cases where 2 external process finding each others Create for the if possible. otherwise, return null. Creating session could fail if remote host is not available. one of example will be user killing remote host. NoOpClient is used if a user killed our remote host process. Basically this client never create a session This is a connection between client and server. user can use this to communicate with remote host. This doesn't know anything specific to Roslyn. this is general pure connection between client and server. Create for the if possible. otherwise, return null. Creating connection could fail if remote host is not available. one of example will be user killing remote host. Create for the if possible. otherwise, return null. Creating session could fail if remote host is not available. one of example will be user killing remote host. Create for the if possible. otherwise, return null. Creating session could fail if remote host is not available. one of example will be user killing remote host. Create for the if possible. otherwise, return null. Creating session could fail if remote host is not available. one of example will be user killing remote host. Create for the if possible. otherwise, return null. Creating session could fail if remote host is not available. one of example will be user killing remote host. Run given service on remote host. if it fails to run on remote host, it will return default(T) Run given service on remote host. if it fails to run on remote host, it will return default(T) Run given service on remote host. if it fails to run on remote host, it will return default(T) Synchronize given solution as primary workspace solution in remote host Run given service on remote host. if it fails to run on remote host, it will return default(T) Run given service on remote host. if it fails to run on remote host, it will return default(T) This will tie and 's lifetime together so that one can handle those more easily This will let one to hold onto for a while. this helper will let you not care about remote host being gone while you hold onto the connection if that ever happen when this is used, solution must be explicitly passed around between client (VS) and remote host (OOP) This annotation will be used by rename to mark all places where it needs to rename an identifier (token replacement) and where to check if the semantics have been changes (conflict detection). This annotation should be put on tokens only. The span this token occupied in the original syntax tree. Can be used to show e.g. conflicts in the UI. A flag indicating whether this is a location that needs to be renamed or just tracked for conflicts. A flag indicating whether the token at this location has the same ValueText then the original name of the symbol that gets renamed. When replacing the annotated token this string will be prepended to the token's value. This is used when renaming compiler generated fields and methods backing properties (e.g. "get_X" or "_X" for property "X"). When replacing the annotated token this string will be appended to the token's value. This is used when renaming compiler generated types whose names are derived from user given names (e.g. "XEventHandler" for event "X"). A single dimensional array of annotations to verify after rename. States if this token is a Namespace Declaration Reference States if this token is a member group reference, typically found in NameOf expressions States if this token is annotated as a part of the Invocation Expression that needs to be checked for the Conflicts This class is used to refer to a Symbol definition which could be in source or metadata it has a metadata name. The metadata name for this symbol. Count of symbol location (Partial Types, Constructors, etc). A flag indicating that the associated symbol is an override of a symbol from metadata The core data structure of the tracker. This is a dictionary of variable name to the current identifier tokens that are declaring variables. This should only ever be updated via the AddIdentifier and RemoveIdentifier helpers. The result of the conflict engine. Once this object is returned from the engine, it is immutable. The list of all symbol locations that are referenced either by the original symbol or the renamed symbol. This includes both resolved and unresolved conflicts. The list of all document ids of documents that have been touched for this rename operation. The new workspace snapshot The base workspace snapshot Whether the text that was resolved with was even valid. This may be false if the identifier was not valid in some language that was involved in the rename. The original text that is the rename replacement. Performs the renaming of the symbol in the solution, identifies renaming conflicts and automatically resolves them where possible. The locations to perform the renaming at. The original name of the identifier. The new name of the identifier The option for rename Called after renaming references. Can be used by callers to indicate if the new symbols that the reference binds to should be considered to be ok or are in conflict. 'true' means they are conflicts. 'false' means they are not conflicts. 'null' means that the default conflict check should be used. The cancellation token. A conflict resolution containing the new solution. Used to find the symbols associated with the Invocation Expression surrounding the Token Computes an adds conflicts relating to declarations, which are independent of location-based checks. Examples of these types of conflicts include renaming a member to the same name as another member of a type: binding doesn't change (at least from the perspective of find all references), but we still need to track it. Gives the First Location for a given Symbol by ordering the locations using DocumentId first and Location starting position second Helper class to track the state necessary for finding/resolving conflicts in a rename session. Find conflicts in the new solution Gets the list of the nodes that were annotated for a conflict check The method determines the set of documents that need to be processed for Rename and also determines the possible set of names that need to be checked for conflicts. We try to rewrite all locations that are invalid candidate locations. If there is only one location it must be the correct one (the symbol is ambiguous to something else) and we always try to rewrite it. If there are multiple locations, we only allow it if the candidate reason allows for it). Gives information about an identifier span that was affected by Rename (Reference or Non reference) There was no conflict. A conflict was resolved at a location that references the symbol being renamed. A conflict was resolved in a piece of code that does not reference the symbol being renamed. There was a conflict that could not be resolved. These are the conflicts that cannot be resolved. E.g.: Declaration Conflict Tracks the text spans that were modified as part of a rename operation Information to track deltas of complexified spans Consider the following example where renaming a->b causes a conflict and Goo is an extension method: "a.Goo(a)" is rewritten to "NS1.NS2.Goo(NS3.a, NS3.a)" The OriginalSpan is the span of "a.Goo(a)" The NewSpan is the span of "NS1.NS2.Goo(NS3.a, NS3.a)" The ModifiedSubSpans are the pairs of complexified symbols sorted according to their order in the original source code span: "a", "NS3.a" "Goo", "NS1.NS2.Goo" "a", "NS3.a" This method annotates the given syntax tree with all the locations that need to be checked for conflict after the rename operation. It also renames all the reference locations and expands any conflict locations. The options describing this rename operation The root of the annotated tree. Based on the kind of the symbol and the new name, this function determines possible conflicting names that should be tracked for semantic changes during rename. The symbol that gets renamed. The new name for the symbol. List where possible conflicting names will be added to. Identifies the conflicts caused by the new declaration created during rename. The replacementText as given from the user. The new symbol (after rename). The original symbol that got renamed. All referenced symbols that are part of this rename session. The original solution when rename started. The resulting solution after rename. A mapping from new to old locations. The cancellation token. All locations where conflicts were caused because the new declaration. Identifies the conflicts caused by implicitly referencing the renamed symbol. The original symbol that got renamed. The new symbol (after rename). All implicit reference locations. The cancellation token. A list of implicit conflicts. Identifies the conflicts caused by implicitly referencing the renamed symbol. The new symbol (after rename). The SemanticModel of the document in the new solution containing the renamedSymbol The location of the renamedSymbol in the old solution The starting position of the renamedSymbol in the new solution The cancellation token. A list of implicit conflicts. Identifies potential Conflicts into the inner scope locals. This may give false positives. The Token that may introduce errors else where The symbols that this token binds to after the rename has been applied Returns if there is a potential conflict Used to find if the replacement Identifier is valid Gets the top most enclosing statement as target to call MakeExplicit on. It's either the enclosing statement, or if this statement is inside of a lambda expression, the enclosing statement of this lambda. The token to get the complexification target for. mentions that the result is for the base symbol of the rename mentions that the result is for the overloaded symbols of the rename A helper class that contains some of the methods and filters that must be used when processing the raw results from the FindReferences API. Holds the Locations of a symbol that should be renamed, along with the symbol and Solution for the set. Given a symbol in a document, returns the "right" symbol that should be renamed in the case the name binds to things like aliases _and_ the underlying type at once. Given a symbol, finds the symbol that actually defines the name that we're using. Given a ISymbol, returns the renameable locations for a given symbol. Find the locations that need to be renamed. Set to true if the file name should match the type name after a rename operation Renaming a private symbol typically confines the set of references and potential conflicts to that symbols declaring project. However, rename may cascade to non-public symbols which may then require other projects be considered. a service that provides a semantic model that will re-use last known compilation if semantic version hasn't changed. Don't call this directly. use Document extension method GetSemanticModelForNodeAsync or GetSemanticModelForSpanAsync instead. see the descriptions on the extension methods An interval tree represents an ordered tree data structure to store intervals of the form [start, end). It allows you to efficiently find all intervals that intersect or overlap a provided interval. Warning. Mutates the tree in place. Gets project-level effective severity of the given accounting for severity configurations from both the following sources: 1. Compilation options from ruleset file, if any, and command line options such as /nowarn, /warnaserror, etc. 2. Analyzer config documents at the project root directory or in ancestor directories. Gets project-level effective severity of the given accounting for severity configurations from both the following sources: 1. Compilation options from ruleset file, if any, and command line options such as /nowarn, /warnaserror, etc. 2. Analyzer config documents at the project root directory or in ancestor directories. this will return either regular semantic model or speculative semantic based on context. any feature that is involved in typing or run on UI thread should use this to take advantage of speculative semantic model whenever possible automatically. when using this API, semantic model should only be used to ask node inside of the given span. otherwise, it might throw if semantic model returned by this API is a speculative semantic model. also, symbols from the semantic model returned by this API might have out of date location information. if exact location (not relative location) is needed from symbol, regular GetSemanticModel should be used. this will return either regular semantic model or speculative semantic based on context. any feature that is involved in typing or run on UI thread should use this to take advantage of speculative semantic model whenever possible automatically. when using this API, semantic model should only be used to ask node inside of the given node except ones that belong to member signature. otherwise, it might throw if semantic model returned by this API is a speculative semantic model. also, symbols from the semantic model returned by this API might have out of date location information. if exact location (not relative location) is needed from symbol, regular GetSemanticModel should be used. Returns the semantic model for this document that may be produced from partial semantics. The semantic model is only guaranteed to contain the syntax tree for and nothing else. Get mapped file path if exist, otherwise return null. Returns the methodSymbol and any partial parts. Returns true for void returning methods with two parameters, where the first parameter is of type and the second parameter inherits from or equals type. Gets the set of members in the inheritance chain of that are overridable. The members will be returned in furthest-base type to closest-base type order. i.e. the overridable members of will be at the start of the list, and the members of the direct parent type of will be at the end of the list. If a member has already been overridden (in or any base type) it will not be included in the list. Lazily returns all nested types contained (recursively) within this namespace or type. In case of a type, it is included itself as the first result. Searches the namespace for namespaces with the provided name. Revert all textual change made in unchangeable documents. A document is unchangeable if `Document.CanApplyChange()` returns false New solution with changes Old solution the new solution is based on A tuple indicates whether there's such disallowed change made in the , as well as the updated solution with all disallowed change reverted (which would be identical to if `containsDisallowedChange` is false). Returns true if this symbol contains anything unsafe within it. for example List<int*[]> is unsafe, as it "int* Goo { get; }" Returns true if symbol is a local variable and its declaring syntax node is after the current position, false otherwise (including for non-local symbols) Checks a given symbol for browsability based on its declaration location, attributes explicitly limiting browsability, and whether showing of advanced members is enabled. The optional attribute constructor parameters may be used to specify the symbols of the constructors of the various browsability limiting attributes because finding these repeatedly over a large list of symbols can be slow. If providing these constructor symbols, they should be in the format provided by EditorBrowsableHelpers.GetSpecial*AttributeConstructor(). If these are not provided, they will be found in the compilation. If the is a method symbol, returns if the method's return type is "awaitable", but not if it's . If the is a type symbol, returns if that type is "awaitable". An "awaitable" is any type that exposes a GetAwaiter method which returns a valid "awaiter". This GetAwaiter method may be an instance method or an extension method. First, remove symbols from the set if they are overridden by other symbols in the set. If a symbol is overridden only by symbols outside of the set, then it is not removed. This is useful for filtering out symbols that cannot be accessed in a given context due to the existence of overriding members. Second, remove remaining symbols that are unsupported (e.g. pointer types in VB) or not editor browsable based on the EditorBrowsable attribute. Checks if 'symbol' is accessible from within 'within'. Checks if 'symbol' is accessible from within assembly 'within'. Checks if 'symbol' is accessible from within name type 'within', with an optional qualifier of type "throughTypeOpt". Checks if 'symbol' is accessible from within assembly 'within', with an qualifier of type "throughTypeOpt". Sets "failedThroughTypeCheck" to true if it failed the "through type" check. Checks if 'symbol' is accessible from within 'within', which must be a INamedTypeSymbol or an IAssemblySymbol. If 'symbol' is accessed off of an expression then 'throughTypeOpt' is the type of that expression. This is needed to properly do protected access checks. Sets "failedThroughTypeCheck" to true if this protected check failed. 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). Gets semantic information, such as type, symbols, and diagnostics, about the parent of a token. The SemanticModel object to get semantic information from. The token to get semantic information from. This must be part of the syntax tree associated with the binding. A cancellation token. Fetches the ITypeSymbol that should be used if we were generating a parameter or local that would accept . If expression is a type, that's returned; otherwise this will see if it's something like a method group and then choose an appropriate delegate. check whether the given span is intersects with the tree Returns the leading whitespace of the line located at the specified position in the given snapshot. Same as OverlapsHiddenPosition but doesn't throw on cancellation. Instead, returns false in that case. Standard format for displaying to the user. No return type. Contains enough information to determine whether two symbols have the same signature. Performs several edits to a document. If multiple edits are made within the same expression context, then the document/semantic-model will be forked after each edit so that further edits can see if they're still safe to apply. Performs several edits to a document. If multiple edits are made within the same expression context, then the document/semantic-model will be forked after each edit so that further edits can see if they're still safe to apply. Performs several edits to a document. If multiple edits are made within the same expression context, then the document/semantic-model will be forked after each edit so that further edits can see if they're still safe to apply. Performs several edits to a document. If multiple edits are made within a method body then the document/semantic-model will be forked after each edit so that further edits can see if they're still safe to apply. Performs several edits to a document. If multiple edits are made within a method body then the document/semantic-model will be forked after each edit so that further edits can see if they're still safe to apply. Helper function for fix-all fixes where individual fixes may affect the viability of another. For example, consider the following code: if ((double)x == (double)y) In this code either cast can be removed, but at least one cast must remain. Even though an analyzer marks both, a fixer must not remove both. One way to accomplish this would be to have the fixer do a semantic check after each application. However This is extremely expensive, especially for hte common cases where one fix does not affect each other. To address that, this helper groups fixes at certain boundary points. i.e. at statement boundaries. If there is only one fix within the boundary, it does not do any semantic verification. However, if there are multiple fixes in a boundary it will call into to validate if the subsequent fix can be made or not. Generates an override of similar to the one generated for anonymous types. Returns true if the binaryExpression consists of an expression that can never be negative, such as length or unsigned numeric types, being compared to zero with greater than, less than, or equals relational operator. Returns true if is a given token is a child token of a certain type of parent node. The type of the parent node. The node that we are testing. A function that, when given the parent node, returns the child token we are interested in. Returns true if this node is found underneath the specified child in the given parent. create a new root node from the given root after adding annotations to the tokens tokens should belong to the given root create a new root node from the given root after adding annotations to the nodes nodes should belong to the given root Creates a new tree of nodes from the existing tree with the specified old nodes replaced with a newly computed nodes. The root of the tree that contains all the specified nodes. The nodes from the tree to be replaced. A function that computes a replacement node for the argument nodes. The first argument is one of the original specified nodes. The second argument is the same node possibly rewritten with replaced descendants. Creates a new tree of tokens from the existing tree with the specified old tokens replaced with a newly computed tokens. The root of the tree that contains all the specified tokens. The tokens from the tree to be replaced. A function that computes a replacement token for the argument tokens. The first argument is one of the originally specified tokens. The second argument is the same token possibly rewritten with replaced trivia. Look inside a trivia list for a skipped token that contains the given position. Look inside a trivia list for a skipped token that contains the given position. Look inside a trivia list for a skipped token that contains the given position. Look inside a trivia list for a skipped token that contains the given position. If the position is inside of token, return that token; otherwise, return the token to the right. If the position is inside of token, return that token; otherwise, return the token to the left. Returns the identifier, keyword, contextual keyword or preprocessor keyword touching this position, or a token of Kind = None if the caret is not touching either. If the position is inside of token, return that token; otherwise, return the token to the right. If the position is inside of token, return that token; otherwise, return the token to the left. Creates a new instance of this text document updated to have the text specified. Creates a new instance of this additional document updated to have the text specified. Creates a new instance of this analyzer config document updated to have the text specified. Returns the first non-whitespace position on the given line, or null if the line is empty or contains only whitespace. Returns the first non-whitespace position on the given line as an offset from the start of the line, or null if the line is empty or contains only whitespace. Determines whether the specified line is empty or contains whitespace only. merge provided spans to each distinct group of spans in ascending order Returns true if the span encompasses the specified node or token and is contained within its trivia. Returns true if the span encompasses a span between the specified nodes or tokens and is contained within trivia around them. Initializes a new instance of that is empty. Initializes a new instance of that contains the specified span. TextSpan contained by the span set. Initializes a new instance of that contains the specified list of spans. The spans to be added. The list of spans will be sorted and normalized (overlapping and adjoining spans will be combined). This constructor runs in O(N log N) time, where N = spans.Count. is null. Finds the union of two span sets. The first span set. The second span set. The new span set that corresponds to the union of and . This operator runs in O(N+M) time where N = left.Count, M = right.Count. Either or is null. Finds the overlap of two span sets. The first span set. The second span set. The new span set that corresponds to the overlap of and . This operator runs in O(N+M) time where N = left.Count, M = right.Count. or is null. Finds the intersection of two span sets. The first span set. The second span set. The new span set that corresponds to the intersection of and . This operator runs in O(N+M) time where N = left.Count, M = right.Count. is null. is null. Finds the difference between two sets. The difference is defined as everything in the first span set that is not in the second span set. The first span set. The second span set. The new span set that corresponds to the difference between and . Empty spans in the second set do not affect the first set at all. This method returns empty spans in the first set that are not contained by any set in the second set. is null. is null. Determines whether two span sets are the same. The first set. The second set. true if the two sets are equivalent, otherwise false. Determines whether two span sets are not the same. The first set. The second set. true if the two sets are not equivalent, otherwise false. Determines whether this span set overlaps with another span set. The span set to test. true if the span sets overlap, otherwise false. is null. Determines whether this span set overlaps with another span. The span to test. true if this span set overlaps with the given span, otherwise false. Determines whether this span set intersects with another span set. Set to test. true if the span sets intersect, otherwise false. is null. Determines whether this span set intersects with another span. true if this span set intersects with the given span, otherwise false. Gets a unique hash code for the span set. A 32-bit hash code associated with the set. Determines whether this span set is the same as another object. The object to test. true if the two objects are equal, otherwise false. Provides a string representation of the set. The string representation of the set. Private constructor for use when the span list is already normalized. An already normalized span list. Options that aren't persisted. options here will be reset to default on new process. Stores the source information for an value. Helpful when tracking down tokens which aren't properly disposed. Return for the given featureName We have this abstraction so that we can have isolated listener/waiter in unit tests Get for given feature. same provider will return a singleton listener for same feature use in product code to get and use in test to get waiter. indicate whether asynchronous listener is enabled or not. it is tri-state since we want to retrieve this value, if never explicitly set, from environment variable and then cache it. we read value from environment variable (RoslynWaiterEnabled) because we want team, that doesn't have access to Roslyn code (InternalVisibleTo), can use this listener/waiter framework as well. those team can enable this without using API indicate whether is enabled or not it is tri-state since we want to retrieve this value, if never explicitly set, from environment variable and then cache it. we read value from environment variable (RoslynWaiterDiagnosticTokenEnabled) because we want team, that doesn't have access to Roslyn code (InternalVisibleTo), can use this listener/waiter framework as well. those team can enable this without using API Provides a default value for . Enable or disable TrackActiveTokens for test Get Waiters for listeners for test Wait for all of the instances to finish their work. This is a very handy method for debugging hangs in the unit test. Set a break point in the loop, dig into the waiters and see all of the active values representing the remaining work. Get all saved DiagnosticAsyncToken to investigate tests failure easier Returns a task which completes when all asynchronous operations currently tracked by this waiter are completed. Asynchronous operations are expedited when possible, meaning artificial delays placed before asynchronous operations are shortened. Creates a task that will complete after a time delay, but can be expedited if an operation is waiting for the task to complete. The time to wait before completing the returned task, or TimeSpan.FromMilliseconds(-1) to wait indefinitely. A cancellation token to observe while waiting for the task to complete. if the delay compeleted normally; otherwise, if the delay completed due to a request to expedite the delay. represents a negative time interval other than TimeSpan.FromMilliseconds(-1). -or- The argument's property is greater than . The delay has been canceled. Modification of the murmurhash2 algorithm. Code is simpler because it operates over strings instead of byte arrays. Because each string character is two bytes, it is known that the input will be an even number of bytes (though not necessarily a multiple of 4). This is needed over the normal 'string.GetHashCode()' because we need to be able to generate 'k' different well distributed hashes for any given string s. Also, we want to be able to generate these hashes without allocating any memory. My ideal solution would be to use an MD5 hash. However, there appears to be no way to do MD5 in .NET where you can: a) feed it individual values instead of a byte[] b) have the hash computed into a byte[] you provide instead of a newly allocated one Generating 'k' pieces of garbage on each insert and lookup seems very wasteful. So, instead, we use murmur hash since it provides well distributed values, allows for a seed, and allocates no memory. Murmur hash is public domain. Actual code is included below as reference. If the token1 is expected to be part of the leading trivia of the token2 then the trivia before the token1FullSpanEnd, which the fullspan end of the token1 should be ignored this will create a span that includes its trailing trivia of its previous token and leading trivia of its next token for example, for code such as "class A { int ...", if given tokens are "A" and "{", this will return span [] of "class[ A { ]int ..." which included trailing trivia of "class" which is previous token of "A", and leading trivia of "int" which is next token of "{" A documentation comment derived from either source text or metadata. True if an error occurred when parsing. The full XML text of this tag. The text in the <example> tag. Null if no tag existed. The text in the <summary> tag. Null if no tag existed. The text in the <returns> tag. Null if no tag existed. The text in the <remarks> tag. Null if no tag existed. The names of items in <param> tags. The names of items in <typeparam> tags. The types of items in <exception> tags. The item named in the <completionlist> tag's cref attribute. Null if the tag or cref attribute didn't exist. Used for method, to prevent new allocation of string Cache of the most recently parsed fragment and the resulting DocumentationComment Parses and constructs a from the given fragment of XML. The fragment of XML to parse. A DocumentationComment instance. Helper class for parsing XML doc comments. Encapsulates the state required during parsing. Parse and construct a from the given fragment of XML. The fragment of XML to parse. A DocumentationComment instance. Returns the text for a given parameter, or null if no documentation was given for the parameter. Returns the text for a given type parameter, or null if no documentation was given for the type parameter. Returns the texts for a given exception, or an empty if no documentation was given for the exception. An empty comment. Finds the constructor which takes exactly one argument, which must be of type EditorBrowsableState. It does not require that the EditorBrowsableAttribute and EditorBrowsableState types be those shipped by Microsoft, but it does demand the types found follow the expected pattern. If at any point that pattern appears to be violated, return null to indicate that an appropriate constructor could not be found. The TypeLib*Attribute classes that accept TypeLib*Flags with FHidden as an option all have two constructors, one accepting a TypeLib*Flags and the other a short. This methods gets those two constructor symbols for any of these attribute classes. It does not require that the either of these types be those shipped by Microsoft, but it does demand the types found follow the expected pattern. If at any point that pattern appears to be violated, return an empty enumerable to indicate that no appropriate constructors were found. Determines, using heuristics, what the next likely value is in this enum. Helper for checking whether cycles exist in the extension ordering. Throws if a cycle is detected. A cycle was detected in the extension ordering. Helper as VB's CType doesn't work without arithmetic overflow. Helper class to allow one to do simple regular expressions over a sequence of objects (as opposed to a sequence of characters). Matcher equivalent to (m*) Matcher equivalent to (m+) Matcher equivalent to (m_1|m_2|...|m_n) Matcher equivalent to (m_1 ... m_n) Matcher that matches an element if the provide predicate returns true. Ensures that any 'names' is unique and does not collide with any other name. Names that are marked as IsFixed can not be touched. This does mean that if there are two names that are the same, and both are fixed that you will end up with non-unique names at the end. Transforms baseName into a name that does not conflict with any name in 'reservedNames' Utility class that can be used to track the progress of an operation in a threadsafe manner. Utility class that can be used to track the progress of an operation in a threadsafe manner. Breaks an identifier string into constituent parts. Provides a way to test two symbols for equivalence. While there are ways to ask for different sorts of equivalence, the following must hold for two symbols to be considered equivalent. 1) The kinds of the two symbols must match. 2) The names of the two symbols must match. 3) The arity of the two symbols must match. 4) If the symbols are methods or parameterized properties, then the signatures of the two symbols must match. 5) Both symbols must be definitions or must be instantiations. If they are instantiations, then they must be instantiated in the same manner. 6) The containing symbols of the two symbols must be equivalent. Note: equivalence does not concern itself with whole symbols. Two types are considered equivalent if the above hold, even if one type has different members than the other. Note: type parameters, and signature parameters are not considered 'children' when comparing symbols. Options are provided to tweak the above slightly. For example, by default, symbols are equivalent only if they come from the same assembly or different assemblies of the same simple name. However, one can ask if two symbols are equivalent even if their assemblies differ. Compares given symbols and for equivalence. Compares given symbols and for equivalence and populates with equivalent non-nested named type key-value pairs that are contained in different assemblies. These equivalent named type key-value pairs represent possibly equivalent forwarded types, but this API doesn't perform any type forwarding equivalence checks. This API is only supported for . Worker for comparing two named types for equivalence. Note: The two types must have the same TypeKind. The first type to compare The second type to compare Map of equivalent non-nested types to be populated, such that each key-value pair of named types are equivalent but reside in different assemblies. This map is populated only if we are ignoring assemblies for symbol equivalence comparison, i.e. is true. True if the two types are equivalent. An XML parser that is designed to parse small fragments of XML such as those that appear in documentation comments. PERF: We try to re-use the same underlying to reduce the allocation costs of multiple parses. Parse the given XML fragment. The given callback is executed until either the end of the fragment is reached or an exception occurs. Type of an additional argument passed to the delegate. The fragment to parse. Action to execute while there is still more to read. Additional argument passed to the callback. It is important that the action advances the , otherwise parsing will never complete. A text reader over a synthesized XML stream consisting of a single root element followed by a potentially infinite stream of fragments. Each time "SetText" is called the stream is rewound to the element immediately following the synthetic root node. Current text to validate. Helper class to analyze the semantic effects of a speculated syntax node replacement on the parenting nodes. Given an expression node from a syntax tree and a new expression from a different syntax tree, it replaces the expression with the new expression to create a speculated syntax tree. It uses the original tree's semantic model to create a speculative semantic model and verifies that the syntax replacement doesn't break the semantics of any parenting nodes of the original expression. Creates a semantic analyzer for speculative syntax replacement. Original expression to be replaced. New expression to replace the original expression. Semantic model of node's syntax tree. Cancellation token. True if semantic analysis should be skipped for the replaced node and performed starting from parent of the original and replaced nodes. This could be the case when custom verifications are required to be done by the caller or semantics of the replaced expression are different from the original expression. True if semantic analysis should fail when any of the invocation expression ancestors of in original code has overload resolution failures. Original expression to be replaced. First ancestor of which is either a statement, attribute, constructor initializer, field initializer, default parameter initializer or type syntax node. It serves as the root node for all semantic analysis for this syntax replacement. Semantic model for the syntax tree corresponding to Node which replaces the . Note that this node is a cloned version of node, which has been re-parented under the node to be speculated, i.e. . Node created by replacing under node. This node is used as the argument to the GetSpeculativeSemanticModel API and serves as the root node for all semantic analysis of the speculated tree. Speculative semantic model used for analyzing the semantics of the new tree. Determines whether performing the given syntax replacement will change the semantics of any parenting expressions by performing a bottom up walk from the up to in the original tree and simultaneously walking bottom up from up to in the speculated syntax tree and performing appropriate semantic comparisons. Checks whether the semantic symbols for the and are non-null and compatible. Determine if removing the cast could cause the semantics of System.Object method call to change. E.g. Dim b = CStr(1).GetType() is necessary, but the GetType method symbol info resolves to the same with or without the cast. Determines if the symbol is a non-overridable, non static method on System.Object (e.g. GetType) This annotation will be used by the expansion/reduction to annotate expanded syntax nodes to store the information that an alias was used before expansion. When applied to a SyntaxNode, prevents the simplifier from converting a type to 'var'. Contains the options that needs to be drilled down to the Simplification Engine This option tells the simplification engine if the Qualified Name should be replaced by Alias if the user had initially not used the Alias This option influences the name reduction of members of a module in VB. If set to true, the name reducer will e.g. reduce Namespace.Module.Member to Namespace.Member. This option says that if we should simplify the Generic Name which has the type argument inferred This option says if we should simplify the Explicit Type in Local Declarations This option says if we should simplify to NonGeneric Name rather than GenericName This option says if we should simplify from Derived types to Base types in Static Member Accesses This option says if we should simplify away the or in member access expressions. This option says if we should simplify away the . or . in field access expressions. This option says if we should simplify away the . or . in property access expressions. This option says if we should simplify away the . or . in method access expressions. This option says if we should simplify away the . or . in event access expressions. This option says if we should prefer keyword for Intrinsic Predefined Types in Declarations This option says if we should prefer keyword for Intrinsic Predefined Types in Member Access Expression This option describes the naming rules that should be applied to specified categories of symbols, and the level to which those rules should be enforced. Expands and Reduces subtrees. Expansion: 1) Makes inferred names explicit (on anonymous types and tuples). 2) Replaces names with fully qualified dotted names. 3) Adds parentheses around expressions 4) Adds explicit casts/conversions where implicit conversions exist 5) Adds escaping to identifiers 6) Rewrites extension method invocations with explicit calls on the class containing the extension method. Reduction: 1) Shortens dotted names to their minimally qualified form 2) Removes unnecessary parentheses 3) Removes unnecessary casts/conversions 4) Removes unnecessary escaping 5) Rewrites explicit calls to extension methods to use dot notation 6) Removes unnecessary tuple element names and anonymous type member names The annotation the reducer uses to identify sub trees to be reduced. The Expand operations add this annotation to nodes so that the Reduce operations later find them. This is the annotation used by the simplifier and expander to identify Predefined type and preserving them from over simplification The annotation used to identify sub trees to look for symbol annotations on. It will then add import directives for these symbol annotations. Expand qualifying parts of the specified subtree, annotating the parts using the annotation. Expand qualifying parts of the specified subtree, annotating the parts using the annotation. Expand qualifying parts of the specified subtree, annotating the parts using the annotation. Expand qualifying parts of the specified subtree, annotating the parts using the annotation. Reduce all sub-trees annotated with found within the document. The annotated node and all child nodes will be reduced. Reduce the sub-trees annotated with found within the subtrees identified with the specified . The annotated node and all child nodes will be reduced. Reduce the sub-trees annotated with found within the specified span. The annotated node and all child nodes will be reduced. Reduce the sub-trees annotated with found within the specified spans. The annotated node and all child nodes will be reduced. An annotation that holds onto information about a type or namespace symbol. Resets all the document state cached by the analyzer. Register a solution crawler for a particular workspace null implementation of the service. it doesn't do anything since there is no way to observe its impact in this layer. Track approximate solution size. Get approximate solution size at the point of call. This API is not supposed to return 100% accurate size. if a feature require 100% accurate size, use Solution to calculate it. this API is supposed to lazy and very cheap on answering that question. A service that enables storing and retrieving of information associated with solutions, projects or documents across runtime sessions. This lock guards all mutable fields in this type. A trivial wrapper that we can hand out for instances from the that wraps the underlying singleton. Solution size threshold to start to use a DB (Default: 50MB) Simple wrapper struct for a that helps ensure that the statement is always after it is used. See https://sqlite.org/c3ref/stmt.html: The life-cycle of a prepared statement object usually goes like this: 1) Create the prepared statement object using sqlite3_prepare_v2(). 2) Bind values to parameters using the sqlite3_bind_* () interfaces. 3) Run the SQL by calling sqlite3_step() one or more times. 4) Reset the prepared statement using sqlite3_reset() then go back to step 2. Do this zero or more times. 5) Destroy the object using sqlite3_finalize(). This type helps ensure that '4' happens properly by clients executing statement. Note that destroying/finalizing a statement is not the responsibility of a client as it will happen to all prepared statemnets when the is d. Encapsulates a connection to a sqlite database. On construction an attempt will be made to open the DB if it exists, or create it if it does not. Connections are considered relatively heavyweight and are pooled until the is d. Connections can be used by different threads, but only as long as they are used by one thread at a time. They are not safe for concurrent use by several threads. s can be created through the user of . These statements are cached for the lifetime of the connection and are only finalized (i.e. destroyed) when the connection is closed. The raw handle to the underlying DB. For testing purposes to simulate failures during testing. Our cache of prepared statements for given sql strings. Whether or not we're in a transaction. We currently don't supported nested transactions. If we want that, we can achieve it through sqlite "save points". However, that's adds a lot of complexity that is nice to avoid. Represents a prepared sqlite statement. s can be ed (i.e. executed). Executing a statement can result in either if the command completed and produced no value, or if it evaluated out to a sql row that can then be queried. If a statement is parameterized then parameters can be provided by the BindXXX overloads. Bind is 1-based (to match sqlite). When done executing a statement, the statement should be . The easiest way to ensure this is to just use a 'using' statement along with a . By resetting the statement, it can then be used in the future with new bound parameters. Finalization/destruction of the underlying raw sqlite statement is handled by . Implementation of an backed by SQLite. Abstracts out access to specific tables in the DB. This allows us to share overall logic around cancellation/pooling/error-handling/etc, while still hitting different db tables. Queue of actions we want to perform all at once against the DB in a single transaction. The task responsible for writing out all the batched actions we have for a particular queue. When new reads come in for that queue they can 'await' this write-task completing so that all reads for the queue observe any previously completed writes. Inside the DB we have a table dedicated to storing strings that also provides a unique integral ID per string. This allows us to store data keyed in a much more efficient manner as we can use those IDs instead of duplicating strings all over the place. For example, there may be many pieces of data associated with a file. We don't want to key off the file path in all these places as that would cause a large amount of bloat. Because the string table can map from arbitrary strings to unique IDs, it can also be used to create IDs for compound objects. For example, given the IDs for the FilePath and Name of a Project, we can get an ID that represents the project itself by just creating a compound key of those two IDs. This ID can then be used in other compound situations. For example, a Document's ID is creating by compounding its Project's ID, along with the IDs for the Document's FilePath and Name. The format of the table is: StringInfo -------------------------------------------------------------- | Id (integer, primary key, auto increment) | Data (varchar) | -------------------------------------------------------------- Inside the DB we have a table for data corresponding to the . The data is just a blob that is keyed by a string Id. Data with this ID can be retrieved or overwritten. The format of the table is: SolutionData ------------------------------------------------------------------- | DataId (primary key, varchar) | | Checksum (blob) | Data (blob) | ------------------------------------------------------------------- Inside the DB we have a table for data that we want associated with a . The data is keyed off of an integral value produced by combining the ID of the Project and the ID of the name of the data (see . This gives a very efficient integral key, and means that the we only have to store a single mapping from stream name to ID in the string table. The format of the table is: ProjectData ------------------------------------------------------------------- | DataId (primary key, integer) | | Checksum (blob) | Data (blob) | ------------------------------------------------------------------- Inside the DB we have a table for data that we want associated with a . The data is keyed off of an integral value produced by combining the ID of the Document and the ID of the name of the data (see . This gives a very efficient integral key, and means that the we only have to store a single mapping from stream name to ID in the string table. The format of the table is: DocumentData ------------------------------------------------------------------- | DataId (primary key, integer) | | Checksum (blob) | Data (blob) | ------------------------------------------------------------------- Gets a from the connection pool, or creates one if none are available. Database connections have a large amount of overhead, and should be returned to the pool when they are no longer in use. In particular, make sure to avoid letting a connection lease cross an boundary, as it will prevent code in the asynchronous operation from using the existing connection. We have a lot of ID information to put into the DB. IDs for all strings we intend to intern, as well as compound IDs for our projects and documents. Inserting these individually is far too slow as SQLite will lock the DB for each insert and will have to do all the journalling work to ensure ACID semantics. To avoid that, we attempt to precompute all the information we'd need to put in the ID tables and perform it all at once per project. Returns 'true' if the bulk population succeeds, or false if it doesn't. Mapping from the workspace's ID for a document, to the ID we use in the DB for the document. Kept locally so we don't have to hit the DB for the common case of trying to determine the DB id for a document. Given a document, and the name of a stream to read/write, gets the integral DB ID to use to find the data inside the DocumentData table. responsible for storing and retrieving data from . Amount of time to wait between flushing writes to disk. 500ms means we can flush writes to disk two times a second. We use a pool to cache reads/writes that are less than 4k. Testing with Roslyn, 99% of all writes (48.5k out of 49.5k) are less than that size. So this helps ensure that we can pool as much as possible, without caching excessively large arrays (for example, Roslyn does write out nearly 50 chunks that are larger than 100k each). The max amount of byte[]s we cache. This caps our cache at 4MB while allowing us to massively speed up writing (by batching writes). Because we can write to disk two times a second. That means a total of 8MB/s that can be written to disk using only our cache. Given that Roslyn itself only writes about 50MB to disk after several minutes of analysis, this amount of bandwidth is more than sufficient. Mapping from the workspace's ID for a project, to the ID we use in the DB for the project. Kept locally so we don't have to hit the DB for the common case of trying to determine the DB id for a project. Given a project, and the name of a stream to read/write, gets the integral DB ID to use to find the data inside the ProjectData table. responsible for storing and retrieving data from . responsible for storing and retrieving data from . Note that with the Solution table there is no need for key->id translation. i.e. the key acts as the ID itself. Lock protecting the write queues and . Task kicked off to actually do the work of flushing all data to the DB. A is a lightweight identifier for a symbol that can be used to resolve the "same" symbol across compilations. Different symbols have different concepts of "same-ness". Same-ness is recursively defined as follows: Two s are the "same" if they have the "same" and equal . Two s are the "same" if they have equal .Name Two s are the "same" if they have the "same" and equal . Two s are the "same" if they have the "same" , equal , equal , the "same" , and have the "same" s and equal s. Two s are the "same" if they have the "same" . is not used because module identity is not important in practice. Two s are the "same" if they have the "same" , equal , equal and the "same" . Two s are the "same" if they have the "same" and equal . If the is the global namespace for a compilation, then it will only match another global namespace of another compilation. Two s are the "same" if they have the "same" and equal . Two s are the "same" if they have the "same" . Two s are the "same" if they have the "same" the "same" , the "same" , and have the "same" s and the "same" s. Two are the "same" if they have the "same" and the "same" . Two s are the "same" if they have the "same" and the "same" . Due to issues arising from errors and ambiguity, it's possible for a SymbolKey to resolve to multiple symbols. For example, in the following type: class C { int M(); bool M(); } The SymbolKey for both 'M' methods will be the same. The SymbolKey will then resolve to both methods. s are not guaranteed to work across different versions of Roslyn. They can be persisted in their form and used across sessions with the same version of Roslyn. However, future versions may change the encoded format and may no longer be able to previous keys. As such, only persist if using for a cache that can be regenerated if necessary. Anonymous functions and anonymous-delegates (the special VB synthesized delegate types), only come into existence when someone has explicitly written a lambda in their source code. So to appropriately round-trip this symbol we store the location that the lambda was at so that we can find the symbol again when we resolve the key. Current format version. Any time we change anything about our format, we should change this. This will help us detect and reject any cases where a person serializes out a SymbolKey from a previous version of Roslyn and then attempt to use it in a newer version where the encoding has changed. Constructs a new using the result of a previous call to from this same session. Instantiating with a string from any other source is not supported. Constructs a new representing the provided . Returns an that determines if two s represent the same effective symbol. Whether or not casing should be considered when comparing keys. For example, with ignoreCase=true then X.SomeClass and X.Someclass would be considered the same effective symbol Whether or not the originating assembly of referenced symbols should be compared when determining if two symbols are effectively the same. For example, with ignoreAssemblyKeys=true then an X.SomeClass from assembly A and X.SomeClass from assembly B will be considered the same effective symbol. Tries to resolve this in the given to a matching symbol. should only be given if the symbol was produced from a compilation that has the exact same source as the compilation we're resolving against. Otherwise the locations resolved may not actually be correct in the final compilation. Returns this encoded as a string. This can be persisted and used later with to then try to resolve back to the corresponding in a future . This string form is not guaranteed to be reusable across all future versions of Roslyn. As such it should only be used for caching data, with the knowledge that the data may need to be recomputed if the cached data can no longer be used. Reads an array of symbols out from the key. Note: the number of symbols returned will either be the same as the original amount written, or default will be returned. It will never be less or more. default will be returned if any elements could not be resolved to the requested type in the provided . Callers should the instance returned. No check is necessary if default was returned before calling Writes out the provided symbols to the key. The array provided must not be default. The result of . If the could be uniquely mapped to a single then that will be returned in . Otherwise, if the key resolves to multiple symbols (which can happen in error scenarios), then and will be returned. If no symbol can be found will be null and will be empty. Used so we can mock out logging in unit tests. Searches for packages that contain a type with the provided name and arity. Note: Implementations are free to return the results they feel best for the given data. Specifically, they can do exact or fuzzy matching on the name. They can use or ignore the arity depending on their capabilities. Implementations should return results in order from best to worst (from their perspective). Searches for packages that contain an assembly with the provided name. Note: Implementations are free to return the results they feel best for the given data. Specifically, they can do exact or fuzzy matching on the name. Implementations should return results in order from best to worst (from their perspective). Searches for reference assemblies that contain a type with the provided name and arity. Note: Implementations are free to return the results they feel best for the given data. Specifically, they can do exact or fuzzy matching on the name. They can use or ignore the arity depending on their capabilities. Implementations should return results in order from best to worst (from their perspective). Service that allows you to query the SymbolSearch database and which keeps the database up to date. The name the underlying naming system came up with based on the argument itself. This might be a name like "_value". We pass this along because it can help later parts of the GenerateConstructor process when doing things like field hookup. The name we think should actually be used for this parameter. This will include stripping the name of things like underscores. A class used to provide XML documentation to the compiler for members from metadata from an XML document source. Gets the source stream for the XML document. The cancellation token. Creates an from bytes representing XML documentation data. The XML document bytes. An . Creates an from an XML documentation file. The path to the XML file. An . A trivial XmlDocumentationProvider which never returns documentation. A comparer that compares symbols but ignores nullability, both top-level and nested. Realizes the array. 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. 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. 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. this is RAII object to automatically release pooled object when its owning pool Shared object pool for roslyn Use this shared pool if only concern is reducing object allocations. if perf of an object pool itself is also a concern, use ObjectPool directly. For example, if you want to create a million of small objects within a second, use the ObjectPool directly. it should have much less overhead than using this. pool that uses default constructor with 100 elements pooled pool that uses default constructor with 20 elements pooled pool that uses string as key with StringComparer.OrdinalIgnoreCase as key comparer pool that uses string as element with StringComparer.OrdinalIgnoreCase as element comparer pool that uses string as element with StringComparer.Ordinal as element comparer Used to reduce the # of temporary byte[]s created to satisfy serialization and other I/O requests Helpers to create temporary streams backed by pooled memory A strongly-typed resource class, for looking up localized strings, etc. Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. Looks up a localized string similar to '{0}' encountered an error and has been disabled.. Looks up a localized string similar to '{0}' is already part of the workspace.. Looks up a localized string similar to {0} is already present.. Looks up a localized string similar to '{0}' is already referenced.. Looks up a localized string similar to '{0}' is not open.. Looks up a localized string similar to '{0}' is not part of the workspace.. Looks up a localized string similar to {0} is not present.. Looks up a localized string similar to '{0}' is not referenced.. Looks up a localized string similar to {0} is still open.. Looks up a localized string similar to "{0}" must be a non-null and non-empty string.. Looks up a localized string similar to '{0}' returned an uninitialized ImmutableArray. Looks up a localized string similar to {0} still contains open documents.. Looks up a localized string similar to A language name cannot be specified for this option.. Looks up a localized string similar to A language name must be specified for this option.. Looks up a localized string similar to A subtraction must be the last element in a character class. Looks up a localized string similar to Absolute path expected.. Looks up a localized string similar to Abstract Method. Looks up a localized string similar to Add braces to '{0}' statement.. Looks up a localized string similar to Added:. Looks up a localized string similar to Adding additional documents is not supported.. Looks up a localized string similar to Adding analyzer config documents is not supported.. Looks up a localized string similar to Adding analyzer references is not supported.. Looks up a localized string similar to Adding documents is not supported.. Looks up a localized string similar to Adding metadata references is not supported.. Looks up a localized string similar to Adding project reference from '{0}' to '{1}' will cause a circular reference.. Looks up a localized string similar to Adding project references is not supported.. Looks up a localized string similar to Adding projects is not supported.. Looks up a localized string similar to After:. Looks up a localized string similar to Alternation conditions cannot be comments. Looks up a localized string similar to Alternation conditions do not capture and cannot be named. Looks up a localized string similar to An element with the same key but a different value already exists.. Looks up a localized string similar to An error occurred while reading the specified configuration file: {0}. Looks up a localized string similar to Arrays with more than one dimension cannot be serialized.. Looks up a localized string similar to Async Method. Looks up a localized string similar to At least one diagnostic must be supplied.. Looks up a localized string similar to Before:. Looks up a localized string similar to Begins with I. Looks up a localized string similar to Can't resolve analyzer reference: '{0}'.. Looks up a localized string similar to Can't resolve metadata reference: '{0}'.. Looks up a localized string similar to Cannot deserialize type '{0}'.. Looks up a localized string similar to Cannot generate code for unsupported operator '{0}'. Looks up a localized string similar to Cannot include class \{0} in character range. Looks up a localized string similar to Cannot open project '{0}' because the file extension '{1}' is not associated with a language.. Looks up a localized string similar to Cannot open project '{0}' because the language '{1}' is not supported.. Looks up a localized string similar to Cannot serialize type '{0}'.. Looks up a localized string similar to Capture group numbers must be less than or equal to Int32.MaxValue. Looks up a localized string similar to Capture number cannot be zero. Looks up a localized string similar to Cast is redundant.. Looks up a localized string similar to Changing additional documents is not supported.. Looks up a localized string similar to Changing analyzer config documents is not supported.. Looks up a localized string similar to Changing compilation options is not supported.. Looks up a localized string similar to Changing document '{0}' is not supported.. Looks up a localized string similar to Changing document properties is not supported. Looks up a localized string similar to Changing documents is not supported.. Looks up a localized string similar to Changing parse options is not supported.. Looks up a localized string similar to Changing project properties is not supported.. Looks up a localized string similar to Class. Looks up a localized string similar to Core EditorConfig Options. Looks up a localized string similar to Could not find location to generation symbol into.. Looks up a localized string similar to C# files. Looks up a localized string similar to Cycle detected in extensions. Looks up a localized string similar to DateTimeKind must be Utc. Looks up a localized string similar to Delegate. Looks up a localized string similar to Deserialization reader for '{0}' read incorrect number of values.. Looks up a localized string similar to Destination location was from a different tree.. Looks up a localized string similar to Destination location was not in source.. Looks up a localized string similar to Destination type must be a {0}, {1} or {2}, but given one is {3}.. Looks up a localized string similar to Destination type must be a {0}, but given one is {1}.. Looks up a localized string similar to Destination type must be a {0} or a {1}, but given one is {2}.. Looks up a localized string similar to Diagnostic must have span '{0}'. Looks up a localized string similar to Document does not support syntax trees. Looks up a localized string similar to Documentation comment id must start with E, F, M, N, P or T. Looks up a localized string similar to .NET Coding Conventions. Looks up a localized string similar to Duplicate source file '{0}' in project '{1}'. Looks up a localized string similar to Enable. Looks up a localized string similar to Enable and ignore future errors. Looks up a localized string similar to Enum. Looks up a localized string similar to Error. Looks up a localized string similar to Event. Looks up a localized string similar to Exceptions:. Looks up a localized string similar to Expected {0}.. Looks up a localized string similar to Expected {0} line.. Looks up a localized string similar to Expected end-of-file.. Looks up a localized string similar to Expected header: "{0}".. Looks up a localized string similar to Expression-level preferences. Looks up a localized string similar to Failure. Looks up a localized string similar to Field preferences. Looks up a localized string similar to File '{0}' size of {1} exceeds maximum allowed size of {2}. Looks up a localized string similar to File was externally modified: {0}.. Looks up a localized string similar to Fix all '{0}'. Looks up a localized string similar to Fix all '{0}' in '{1}'. Looks up a localized string similar to Fix all '{0}' in Solution. Looks up a localized string similar to Illegal \ at end of pattern. Looks up a localized string similar to Illegal {x,y} with x > y. Looks up a localized string similar to Incomplete \p{X} character escape. Looks up a localized string similar to Indentation and spacing. Looks up a localized string similar to Insufficient hexadecimal digits. Looks up a localized string similar to Interface. Looks up a localized string similar to Invalid CodePage value: {0}. Looks up a localized string similar to Invalid group name: Group names must begin with a word character. Looks up a localized string similar to Invalid number of parameters for binary operator.. Looks up a localized string similar to Invalid number of parameters for unary operator.. Looks up a localized string similar to Invalid project block, expected "=" after Project.. Looks up a localized string similar to Invalid project block, expected "," after project name.. Looks up a localized string similar to Invalid project block, expected "," after project path.. Looks up a localized string similar to Invalid project file path: '{0}'. Looks up a localized string similar to Invalid solution file path: '{0}'. Looks up a localized string similar to Label for node '{0}' is invalid, it must be within [0, {1}).. Looks up a localized string similar to Language keywords vs BCL types preferences. Looks up a localized string similar to Location must be null or from source.. Looks up a localized string similar to malformed. Looks up a localized string similar to Malformed \p{X} character escape. Looks up a localized string similar to Malformed \k<...> named back reference. Looks up a localized string similar to Matching nodes '{0}' and '{1}' must have the same label.. Looks up a localized string similar to Member access should be qualified.. Looks up a localized string similar to Metadata is already referenced.. Looks up a localized string similar to Metadata is not referenced.. Looks up a localized string similar to Method. Looks up a localized string similar to Missing control character. Looks up a localized string similar to Missing prefix: '{0}'. Looks up a localized string similar to Missing suffix: '{0}'. Looks up a localized string similar to Modifier preferences. Looks up a localized string similar to Name can be simplified.. Looks up a localized string similar to Naming rules. Looks up a localized string similar to Naming styles. Looks up a localized string similar to Nested quantifier {0}. Looks up a localized string similar to New line preferences. Looks up a localized string similar to No location provided to add statements to.. Looks up a localized string similar to Node '{0}' must be contained in the new tree.. Looks up a localized string similar to Node '{0}' must be contained in the old tree.. Looks up a localized string similar to Node is of the wrong type.. Looks up a localized string similar to Non-Field Members. Looks up a localized string similar to None. Looks up a localized string similar to Not enough )'s. Looks up a localized string similar to Options did not come from Workspace. Looks up a localized string similar to Organize usings. Looks up a localized string similar to Parameter preferences. Looks up a localized string similar to Parentheses preferences. Looks up a localized string similar to Pascal Case. Looks up a localized string similar to Populate switch. Looks up a localized string similar to Prefix '{0}' does not match expected prefix '{1}'. Looks up a localized string similar to Prefix '{0}' is not expected. Looks up a localized string similar to Private Method. Looks up a localized string similar to Private or Internal Field. Looks up a localized string similar to Private or Internal Static Field. Looks up a localized string similar to Project file not found: '{0}'. Looks up a localized string similar to Property. Looks up a localized string similar to Public or Protected Field. Looks up a localized string similar to Quantifier {x,y} following nothing. Looks up a localized string similar to Refactoring Only. Looks up a localized string similar to reference to undefined group. Looks up a localized string similar to Reference to undefined group name {0}. Looks up a localized string similar to Reference to undefined group number {0}. Looks up a localized string similar to All control characters. This includes the Cc, Cf, Cs, Co, and Cn categories.. Looks up a localized string similar to all control characters. Looks up a localized string similar to All diacritic marks. This includes the Mn, Mc, and Me categories.. Looks up a localized string similar to all diacritic marks. Looks up a localized string similar to All letter characters. This includes the Lu, Ll, Lt, Lm, and Lo characters.. Looks up a localized string similar to all letter characters. Looks up a localized string similar to All numbers. This includes the Nd, Nl, and No categories.. Looks up a localized string similar to all numbers. Looks up a localized string similar to All punctuation characters. This includes the Pc, Pd, Ps, Pe, Pi, Pf, and Po categories.. Looks up a localized string similar to all punctuation characters. Looks up a localized string similar to All separator characters. This includes the Zs, Zl, and Zp categories.. Looks up a localized string similar to all separator characters. Looks up a localized string similar to All symbols. This includes the Sm, Sc, Sk, and So categories.. Looks up a localized string similar to all symbols. Looks up a localized string similar to You can use the vertical bar (|) character to match any one of a series of patterns, where the | character separates each pattern.. Looks up a localized string similar to alternation. Looks up a localized string similar to The period character (.) matches any character except \n (the newline character, \u000A). If a regular expression pattern is modified by the RegexOptions.Singleline option, or if the portion of the pattern that contains the . character class is modified by the 's' option, . matches any character.. Looks up a localized string similar to any character. Looks up a localized string similar to Matches a backspace character, \u0008. Looks up a localized string similar to backspace character. Looks up a localized string similar to A balancing group definition deletes the definition of a previously defined group and stores, in the current group, the interval between the previously defined group and the current group. 'name1' is the current group (optional), 'name2' is a previously defined group, and 'subexpression' is any valid regular expression pattern. The balancing group definition deletes the definition of name2 and stores the interval between name2 and name1 in name1. If no name2 group is defined, the match backtracks. Be [rest of string was truncated]";. Looks up a localized string similar to balancing group. Looks up a localized string similar to base-group. Looks up a localized string similar to Matches a bell (alarm) character, \u0007. Looks up a localized string similar to bell character. Looks up a localized string similar to Matches a carriage-return character, \u000D. Note that \r is not equivalent to the newline character, \n.. Looks up a localized string similar to carriage-return character. Looks up a localized string similar to Character class subtraction yields a set of characters that is the result of excluding the characters in one character class from another character class. 'base_group' is a positive or negative character group or range. The 'excluded_group' component is another positive or negative character group, or another character class subtraction expression (that is, you can nest character class subtraction expressions).. Looks up a localized string similar to character class subtraction. Looks up a localized string similar to character-group. Looks up a localized string similar to comment. Looks up a localized string similar to This language element attempts to match one of two patterns depending on whether it can match an initial pattern. 'expression' is the initial pattern to match, 'yes' is the pattern to match if expression is matched, and 'no' is the optional pattern to match if expression is not matched.. Looks up a localized string similar to conditional expression match. Looks up a localized string similar to This language element attempts to match one of two patterns depending on whether it has matched a specified capturing group. 'name' is the name (or number) of a capturing group, 'yes' is the expression to match if 'name' (or 'number') has a match, and 'no' is the optional expression to match if it does not.. Looks up a localized string similar to conditional group match. Looks up a localized string similar to The \G anchor specifies that a match must occur at the point where the previous match ended. When you use this anchor with the Regex.Matches or Match.NextMatch method, it ensures that all matches are contiguous.. Looks up a localized string similar to contiguous matches. Looks up a localized string similar to Matches an ASCII control character, where X is the letter of the control character. For example, \cC is CTRL-C.. Looks up a localized string similar to control character. Looks up a localized string similar to \d matches any decimal digit. It is equivalent to the \p{Nd} regular expression pattern, which includes the standard decimal digits 0-9 as well as the decimal digits of a number of other character sets. If ECMAScript-compliant behavior is specified, \d is equivalent to [0-9]. Looks up a localized string similar to decimal-digit character. Looks up a localized string similar to A number sign (#) marks an x-mode comment, which starts at the unescaped # character at the end of the regular expression pattern and continues until the end of the line. To use this construct, you must either enable the x option (through inline options) or supply the RegexOptions.IgnorePatternWhitespace value to the option parameter when instantiating the Regex object or calling a static Regex method.. Looks up a localized string similar to end-of-line comment. Looks up a localized string similar to The \z anchor specifies that a match must occur at the end of the input string. Like the $ language element, \z ignores the RegexOptions.Multiline option. Unlike the \Z language element, \z does not match a \n character at the end of a string. Therefore, it can only match the last line of the input string.. Looks up a localized string similar to end of string only. Looks up a localized string similar to The \Z anchor specifies that a match must occur at the end of the input string, or before \n at the end of the input string. It is identical to the $ anchor, except that \Z ignores the RegexOptions.Multiline option. Therefore, in a multiline string, it can only match the end of the last line, or the last line before \n. The \Z anchor matches \n but does not match \r\n (the CR/LF character combination). To match CR/LF, include \r?\Z in the regular expression pattern.. Looks up a localized string similar to end of string or before ending newline. Looks up a localized string similar to The $ anchor specifies that the preceding pattern must occur at the end of the input string, or before \n at the end of the input string. If you use $ with the RegexOptions.Multiline option, the match can also occur at the end of a line. The $ anchor matches \n but does not match \r\n (the combination of carriage return and newline characters, or CR/LF). To match the CR/LF character combination, include \r?$ in the regular expression pattern.. Looks up a localized string similar to end of string or line. Looks up a localized string similar to Matches an escape character, \u001B. Looks up a localized string similar to escape character. Looks up a localized string similar to excluded-group. Looks up a localized string similar to expression. Looks up a localized string similar to Matches a form-feed character, \u000C. Looks up a localized string similar to form-feed character. Looks up a localized string similar to This grouping construct applies or disables the specified options within a subexpression. The options to enable are specified after the question mark, and the options to disable after the minus sign. The allowed options are: i Use case-insensitive matching. m Use multiline mode, where ^ and $ match the beginning and end of each line (instead of the beginning and end of the input string). s Use single-line mode, where the period (.) matches every character (instead of every character exc [rest of string was truncated]";. Looks up a localized string similar to group options. Looks up a localized string similar to Matches an ASCII character, where ## is a two-digit hexadecimal character code.. Looks up a localized string similar to hexadecimal escape. Looks up a localized string similar to The (?# comment) construct lets you include an inline comment in a regular expression. The regular expression engine does not use any part of the comment in pattern matching, although the comment is included in the string that is returned by the Regex.ToString method. The comment ends at the first closing parenthesis.. Looks up a localized string similar to inline comment. Looks up a localized string similar to Enables or disables specific pattern matching options for the remainder of a regular expression. The options to enable are specified after the question mark, and the options to disable after the minus sign. The allowed options are: i Use case-insensitive matching. m Use multiline mode, where ^ and $ match the beginning and end of each line (instead of the beginning and end of the input string). s Use single-line mode, where the period (.) matches every character (instead of every charac [rest of string was truncated]";. Looks up a localized string similar to inline options. Looks up a localized string similar to Regex issue: {0}. Looks up a localized string similar to letter, lowercase. Looks up a localized string similar to letter, modifier. Looks up a localized string similar to letter, other. Looks up a localized string similar to letter, titlecase. Looks up a localized string similar to letter, uppercase. Looks up a localized string similar to mark, enclosing. Looks up a localized string similar to mark, nonspacing. Looks up a localized string similar to mark, spacing combining. Looks up a localized string similar to The {n,}? quantifier matches the preceding element at least n times, where n is any integer, but as few times as possible. It is the lazy counterpart of the greedy quantifier {n,}. Looks up a localized string similar to match at least 'n' times (lazy). Looks up a localized string similar to The {n,} quantifier matches the preceding element at least n times, where n is any integer. {n,} is a greedy quantifier whose lazy equivalent is {n,}?. Looks up a localized string similar to match at least 'n' times. Looks up a localized string similar to The {n,m}? quantifier matches the preceding element between n and m times, where n and m are integers, but as few times as possible. It is the lazy counterpart of the greedy quantifier {n,m}. Looks up a localized string similar to match at least 'n' times (lazy). Looks up a localized string similar to The {n,m} quantifier matches the preceding element at least n times, but no more than m times, where n and m are integers. {n,m} is a greedy quantifier whose lazy equivalent is {n,m}?. Looks up a localized string similar to match between 'm' and 'n' times. Looks up a localized string similar to The {n}? quantifier matches the preceding element exactly n times, where n is any integer. It is the lazy counterpart of the greedy quantifier {n}+. Looks up a localized string similar to match exactly 'n' times (lazy). Looks up a localized string similar to The {n} quantifier matches the preceding element exactly n times, where n is any integer. {n} is a greedy quantifier whose lazy equivalent is {n}?. Looks up a localized string similar to match exactly 'n' times. Looks up a localized string similar to The +? quantifier matches the preceding element one or more times, but as few times as possible. It is the lazy counterpart of the greedy quantifier +. Looks up a localized string similar to match one or more times (lazy). Looks up a localized string similar to The + quantifier matches the preceding element one or more times. It is equivalent to the {1,} quantifier. + is a greedy quantifier whose lazy equivalent is +?.. Looks up a localized string similar to match one or more times. Looks up a localized string similar to The *? quantifier matches the preceding element zero or more times, but as few times as possible. It is the lazy counterpart of the greedy quantifier *. Looks up a localized string similar to match zero or more times (lazy). Looks up a localized string similar to The * quantifier matches the preceding element zero or more times. It is equivalent to the {0,} quantifier. * is a greedy quantifier whose lazy equivalent is *?.. Looks up a localized string similar to match zero or more times. Looks up a localized string similar to The ?? quantifier matches the preceding element zero or one time, but as few times as possible. It is the lazy counterpart of the greedy quantifier ?. Looks up a localized string similar to match zero or one time (lazy). Looks up a localized string similar to The ? quantifier matches the preceding element zero or one time. It is equivalent to the {0,1} quantifier. ? is a greedy quantifier whose lazy equivalent is ??.. Looks up a localized string similar to match zero or one time. Looks up a localized string similar to This grouping construct captures a matched 'subexpression', where 'subexpression' is any valid regular expression pattern. Captures that use parentheses are numbered automatically from left to right based on the order of the opening parentheses in the regular expression, starting from one. The capture that is numbered zero is the text matched by the entire regular expression pattern.. Looks up a localized string similar to matched subexpression. Looks up a localized string similar to name. Looks up a localized string similar to name-or-number. Looks up a localized string similar to name1. Looks up a localized string similar to name2. Looks up a localized string similar to A named or numbered backreference. 'name' is the name of a capturing group defined in the regular expression pattern.. Looks up a localized string similar to named backreference. Looks up a localized string similar to Captures a matched subexpression and lets you access it by name or by number. 'name' is a valid group name, and 'subexpression' is any valid regular expression pattern. 'name' must not contain any punctuation characters and cannot begin with a number. If the RegexOptions parameter of a regular expression pattern matching method includes the RegexOptions.ExplicitCapture flag, or if the n option is applied to this subexpression, the only way to capture a subexpression is to explicitly name capturing gro [rest of string was truncated]";. Looks up a localized string similar to named matched subexpression. Looks up a localized string similar to A negative character group specifies a list of characters that must not appear in an input string for a match to occur. The list of characters are specified individually. Two or more character ranges can be concatenated. For example, to specify the range of decimal digits from "0" through "9", the range of lowercase letters from "a" through "f", and the range of uppercase letters from "A" through "F", use [0-9a-fA-F].. Looks up a localized string similar to negative character group. Looks up a localized string similar to A negative character range specifies a list of characters that must not appear in an input string for a match to occur. 'firstCharacter' is the character that begins the range, and 'lastCharacter' is the character that ends the range. Two or more character ranges can be concatenated. For example, to specify the range of decimal digits from "0" through "9", the range of lowercase letters from "a" through "f", and the range of uppercase letters from "A" through "F", use [0-9a-fA-F].. Looks up a localized string similar to negative character range. Looks up a localized string similar to The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name.. Looks up a localized string similar to negative unicode category. Looks up a localized string similar to Matches a new-line character, \u000A. Looks up a localized string similar to new-line character. Looks up a localized string similar to no. Looks up a localized string similar to \D matches any non-digit character. It is equivalent to the \P{Nd} regular expression pattern. If ECMAScript-compliant behavior is specified, \D is equivalent to [^0-9]. Looks up a localized string similar to non-digit character. Looks up a localized string similar to \S matches any non-white-space character. It is equivalent to the [^\f\n\r\t\v\x85\p{Z}] regular expression pattern, or the opposite of the regular expression pattern that is equivalent to \s, which matches white-space characters. If ECMAScript-compliant behavior is specified, \S is equivalent to [^ \f\n\r\t\v]. Looks up a localized string similar to non-white-space character. Looks up a localized string similar to The \B anchor specifies that the match must not occur on a word boundary. It is the opposite of the \b anchor.. Looks up a localized string similar to non-word boundary. Looks up a localized string similar to \W matches any non-word character. It matches any character except for those in the following Unicode categories: Ll Letter, Lowercase Lu Letter, Uppercase Lt Letter, Titlecase Lo Letter, Other Lm Letter, Modifier Mn Mark, Nonspacing Nd Number, Decimal Digit Pc Punctuation, Connector If ECMAScript-compliant behavior is specified, \W is equivalent to [^a-zA-Z_0-9]. Looks up a localized string similar to non-word character. Looks up a localized string similar to This construct disables backtracking. The regular expression engine will match as many characters in the input string as it can. When no further match is possible, it will not backtrack to attempt alternate pattern matches. (That is, the subexpression matches only strings that would be matched by the subexpression alone; it does not attempt to match a string based on the subexpression and any subexpressions that follow it.) This option is recommended if you know that backtracking will not succeed. Preven [rest of string was truncated]";. Looks up a localized string similar to nonbacktracking subexpression. Looks up a localized string similar to This construct does not capture the substring that is matched by a subexpression: The noncapturing group construct is typically used when a quantifier is applied to a group, but the substrings captured by the group are of no interest. If a regular expression includes nested grouping constructs, an outer noncapturing group construct does not apply to the inner nested group constructs.. Looks up a localized string similar to noncapturing group. Looks up a localized string similar to number, decimal digit. Looks up a localized string similar to number, letter. Looks up a localized string similar to number, other. Looks up a localized string similar to A numbered backreference, where 'number' is the ordinal position of the capturing group in the regular expression. For example, \4 matches the contents of the fourth capturing group. There is an ambiguity between octal escape codes (such as \16) and \number backreferences that use the same notation. If the ambiguity is a problem, you can use the \k<name> notation, which is unambiguous and cannot be confused with octal character codes. Similarly, hexadecimal codes such as \xdd are unambiguous and cannot b [rest of string was truncated]";. Looks up a localized string similar to numbered backreference. Looks up a localized string similar to other, control. Looks up a localized string similar to other, format. Looks up a localized string similar to other, not assigned. Looks up a localized string similar to other, private use. Looks up a localized string similar to other, surrogate. Looks up a localized string similar to A positive character group specifies a list of characters, any one of which may appear in an input string for a match to occur.. Looks up a localized string similar to positive character group. Looks up a localized string similar to A positive character range specifies a range of characters, any one of which may appear in an input string for a match to occur. 'firstCharacter' is the character that begins the range and 'lastCharacter' is the character that ends the range. . Looks up a localized string similar to positive character range. Looks up a localized string similar to punctuation, close. Looks up a localized string similar to punctuation, connector. Looks up a localized string similar to punctuation, dash. Looks up a localized string similar to punctuation, final quote. Looks up a localized string similar to punctuation, initial quote. Looks up a localized string similar to punctuation, open. Looks up a localized string similar to punctuation, other. Looks up a localized string similar to separator, line. Looks up a localized string similar to separator, paragraph. Looks up a localized string similar to separator, space. Looks up a localized string similar to The \A anchor specifies that a match must occur at the beginning of the input string. It is identical to the ^ anchor, except that \A ignores the RegexOptions.Multiline option. Therefore, it can only match the start of the first line in a multiline input string.. Looks up a localized string similar to start of string only. Looks up a localized string similar to The ^ anchor specifies that the following pattern must begin at the first character position of the string. If you use ^ with the RegexOptions.Multiline option, the match must occur at the beginning of each line.. Looks up a localized string similar to start of string or line. Looks up a localized string similar to subexpression. Looks up a localized string similar to symbol, currency. Looks up a localized string similar to symbol, math. Looks up a localized string similar to symbol, modifier. Looks up a localized string similar to symbol, other. Looks up a localized string similar to Matches a tab character, \u0009. Looks up a localized string similar to tab character. Looks up a localized string similar to The regular expression construct \p{ name } matches any character that belongs to a Unicode general category or named block, where name is the category abbreviation or named block name.. Looks up a localized string similar to unicode category. Looks up a localized string similar to Matches a UTF-16 code unit whose value is #### hexadecimal.. Looks up a localized string similar to unicode escape. Looks up a localized string similar to Unicode General Category: {0}. Looks up a localized string similar to Matches a vertical-tab character, \u000B. Looks up a localized string similar to vertical-tab character. Looks up a localized string similar to \s matches any white-space character. It is equivalent to the following escape sequences and Unicode categories: \f The form feed character, \u000C \n The newline character, \u000A \r The carriage return character, \u000D \t The tab character, \u0009 \v The vertical tab character, \u000B \x85 The ellipsis or NEXT LINE (NEL) character (…), \u0085 \p{Z} Matches any separator character If ECMAScript-compliant behavior is specified, \s is equivalent to [ \f\n\r\t\v]. Looks up a localized string similar to white-space character. Looks up a localized string similar to The \b anchor specifies that the match must occur on a boundary between a word character (the \w language element) and a non-word character (the \W language element). Word characters consist of alphanumeric characters and underscores; a non-word character is any character that is not alphanumeric or an underscore. The match may also occur on a word boundary at the beginning or end of the string. The \b anchor is frequently used to ensure that a subexpression matches an entire word instead of just the beg [rest of string was truncated]";. Looks up a localized string similar to word boundary. Looks up a localized string similar to \w matches any word character. A word character is a member of any of the following Unicode categories: Ll Letter, Lowercase Lu Letter, Uppercase Lt Letter, Titlecase Lo Letter, Other Lm Letter, Modifier Mn Mark, Nonspacing Nd Number, Decimal Digit Pc Punctuation, Connector If ECMAScript-compliant behavior is specified, \w is equivalent to [a-zA-Z_0-9]. Looks up a localized string similar to word character. Looks up a localized string similar to yes. Looks up a localized string similar to A zero-width negative lookahead assertion, where for the match to be successful, the input string must not match the regular expression pattern in subexpression. The matched string is not included in the match result. A zero-width negative lookahead assertion is typically used either at the beginning or at the end of a regular expression. At the beginning of a regular expression, it can define a specific pattern that should not be matched when the beginning of the regular expression defines a similar but [rest of string was truncated]";. Looks up a localized string similar to zero-width negative lookahead assertion. Looks up a localized string similar to A zero-width negative lookbehind assertion, where for a match to be successful, 'subexpression' must not occur at the input string to the left of the current position. Any substring that does not match 'subexpression' is not included in the match result. Zero-width negative lookbehind assertions are typically used at the beginning of regular expressions. The pattern that they define precludes a match in the string that follows. They are also used to limit backtracking when the last character or character [rest of string was truncated]";. Looks up a localized string similar to zero-width negative lookbehind assertion. Looks up a localized string similar to A zero-width positive lookahead assertion, where for a match to be successful, the input string must match the regular expression pattern in 'subexpression'. The matched substring is not included in the match result. A zero-width positive lookahead assertion does not backtrack. Typically, a zero-width positive lookahead assertion is found at the end of a regular expression pattern. It defines a substring that must be found at the end of a string for a match to occur but that should not be included in the [rest of string was truncated]";. Looks up a localized string similar to zero-width positive lookahead assertion. Looks up a localized string similar to A zero-width positive lookbehind assertion, where for a match to be successful, 'subexpression' must occur at the input string to the left of the current position. 'subexpression' is not included in the match result. A zero-width positive lookbehind assertion does not backtrack. Zero-width positive lookbehind assertions are typically used at the beginning of regular expressions. The pattern that they define is a precondition for a match, although it is not a part of the match result.. Looks up a localized string similar to zero-width positive lookbehind assertion. Looks up a localized string similar to Remove the line below if you want to inherit .editorconfig settings from higher directories. Looks up a localized string similar to Removed:. Looks up a localized string similar to Removing additional documents is not supported.. Looks up a localized string similar to Removing analyzer config documents is not supported.. Looks up a localized string similar to Removing analyzer references is not supported.. Looks up a localized string similar to Removing documents is not supported.. Looks up a localized string similar to Removing metadata references is not supported.. Looks up a localized string similar to Removing project references is not supported.. Looks up a localized string similar to Removing projects is not supported.. Looks up a localized string similar to Service of type '{0}' is required to accomplish the task but is not available from the workspace.. Looks up a localized string similar to Show Stack Trace. Looks up a localized string similar to Solution file not found: '{0}'. Looks up a localized string similar to Specified path must be absolute.. Looks up a localized string similar to Static Field. Looks up a localized string similar to Static Method. Looks up a localized string similar to Stream is too long.. Looks up a localized string similar to Struct. Looks up a localized string similar to Suggestion. Looks up a localized string similar to Supplied diagnostic cannot be null.. Looks up a localized string similar to Symbol "{0}" is not from source.. Looks up a localized string similar to Symbol specifications. Looks up a localized string similar to Temporary storage cannot be written more than once.. Looks up a localized string similar to The first word, '{0}', must begin with a lower case character. Looks up a localized string similar to The first word, '{0}', must begin with an upper case character. Looks up a localized string similar to The language '{0}' is not supported.. Looks up a localized string similar to The member '{0}' is not declared within the declaration of the symbol.. Looks up a localized string similar to The node is not part of the tree.. Looks up a localized string similar to The position is not within the symbol's declaration. Looks up a localized string similar to The project already references the target project.. Looks up a localized string similar to The project already transitively references the target project.. Looks up a localized string similar to The solution already contains the specified document.. Looks up a localized string similar to The solution already contains the specified project.. Looks up a localized string similar to The solution does not contain the specified document.. Looks up a localized string similar to The solution does not contain the specified project.. Looks up a localized string similar to The specified document is not a version of this document.. Looks up a localized string similar to The symbol '{0}' cannot be located within the current solution.. Looks up a localized string similar to The type '{0}' is not understood by the serialization binder.. Looks up a localized string similar to These non-leading words must begin with a lowercase letter: {0}. Looks up a localized string similar to These non-leading words must begin with an upper case letter: {0}. Looks up a localized string similar to These words cannot contain lower case characters: {0}. Looks up a localized string similar to These words cannot contain upper case characters: {0}. Looks up a localized string similar to These words must begin with upper case characters: {0}. Looks up a localized string similar to this. and Me. preferences. Looks up a localized string similar to This submission already references another submission project.. Looks up a localized string similar to This workspace does not support opening and closing documents.. Looks up a localized string similar to Too many | in (?()|). Looks up a localized string similar to Too many )'s. Looks up a localized string similar to Types. Looks up a localized string similar to Unknown identifier.. Looks up a localized string similar to Unknown property. Looks up a localized string similar to Unknown property '{0}'. Looks up a localized string similar to Unmerged change from project '{0}'. Looks up a localized string similar to Unrecognized control character. Looks up a localized string similar to Unrecognized escape sequence \{0}. Looks up a localized string similar to Unrecognized grouping construct. Looks up a localized string similar to Unrecognized language name.. Looks up a localized string similar to Unterminated [] set. Looks up a localized string similar to Unterminated (?#...) comment. Looks up a localized string similar to Usage:. Looks up a localized string similar to Value too large to be represented as a 30 bit unsigned integer.. Looks up a localized string similar to Variables captured:. Looks up a localized string similar to Visual Basic files. Looks up a localized string similar to Warning. Looks up a localized string similar to Adding imports will bring an extension method into scope with the same name as '{0}'. Looks up a localized string similar to Workspace is not empty.. Looks up a localized string similar to [x-y] range in reverse order. A workspace that allows full manipulation of projects and documents, but does not persist changes. Clears all projects and documents from the workspace. Adds an entire solution to the workspace, replacing any existing solution. Adds a project to the workspace. All previous projects remain intact. Adds a project to the workspace. All previous projects remain intact. Adds multiple projects to the workspace at once. All existing projects remain intact. Adds a document to the workspace. Adds a document to the workspace. Puts the specified document into the open state. Puts the specified document into the closed state. Puts the specified additional document into the open state. Puts the specified additional document into the closed state Puts the specified analyzer config document into the open state. Puts the specified analyzer config document into the closed state Hidden registry key to control maximum size of a text file we will read into memory. we have this option to reduce a chance of OOM when user adds massive size files to the solution. Default threshold is 100MB which came from some internal data on big files and some discussion. User can override default value by setting DWORD value on FileLengthThreshold in "[VS HIVE]\Roslyn\Internal\Performance\Text" Creates a content loader for specified file. An absolute file path. 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. Note that if the stream starts with Byte Order Mark the value of is ignored. is null. is not an absolute path. Absolute path of the file. Specifies an encoding to be used if the actual encoding of the file can't be determined from the stream content (the stream doesn't start with Byte Order Mark). If null auto-detect heuristics are used to determine the encoding. Note that if the stream starts with Byte Order Mark the value of is ignored. Load a text and a version of the document in the workspace. Load a text and a version of the document in the workspace. The primary workspace, usually set by the host environment. Register a workspace as the primary workspace. Only one workspace can be the primary. Represents an additional file passed down to analyzers. solution branch Id Checksum of data can be used later to see whether two data are same or not without actually comparing data itself The intended size of the structure. Create Checksum from given byte array. if byte array is bigger than , it will be truncated to the size Create Checksum from given byte array. if byte array is bigger than , it will be truncated to the size This structure stores the 20-byte hash as an inline value rather than requiring the use of byte[]. for regular C#/VB files. Represents a source code document that is part of a project. It provides access to the source text, parsed syntax tree and the corresponding semantic model. A cached reference to the . A cached task that can be returned once the tree has already been created. This is only set if returns true, so the inner value can be non-null. The kind of source code this document contains. True if the info of the document change (name, folders, file path; not the content) Get the current syntax tree for the document if the text is already loaded and the tree is already parsed. In almost all cases, you should call to fetch the tree, which will parse the tree if it's not already parsed. Get the current syntax tree version for the document if the text is already loaded and the tree is already parsed. In almost all cases, you should call to fetch the version, which will load the tree if it's not already available. Gets the version of the document's top level signature if it is already loaded and available. Gets the version of the syntax tree. This is generally the newer of the text version and the project's version. if this Document supports providing data through the and methods. If then these methods will return instead. if this Document supports providing data through the method. If then that method will return instead. Gets the for this document asynchronously. The returned syntax tree can be null if the returns false. Gets the root node of the current syntax tree if the syntax tree has already been parsed and the tree is still cached. In almost all cases, you should call to fetch the root node, which will parse the document if necessary. Gets the root node of the syntax tree asynchronously. The returned will be null if returns false. Only for features that absolutely must run synchronously (probably because they're on the UI thread). Right now, the only feature this is for is Outlining as VS will block on that feature from the UI thread when a document is opened. Gets the current semantic model for this document if the model is already computed and still cached. In almost all cases, you should call , which will compute the semantic model if necessary. Gets the semantic model for this document asynchronously. The returned may be null if returns false. Creates a new instance of this document updated to have the source code kind specified. Creates a new instance of this document updated to have the text specified. Creates a new instance of this document updated to have a syntax tree rooted by the specified syntax node. Creates a new instance of this document updated to have the specified name. Creates a new instance of this document updated to have the specified folders. Creates a new instance of this document updated to have the specified file path. Get the text changes between this document and a prior version of the same document. The changes, when applied to the text of the old document, will produce the text of the current document. Gets the list of s that are linked to this . s are considered to be linked if they share the same . This is excluded from the result. Creates a branched version of this document that has its semantic model frozen in whatever state it is available at the time, assuming a background process is constructing the semantics asynchronously. Repeated calls to this method may return documents with increasingly more complete semantics. Use this method to gain access to potentially incomplete semantics quickly. Returns the options that should be applied to this document. This consists of global options from , merged with any settings the user has specified at the document levels. This method is async because this may require reading other files. In files that are already open, this is expected to be cheap and complete synchronously. An identifier that can be used to retrieve the same across versions of the workspace. Creates a new instance. The project id this document id is relative to. An optional name to make this id easier to recognize while debugging. A class that represents all the arguments necessary to create a new document instance. The Id of the document. The name of the document. The names of the logical nested folders the document is contained in. The kind of the source code. The file path of the document. True if the document is a side effect of the build. A loader that can retrieve the document text. A associated with this document Create a new instance of a . type that contains information regarding this document itself but no tree information such as document info The Id of the document. The name of the document. The names of the logical nested folders the document is contained in. The kind of the source code. The file path of the document. True if the document is a side effect of the build. True if the content (text/tree) has changed. True if the Text has changed A source for TextAndVersion constructed from an syntax tree Indicates whether a type has checksum or not Computes the text changes between two documents. The old version of the document. The new version of the document. The cancellation token. An array of changes. Computes the text changes between two documents. The old version of the document. The new version of the document. The type of differencing to perform. Not supported by all text differencing services. The cancellation token. An array of changes. A map to ensure that the streams from the temporary storage service that back the metadata we create stay alive as long as the metadata is alive. The mode in which value is preserved. The value is guaranteed to have the same contents across multiple accesses. The value is guaranteed to the same instance across multiple accesses. Represents a project that is part of a . The solution this project is part of. The ID of the project. Multiple instances may share the same ID. However, only one project may have this ID in any given solution. The path to the project file or null if there is no project file. The path to the output file, or null if it is not known. The path to the reference assembly output file, or null if it is not known. The default namespace of the project ("" if not defined, which means global namespace), or null if it is unknown or not applicable. Right now VB doesn't have the concept of "default namespace". But we conjure one in workspace by assigning the value of the project's root namespace to it. So various feature can choose to use it for their own purpose. In the future, we might consider officially exposing "default namespace" for VB project (e.g. through a "defaultnamespace" msbuild property) if this supports providing data through the method. If then method will return instead. The language services from the host environment associated with this project's language. The language associated with the project. The name of the assembly this project represents. The name of the project. This may be different than the assembly name. The list of all other metadata sources (assemblies) that this project references. The list of all other projects within the same solution that this project references. The list of all other projects that this project references, including projects that are not part of the solution. The list of all the diagnostic analyzer references for this project. The options used by analyzers for this project. The options used when building the compilation for this project. The options used when parsing documents for this project. Returns true if this is a submission project. True if the project has any documents. All the document IDs associated with this project. All the additional document IDs associated with this project. All the documents associated with this project. All the additional documents associated with this project. All the s associated with this project. True if the project contains a document with the specified ID. True if the project contains an additional document with the specified ID. True if the project contains an with the specified ID. Get the documentId in this project with the specified syntax tree. Get the document in this project with the specified syntax tree. Get the document in this project with the specified document Id. Get the additional document in this project with the specified document Id. Get the analyzer config document in this project with the specified document Id. Tries to get the cached for this project if it has already been created and is still cached. In almost all cases you should call which will either return the cached or create a new one otherwise. Get the for this project asynchronously. Returns the produced , or if the project language of this project doesn't support producing compilations. Determines if the compilation returned by and all its referenced compilation are from fully loaded projects. Gets an object that lists the added, changed and removed documents between this project and the specified project. The project version. This equates to the version of the project file. The version of the most recently modified document. The most recent version of the project, its documents and all dependent projects and documents. The semantic version of this project including the semantics of referenced projects. This version changes whenever the consumable declarations of this project and/or projects it depends on change. The semantic version of this project not including the semantics of referenced projects. This version changes only when the consumable declarations of this project change. Creates a new instance of this project updated to have the new assembly name. Creates a new instance of this project updated to have the new default namespace. Creates a new instance of this project updated to have the specified compilation options. Creates a new instance of this project updated to have the specified parse options. Creates a new instance of this project updated to include the specified project reference in addition to already existing ones. Creates a new instance of this project updated to include the specified project references in addition to already existing ones. Creates a new instance of this project updated to no longer include the specified project reference. Creates a new instance of this project updated to replace existing project references with the specified ones. Creates a new instance of this project updated to include the specified metadata reference in addition to already existing ones. Creates a new instance of this project updated to include the specified metadata references in addition to already existing ones. Creates a new instance of this project updated to no longer include the specified metadata reference. Creates a new instance of this project updated to replace existing metadata reference with the specified ones. Creates a new instance of this project updated to include the specified analyzer reference in addition to already existing ones. Creates a new instance of this project updated to include the specified analyzer references in addition to already existing ones. Creates a new instance of this project updated to no longer include the specified analyzer reference. Creates a new instance of this project updated to replace existing analyzer references with the specified ones. Creates a new document in a new instance of this project. Creates a new document in a new instance of this project. Creates a new document in a new instance of this project. Creates a new additional document in a new instance of this project. Creates a new additional document in a new instance of this project. Creates a new analyzer config document in a new instance of this project. Creates a new instance of this project updated to no longer include the specified document. Creates a new instance of this project updated to no longer include the specified additional document. Creates a new instance of this project updated to no longer include the specified analyzer config document. Get Documents with any changes, including textual and non-textual changes Get Changed Documents: When onlyGetDocumentsWithTextChanges is true, only get documents with text changes; otherwise get documents with any changes i.e. DocumentState changes: , , A models the dependencies between projects in a solution. Computes a new for the addition of additional project references. Computes a new for the addition of additional project references. Must be called on a non-null map. Computes a new for the addition of additional project references. Computes a new for the addition of new projects. Gets the list of projects that this project directly depends on. Gets the list of projects that directly depend on this project. Gets the list of projects that directly or transitively this project depends on Gets the list of projects that directly or transitively depend on this project. Returns all the projects for the solution in a topologically sorted order with respect to their dependencies. Projects that depend on other projects will always show up later in this sequence than the projects they depend on. Returns a sequence of sets, where each set contains items with shared interdependency, and there is no dependency between sets. An identifier that can be used to refer to the same across versions. The system generated unique id. Create a new ProjectId instance. An optional name to make this id easier to recognize while debugging. A class that represents all the arguments necessary to create a new project instance. The unique Id of the project. The version of the project. The name of the project. This may differ from the project's filename. The name of the assembly that this project will create, without file extension. , The language of the project. The path to the project file or null if there is no project file. The path to the output file (module or assembly). The path to the reference assembly output file. The default namespace of the project ("" if not defined, which means global namespace), or null if it is unknown or not applicable. Right now VB doesn't have the concept of "default namespace", but we conjure one in workspace by assigning the value of the project's root namespace to it. So various features can choose to use it for their own purpose. In the future, we might consider officially exposing "default namespace" for VB project (e.g. through a "defaultnamespace" msbuild property) True if this is a submission project for interactive sessions. True if project information is complete. In some workspace hosts, it is possible a project only has partial information. In such cases, a project might not have all information on its files or references. The initial compilation options for the project, or null if the default options should be used. The initial parse options for the source code documents in this project, or null if the default options should be used. The list of source documents initially associated with the project. The project references initially defined for the project. The metadata references initially defined for the project. The analyzers initially associated with this project. The list of non-source documents associated with this project. The list of analyzerconfig documents associated with this project. Type of the host object. Create a new instance of a ProjectInfo. Create a new instance of a ProjectInfo. Create a new instance of a ProjectInfo. type that contains information regarding this project itself but no tree information such as document info The unique Id of the project. The version of the project. The name of the project. This may differ from the project's filename. The name of the assembly that this project will create, without file extension. , The language of the project. The path to the project file or null if there is no project file. The path to the output file (module or assembly). The path to the reference assembly output file. The default namespace of the project. True if this is a submission project for interactive sessions. True if project information is complete. In some workspace hosts, it is possible a project only has partial information. In such cases, a project might not have all information on its files or references. Aliases for the reference. Empty if the reference has no aliases. True if interop types defined in the referenced project should be embedded into the referencing project. The documents in this project. They are sorted by to provide a stable sort for . The additional documents in this project. They are sorted by to provide a stable sort for . The analyzer config documents in this project. They are sorted by to provide a stable sort for . The to be used for analyzer options for specific trees. A recoverable TextAndVersion source that saves its text to temporary storage. Represents a set of projects and their source code documents. The Workspace this solution is associated with. The Id of the solution. Multiple solution instances may share the same Id. The path to the solution file or null if there is no solution file. The solution version. This equates to the solution file's version. A list of all the ids for all the projects contained by the solution. A list of all the projects contained by the solution. The version of the most recently modified project. True if the solution contains a project with the specified project ID. Gets the project in this solution with the specified project ID. If the id is not an id of a project that is part of this solution the method returns null. Gets the associated with an assembly symbol. True if the solution contains the document in one of its projects True if the solution contains the additional document in one of its projects True if the solution contains the analyzer config document in one of its projects Gets the documentId in this solution with the specified syntax tree. Gets the documentId in this solution with the specified syntax tree. Gets the document in this solution with the specified document ID. Gets the additional document in this solution with the specified document ID. Gets the analyzer config document in this solution with the specified document ID. Gets the document in this solution with the specified syntax tree. Creates a new solution instance that includes a project with the specified language and names. Returns the new project. Creates a new solution instance that includes a project with the specified language and names. Create a new solution instance that includes a project with the specified project information. Create a new solution instance without the project specified. Creates a new solution instance with the project specified updated to have the new assembly name. Creates a new solution instance with the project specified updated to have the output file path. Creates a new solution instance with the project specified updated to have the reference assembly output file path. Creates a new solution instance with the project specified updated to have the default namespace. Creates a new solution instance with the project specified updated to have the name. Creates a new solution instance with the project specified updated to have the project file path. Create a new solution instance with the project specified updated to have the specified compilation options. Create a new solution instance with the project specified updated to have the specified parse options. Update a project as a result of option changes. this is a temporary workaround until editorconfig becomes real part of roslyn solution snapshot. until then, this will explicitly fork current solution snapshot Create a new solution instance with the project specified updated to have the specified hasAllInformation. Create a new solution instance with the project specified updated to include the specified project reference. Create a new solution instance with the project specified updated to include the specified project references. Create a new solution instance with the project specified updated to no longer include the specified project reference. Create a new solution instance with the project specified updated to contain the specified list of project references. Creates a new solution instance with the project documents in the order by the specified document ids. The specified document ids must be the same as what is already in the project; no adding or removing is allowed. Create a new solution instance with the project specified updated to include the specified metadata reference. Create a new solution instance with the project specified updated to include the specified metadata references. Create a new solution instance with the project specified updated to no longer include the specified metadata reference. Create a new solution instance with the project specified updated to include only the specified metadata references. Create a new solution instance with the project specified updated to include the specified analyzer reference. Create a new solution instance with the project specified updated to include the specified analyzer references. Create a new solution instance with the project specified updated to no longer include the specified analyzer reference. Create a new solution instance with the project specified updated to include only the specified analyzer references. Creates a new solution instance with the corresponding project updated to include a new document instance defined by its name and text. Creates a new solution instance with the corresponding project updated to include a new document instance defined by its name and text. Creates a new solution instance with the corresponding project updated to include a new document instance defined by its name and root . Creates a new solution instance with the project updated to include a new document with the arguments specified. Create a new solution instance with the corresponding project updated to include a new document instanced defined by the document info. Create a new instance with the corresponding s updated to include the documents specified by . A new with the documents added. Creates a new solution instance with the corresponding project updated to include a new additional document instance defined by its name and text. Creates a new solution instance with the corresponding project updated to include a new additional document instance defined by its name and text. Creates a new solution instance with the corresponding project updated to include a new analyzer config document instance defined by its name and text. Creates a new Solution instance that contains a new compiler configuration document like a .editorconfig file. Creates a new solution instance that no longer includes the specified document. Creates a new solution instance that no longer includes the specified additional document. Creates a new solution instance with the document specified updated to have the new name. Creates a new solution instance with the document specified updated to be contained in the sequence of logical folders. Creates a new solution instance with the document specified updated to have the specified file path. Creates a new solution instance with the document specified updated to have the text specified. Creates a new solution instance with the additional document specified updated to have the text specified. Creates a new solution instance with the analyzer config document specified updated to have the text supplied by the text loader. Creates a new solution instance with the document specified updated to have the text and version specified. Creates a new solution instance with the additional document specified updated to have the text and version specified. Creates a new solution instance with the analyzer config document specified updated to have the text and version specified. Creates a new solution instance with the document specified updated to have a syntax tree rooted by the specified syntax node. Creates a new solution instance with the document specified updated to have the source code kind specified. Creates a new solution instance with the document specified updated to have the text supplied by the text loader. Creates a new solution instance with the additional document specified updated to have the text supplied by the text loader. Creates a new solution instance with the analyzer config document specified updated to have the text supplied by the text loader. Creates a branch of the solution that has its compilations frozen in whatever state they are in at the time, assuming a background compiler is busy building this compilations. A compilation for the project containing the specified document id will be guaranteed to exist with at least the syntax tree for the document. This not intended to be the public API, use Document.WithFrozenPartialSemantics() instead. Gets a copy of the solution isolated from the original so that they do not share computed state. Use isolated solutions when doing operations that are likely to access a lot of text, syntax trees or compilations that are unlikely to be needed again after the operation is done. When the isolated solution is reclaimed so will the computed state. Creates a new solution instance with all the documents specified updated to have the same specified text. Gets an objects that lists the added, changed and removed projects between this solution and the specified solution. Gets the set of s in this with a that matches the given file path. Gets a that details the dependencies between projects for this solution. Returns the options that should be applied to this solution. This is equivalent to when the instance was created. An identifier that can be used to refer to the same Solution across versions. The unique id of the solution. Create a new Solution Id An optional name to make this id easier to recognize while debugging. A class that represents all the arguments necessary to create a new solution instance. The unique Id of the solution. The version of the solution. The path to the solution file, or null if there is no solution file. A list of projects initially associated with the solution. Create a new instance of a SolutionInfo. type that contains information regarding this solution itself but no tree information such as project info The unique Id of the solution. The version of the solution. The path to the solution file, or null if there is no solution file. This class basically holds onto a set of services and gets reused across solution instances. Represents a set of projects and their source code documents. this is a green node of Solution like ProjectState/DocumentState are for Project and Document. Tracks the changes made to a project and provides the facility to get a lazily built compilation for that project. As the compilation is being built, the partial results are stored as well so that they can be used in the 'in progress' workspace snapshot. Access via the and methods. Creates a tracker for the provided project. The tracker will be in the 'empty' state and will have no extra information beyond the project itself. Returns true if this tracker currently either points to a compilation, has an in-progress compilation being computed, or has a skeleton reference. Note: this is simply a weak statement about the tracker at this exact moment in time. Immediately after this returns the tracker might change and may no longer have a final compilation (for example, if the retainer let go of it) or might not have an in-progress compilation (for example, if the background compiler finished with it). Because of the above limitations, this should only be used by clients as a weak form of information about the tracker. For example, a client may see that a tracker has no compilation and may choose to throw it away knowing that it could be reconstructed at a later point if necessary. Creates a new instance of the compilation info, retaining any already built compilation state as the now 'old' state Creates a fork with the same final project. Tries to get the latest snapshot of the compilation without waiting for it to be fully built. This method takes advantage of the progress side-effect produced during . It will either return the already built compilation, any in-progress compilation or any known old compilation in that order of preference. The compilation state that is returned will have a compilation that is retained so that it cannot disappear. Gets the final compilation if it is available. Builds the compilation matching the project state. In the process of building, also produce in progress snapshots that can be accessed from other threads. Add all appropriate references to the compilation and set it as our final compilation state. Get a metadata reference to this compilation info's compilation with respect to another project. For cross language references produce a skeletal assembly. If the compilation is not available, it is built. If a skeletal assembly reference is needed and does not exist, it is also built. Attempts to get (without waiting) a metadata reference to a possibly in progress compilation. Only actual compilation references are returned. Could potentially return null if nothing can be provided. Gets a metadata reference to the metadata-only-image corresponding to the compilation. check whether the compilation contains any declaration symbol from syntax trees with given name check whether the compilation contains any declaration symbol from syntax trees with given name get all syntax trees that contain declaration node with the given name The base type of all states. The state of a starts at , and then will progress through the other states until it finally reaches . The base that starts with everything empty. A strong reference to the declaration-only compilation. This compilation isn't used to produce symbols, nor does it have any references. It just holds the declaration table alive. The best compilation that is available. May be an in-progress, full declaration, or a final compilation. Specifies whether and all compilations it depends on contain full information or not. This can return null if the state isn't at the point where it would know, and it's necessary to transition to to figure that out. The final compilation if available, otherwise an empty . A state where we are holding onto a previously built compilation, and have a known set of transformations that could get us to a more final state. Declaration-only state that has no associated references or symbols. just declaration table only. A built compilation for the tracker that contains the fully built DeclarationTable, but may not have references initialized The final state a compilation tracker reaches. The is available, as well as the real . branch id of this solution currently, it only supports one level of branching. there is a primary branch of a workspace and all other branches that are branched from the primary branch. one still can create multiple forked solutions from an already branched solution, but versions among those can't be reliably used and compared. version only has a meaning between primary solution and branched one or between solutions from same branch. The Workspace this solution is associated with. The Id of the solution. Multiple solution instances may share the same Id. The path to the solution file or null if there is no solution file. The solution version. This equates to the solution file's version. A list of all the ids for all the projects contained by the solution. The version of the most recently modified project. True if the solution contains a project with the specified project ID. True if the solution contains the document in one of its projects True if the solution contains the additional document in one of its projects True if the solution contains the analyzer config document in one of its projects Gets the associated with an assembly symbol. Create a new solution instance that includes a project with the specified project information. Create a new solution instance without the project specified. Creates a new solution instance with the project specified updated to have the new assembly name. Creates a new solution instance with the project specified updated to have the output file path. Creates a new solution instance with the project specified updated to have the output file path. Creates a new solution instance with the project specified updated to have the default namespace. Creates a new solution instance with the project specified updated to have the name. Creates a new solution instance with the project specified updated to have the project file path. Create a new solution instance with the project specified updated to have the specified compilation options. Create a new solution instance with the project specified updated to have the specified parse options. Update a new solution instance with a fork of the specified project. this is a temporary workaround until editorconfig becomes real part of roslyn solution snapshot. until then, this will explicitly fork current solution snapshot Create a new solution instance with the project specified updated to have the specified hasAllInformation. Create a new solution instance with the project specified updated to include the specified project references. Create a new solution instance with the project specified updated to no longer include the specified project reference. Create a new solution instance with the project specified updated to contain the specified list of project references. Creates a new solution instance with the project documents in the order by the specified document ids. The specified document ids must be the same as what is already in the project; no adding or removing is allowed. Create a new solution instance with the project specified updated to include the specified metadata reference. Create a new solution instance with the project specified updated to include the specified metadata references. Create a new solution instance with the project specified updated to no longer include the specified metadata reference. Create a new solution instance with the project specified updated to include only the specified metadata references. Create a new solution instance with the project specified updated to include the specified analyzer reference. Create a new solution instance with the project specified updated to include the specified analyzer references. Create a new solution instance with the project specified updated to no longer include the specified analyzer reference. Create a new solution instance with the project specified updated to include only the specified analyzer references. Create a new solution instance with the corresponding projects updated to include new documents defined by the document info. Core helper that takes a set of s and does the application of the appropriate documents to each project. The set of documents to add. Returns the new with the documents added, and the needed as well. Creates a new solution instance that no longer includes the specified document. Creates a new solution instance that no longer includes the specified additional document. Creates a new solution instance with the document specified updated to have the specified name. Creates a new solution instance with the document specified updated to be contained in the sequence of logical folders. Creates a new solution instance with the document specified updated to have the specified file path. Creates a new solution instance with the document specified updated to have the text specified. Creates a new solution instance with the additional document specified updated to have the text specified. Creates a new solution instance with the document specified updated to have the text specified. Creates a new solution instance with the document specified updated to have the text and version specified. Creates a new solution instance with the additional document specified updated to have the text and version specified. Creates a new solution instance with the analyzer config document specified updated to have the text and version specified. Creates a new solution instance with the document specified updated to have a syntax tree rooted by the specified syntax node. Creates a new solution instance with the document specified updated to have the source code kind specified. Creates a new solution instance with the additional document specified updated to have the text supplied by the text loader. Creates a new solution instance with the analyzer config document specified updated to have the text supplied by the text loader. Creates a new snapshot with an updated project and an action that will produce a new compilation matching the new project out of an old compilation. All dependent projects are fixed-up if the change to the new project affects its public metadata, and old dependent compilations are forgotten. Gets the set of s in this with a that matches the given file path. Gets a copy of the solution isolated from the original so that they do not share computed state. Use isolated solutions when doing operations that are likely to access a lot of text, syntax trees or compilations that are unlikely to be needed again after the operation is done. When the isolated solution is reclaimed so will the computed state. Creates a branch of the solution that has its compilations frozen in whatever state they are in at the time, assuming a background compiler is busy building this compilations. A compilation for the project containing the specified document id will be guaranteed to exist with at least the syntax tree for the document. This not intended to be the public API, use Document.WithFrozenPartialSemantics() instead. Creates a new solution instance with all the documents specified updated to have the same specified text. Returns the compilation for the specified . Can return when the project does not support compilations. Returns the compilation for the specified . Can return when the project does not support compilations. Return reference completeness for the given project and all projects this references. Symbols need to be either or . Get a metadata reference for the project's compilation Attempt to get the best readily available compilation for the project. It may be a partially built compilation. Gets a that details the dependencies between projects for this solution. A class that represents both a source text and its version stamp. The source text. The version of the source text An optional file path that identifies the origin of the source text Create a new TextAndVersion instance. The text The version An optional file path that identifies the original of the source text. A bitwise combination of the enumeration values to use when computing differences with . Since computing differences can be slow with large data sets, you should not use the Character type unless the given text is relatively small. Compute the line difference. Compute the word difference. Compute the character difference. The project this document belongs to. The document's identifier. Many document instances may share the same ID, but only one document in a solution may have that ID. The path to the document file or null if there is no document file. The name of the document. The sequence of logical folders the document is contained in. A associated with this document Get the current text for the document if it is already loaded and available. Gets the version of the document's text if it is already loaded and available. Gets the current text for the document asynchronously. Fetches the current text for the document synchronously. This is internal for the same reason is internal: we have specialized cases where we need it, but we worry that making it public will do more harm than good. Gets the version of the document's text. Fetches the current version for the document synchronously. This is internal for the same reason is internal: we have specialized cases where we need it, but we worry that making it public will do more harm than good. Gets the version of the document's top level signature. True if the info of the document change (name, folders, file path; not the content) Indicates kind of a Indicates a regular source Indicates an Indicates an A direct reference to our source text. This is only kept around in specialized scenarios. Specifically, we keep this around when a document is opened. By providing this we can allow clients to easily get to the text of the document in a non-blocking fashion if that's all that they need. Note: this facility does not extend to getting the version as well. That's because the version of a document depends on both the current source contents and the contents from the previous version of the document. (i.e. if the contents are the same, then we will preserve the same version, otherwise we'll move the version forward). Because determining the version depends on comparing text, and because getting the old text may block, we do not have the ability to know the version of the document up front, and instead can only retrieve is asynchronously through . A associated with this document A class that represents access to a source text and its version from a storage location. Load a text and a version of the document in the workspace. Load a text and a version of the document in the workspace. Creates a new TextLoader from an already existing source text and version. Creates a TextLoader from a SourceTextContainer and version. The text obtained from the loader will be the current text of the container at the time the loader is accessed. A class that represents both a tree and its top level signature version The syntax tree The version of the top level signature of the tree VersionStamp should be only used to compare versions returned by same API. global counter to avoid collision within same session. it starts with a big initial number just for a clarity in debugging time stamp indicate whether there was a collision on same item unique version in same session Creates a new instance of a VersionStamp. Creates a new instance of a version stamp based on the specified DateTime. compare two different versions and return either one of the versions if there is no collision, otherwise, create a new version that can be used later to compare versions between different items Gets a new VersionStamp that is guaranteed to be newer than its base one this should only be used for same item to move it to newer version Returns the serialized text form of the VersionStamp. check whether given persisted version is re-usable True if this VersionStamp is newer than the specified one. Gets the documents from the corresponding workspace's current solution that are associated with the source text's container, updated to contain the same text as the source if necessary. Gets the document from the corresponding workspace's current solution that is associated with the source text's container in its current project context, updated to contain the same text as the source if necessary. Gets the documents from the corresponding workspace's current solution that are associated with the text container. Gets the document from the corresponding workspace's current solution that is associated with the text container in its current project context. 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 UTF8 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 workspace provides access to a active set of source code projects and documents and their associated syntax trees, compilations and semantic models. A workspace has a current solution that is an immutable snapshot of the projects and documents. This property may change over time as the workspace is updated either from live interactions in the environment or via call to the workspace's method. Constructs a new workspace instance. The this workspace uses A string that can be used to identify the kind of workspace. Usually this matches the name of the class. Sets an internal logger that will receive some messages. An action called to write a single line to the log. Services provider by the host for implementing workspace features. primary branch id that current solution has Override this property if the workspace supports partial semantics for documents. The kind of the workspace. This is generally if originating from the host environment, but may be any other name used for a specific kind of workspace. Create a new empty solution instance associated with this workspace. Create a new empty solution instance associated with this workspace. The current solution. The solution is an immutable model of the current set of projects and source documents. It provides access to source text, syntax trees and semantics. This property may change as the workspace reacts to changes in the environment or after is called. Sets the of this workspace. This method does not raise a event. This method does not guarantee that linked files will have the same contents. Callers should enforce that policy before passing in the new solution. Gets or sets the set of all global options. Executes an action as a background task, as part of a sequential queue of tasks. Execute a function as a background task, as part of a sequential queue of tasks. Override this method to act immediately when the text of a document has changed, as opposed to waiting for the corresponding workspace changed event to fire asynchronously. Override this method to act immediately when a document is closing, as opposed to waiting for the corresponding workspace changed event to fire asynchronously. Clears all solution data and empties the current solution. This method is called when a solution is cleared. Override this method if you want to do additional work when a solution is cleared. Call the base method at the end of your method. This method is called when an individual project is removed. Override this method if you want to do additional work when a project is removed. Call the base method at the end of your method. This method is called to clear an individual document is removed. Override this method if you want to do additional work when a document is removed. Call the base method at the end of your method. Disposes this workspace. The workspace can longer be used after it is disposed. Call this method when the workspace is disposed. Override this method to do additional work when the workspace is disposed. Call this method at the end of your method. Call this method to respond to a solution being opened in the host environment. Call this method to respond to a solution being reloaded in the host environment. This method is called when the solution is removed from the workspace. Override this method if you want to do additional work when the solution is removed. Call the base method at the end of your method. Call this method to respond to a solution being removed/cleared/closed in the host environment. Call this method to respond to a project being added/opened in the host environment. Call this method to respond to a project being reloaded in the host environment. Call this method to respond to a project being removed from the host environment. Currently projects can always be removed, but this method still exists because it's protected and we don't want to break people who may have derived from and either called it, or overridden it. Call this method when a project's assembly name is changed in the host environment. Call this method when a project's output file path is changed in the host environment. Call this method when a project's output ref file path is changed in the host environment. Call this method when a project's name is changed in the host environment. Call this method when a project's default namespace is changed in the host environment. Call this method when a project's compilation options are changed in the host environment. Call this method when a project's parse options are changed in the host environment. Call this method when a project reference is added to a project in the host environment. Call this method when a project reference is removed from a project in the host environment. Call this method when a metadata reference is added to a project in the host environment. Call this method when a metadata reference is removed from a project in the host environment. Call this method when an analyzer reference is added to a project in the host environment. Call this method when an analyzer reference is removed from a project in the host environment. Call this method when status of project has changed to incomplete. See for more information. Call this method when a document is added to a project in the host environment. Call this method when multiple document are added to one or more projects in the host environment. Call this method when a document is reloaded in the host environment. Call this method when a document is removed from a project in the host environment. Call this method when the text of a document is changed on disk. Call this method when the text of a additional document is changed on disk. Call this method when the text of a analyzer config document is changed on disk. Call this method when the document info changes, such as the name, folders or file path. Call this method when the text of a document is updated in the host environment. Call this method when the text of an additional document is updated in the host environment. Call this method when the text of an analyzer config document is updated in the host environment. When a s text is changed, we need to make sure all of the linked files also have their content updated in the new solution before applying it to the workspace to avoid the workspace having solutions with linked files where the contents do not match. Call this method when the SourceCodeKind of a document changes in the host environment. Call this method when an additional document is added to a project in the host environment. Call this method when an additional document is removed from a project in the host environment. Call this method when an analyzer config document is added to a project in the host environment. Call this method when an analyzer config document is removed from a project in the host environment. Updates all projects to properly reference other projects as project references instead of metadata references. Determines if the specific kind of change is supported by the method. Returns if a reference to referencedProject can be added to referencingProject. otherwise. Apply changes made to a solution back to the workspace. The specified solution must be one that originated from this workspace. If it is not, or the workspace has been updated since the solution was obtained from the workspace, then this method returns false. This method will still throw if the solution contains changes that are not supported according to the method. Thrown if the solution contains changes not supported according to the method. This method is called during for each project that has been added, removed or changed. Override this method if you want to modify how project changes are applied. This method is called during to add a project to the current solution. Override this method to implement the capability of adding projects. This method is called during to remove a project from the current solution. Override this method to implement the capability of removing projects. This method is called during to change the compilation options. Override this method to implement the capability of changing compilation options. This method is called during to change the parse options. Override this method to implement the capability of changing parse options. This method is called during to add a project reference to a project. Override this method to implement the capability of adding project references. This method is called during to remove a project reference from a project. Override this method to implement the capability of removing project references. This method is called during to add a metadata reference to a project. Override this method to implement the capability of adding metadata references. This method is called during to remove a metadata reference from a project. Override this method to implement the capability of removing metadata references. This method is called during to add an analyzer reference to a project. Override this method to implement the capability of adding analyzer references. This method is called during to remove an analyzer reference from a project. Override this method to implement the capability of removing analyzer references. This method is called during to add a new document to a project. Override this method to implement the capability of adding documents. This method is called during to remove a document from a project. Override this method to implement the capability of removing documents. This method is called to change the text of a document. Override this method to implement the capability of changing document text. This method is called to change the info of a document. Override this method to implement the capability of changing a document's info. This method is called during to add a new additional document to a project. Override this method to implement the capability of adding additional documents. This method is called during to remove an additional document from a project. Override this method to implement the capability of removing additional documents. This method is called to change the text of an additional document. Override this method to implement the capability of changing additional document text. This method is called during to add a new analyzer config document to a project. Override this method to implement the capability of adding analyzer config documents. This method is called during to remove an analyzer config document from a project. Override this method to implement the capability of removing analyzer config documents. This method is called to change the text of an analyzer config document. Override this method to implement the capability of changing analyzer config document text. Throws an exception is the solution is not empty. Throws an exception if the project is not part of the current solution. Throws an exception is the project is part of the current solution. Throws an exception if a project does not have a specific project reference. Throws an exception if a project already has a specific project reference. Throws an exception if project has a transitive reference to another project. Throws an exception if a project does not have a specific metadata reference. Throws an exception if a project already has a specific metadata reference. Throws an exception if a project does not have a specific analyzer reference. Throws an exception if a project already has a specific analyzer reference. Throws an exception if a document is not part of the current solution. Throws an exception if an additional document is not part of the current solution. Throws an exception if an analyzer config is not part of the current solution. Throws an exception if a document is already part of the current solution. Throws an exception if an additional document is already part of the current solution. Throws an exception if the analyzer config document is already part of the current solution. Gets the name to use for a project in an error message. Gets the name to use for a document in an error message. Gets the name to use for an additional document in an error message. Gets the name to use for an analyzer document in an error message. A class that responds to text buffer changes Tracks the document ID in the current context for a source text container for an opened text buffer. For each entry in this map, there must be a corresponding entry in where the document ID in current context is one of associated document IDs. Tracks all the associated document IDs for a source text container for an opened text buffer. True if this workspace supports manually opening and closing documents. True if this workspace supports manually changing the active context document of a text buffer by calling . Open the specified document in the host environment. Close the specified document in the host environment. Open the specified additional document in the host environment. Close the specified additional document in the host environment. Open the specified analyzer config document in the host environment. Close the specified analyzer config document in the host environment. Determines if the document is currently open in the host environment. Gets a list of the currently opened documents. Gets the ids for documents associated with a text container. Documents are normally associated with a text container when the documents are opened. Gets the id for the document associated with the given text container in its current context. Documents are normally associated with a text container when the documents are opened. Finds the related to the given that is in the current context. If the is currently closed, then it is returned directly. If it is open, then this returns the same result that would return for the . Call this method to tell the host environment to change the current active context to this document. Only supported if returns true. Call this method when a document has been made the active context in the host environment. The DocumentId of the current context document attached to the textContainer, if any. This method is called during OnSolutionReload. Override this method if you want to manipulate the reloaded solution. Update a project as a result of option changes. this is a temporary workaround until editorconfig becomes real part of roslyn solution snapshot. until then, this will explicitly move current solution forward when such event happened An event raised whenever the current solution is changed. An event raised whenever the workspace or part of its solution model fails to access a file or other external resource. An event that is fired when a documents is opened in the editor. An event that is fired when a document is closed in the editor. An event that is fired when the active context document associated with a buffer changes. Gets the workspace associated with the specific text container. Register a correspondence between a text container and a workspace. Unregister a correspondence between a text container and a workspace. Returns a for a given text container. The describing any kind of workspace change. When linked files are edited, one document change event is fired per linked file. All of these events contain the same , and they all contain the same . This is so that we can trigger document change events on all affected documents without reporting intermediate states in which the linked file contents do not match. If linked documents are being changed, there may be multiple events with the same and . If linked documents are being changed, there may be multiple events with the same and . The current solution changed for an unspecified reason. A solution was added to the workspace. The current solution was removed from the workspace. The current solution was cleared of all projects and documents. The current solution was reloaded. A project was added to the current solution. A project was removed from the current solution. A project in the current solution was changed. A project in the current solution was reloaded. A document was added to the current solution. A document was removed from the current solution. A document in the current solution was reloaded. A document in the current solution was changed. When linked files are edited, one event is fired per linked file. All of these events contain the same OldSolution, and they all contain the same NewSolution. This is so that we can trigger document change events on all affected documents without reporting intermediate states in which the linked file contents do not match. Each event does not represent an incremental update from the previous event in this special case. An additional document was added to the current solution. An additional document was removed from the current solution. An additional document in the current solution was reloaded. An additional document in the current solution was changed. The document in the current solution had is info changed; name, folders, filepath An analyzer config document was added to the current solution. An analyzer config document was removed from the current solution. An analyzer config document in the current solution was reloaded. An analyzer config document in the current solution was changed. Known workspace kinds 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. 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. 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. 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 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. 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. 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 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. 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. 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. 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. Set by the host to a fail fast trigger, if the host desires to crash the process on a fatal exception. Set by the host to a fail fast trigger, if the host desires to NOT crash the process on a non fatal exception. Use in an exception filter to report a fatal error. Unless the exception is it calls . The exception is passed through (the method returns false). False to avoid catching the exception. Use in an exception filter to report a non fatal error. Unless the exception is it calls . The exception isn't passed through (the method returns true). True to catch the exception. Use in an exception filter to report a fatal error. Unless the exception is it calls . The exception is passed through (the method returns false). False to avoid catching the exception. Use in an exception filter to report a fatal error. Calls and passes the exception through (the method returns false). False to avoid catching the exception. Report a non-fatal 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. Report a non-fatal error like but propagates the exception. False to propagate the exception. Report a non-fatal error like but propagates the exception. False to propagate the exception. 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. 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. An AnnotationTable helps you attach your own annotation types/instances to syntax. It maintains a map between your instances and actual SyntaxAnnotation's used to annotate the nodes and offers an API that matches the true annotation API on SyntaxNode. The table controls the lifetime of when you can find and retrieve your annotations. You won't be able to find your annotations via HasAnnotations/GetAnnotations unless you use the same annotation table for these operations that you used for the WithAdditionalAnnotations operation. Your custom annotations are not serialized with the syntax tree, so they won't move across boundaries unless the same AnnotationTable is available on both ends. also, note that this table is not thread safe. Represents a value that can be retrieved synchronously or asynchronously by many clients. The value will be computed on-demand the moment the first client asks for it. While being computed, more clients can request the value. As long as there are outstanding clients the underlying computation will proceed. If all outstanding clients cancel their request then the underlying value computation will be cancelled as well. Creators of an can specify whether the result of the computation is cached for future requests or not. Choosing to not cache means the computation functions are kept alive, whereas caching means the value (but not functions) are kept alive once complete. The underlying function that starts an asynchronous computation of the resulting value. Null'ed out once we've computed the result and we've been asked to cache it. Otherwise, it is kept around in case the value needs to be computed again. The underlying function that starts an synchronous computation of the resulting value. Null'ed out once we've computed the result and we've been asked to cache it, or if we didn't get any synchronous function given to us in the first place. Whether or not we should keep the value around once we've computed it. The Task that holds the cached result. Mutex used to protect reading and writing to all mutable objects and fields. Traces indicate that there's negligible contention on this lock, hence we can save some memory by using a single lock for all AsyncLazy instances. Only trivial and non-reentrant work should be done while holding the lock. The hash set of all currently outstanding asynchronous requests. Null if there are no requests, and will never be empty. If an asynchronous request is active, the CancellationTokenSource that allows for cancelling the underlying computation. Whether a computation is active or queued on any thread, whether synchronous or asynchronous. Creates an AsyncLazy that always returns the value, analogous to . Creates an AsyncLazy that supports both asynchronous computation and inline synchronous computation. A function called to start the asynchronous computation. This function should be cheap and non-blocking. A function to do the work synchronously, which is allowed to block. This function should not be implemented by a simple Wait on the asynchronous value. If that's all you are doing, just don't pass a synchronous function in the first place. Whether the result should be cached once the computation is complete. Takes the lock for this object and if acquired validates the invariants of this class. This inherits from to avoid allocating two objects when we can just use one. The public surface area of should probably be avoided in favor of the public methods on this class for correct behavior. The associated with this request. This field will be initialized before any cancellation is observed from the token. NOTE: Only use if you truly need a BK-tree. If you just want to compare words, use the type instead. An implementation of a Burkhard-Keller tree. Introduced in: 'Some approaches to best-match file searching.' Communications of the ACM CACM Volume 16 Issue 4, April 1973 Pages 230-236 http://dl.acm.org/citation.cfm?doid=362003.362025 Where the child node can be found in . The string this node corresponds to. Specifically, this span is the range of for that string. How many child edges this node has. Where the first edge can be found in . The edges are in the range _edges[FirstEdgeIndex, FirstEdgeIndex + EdgeCount) Obtains the value for the specified key from a dictionary, or adds a new value to the dictionary where the key did not previously exist. The type of key stored by the dictionary. The type of value stored by the dictionary. The type of argument supplied to the value factory. The variable or field to atomically update if the specified is not in the dictionary. The key for the value to retrieve or add. The function to execute to obtain the value to insert into the dictionary if the key is not found. The argument to pass to the value factory. The value obtained from the dictionary or if it was not present. Throws a non-accessible exception if the provided value is null. This method executes in all builds Throws a non-accessible exception if the provided value is false. This method executes in all builds Throws a non-accessible exception if the provided value is true. This method executes in all builds. NOTE: Only use if you truly need an edit distance. If you just want to compare words, use the type instead. Implementation of the Damerau-Levenshtein edit distance algorithm from: An Extension of the String-to-String Correction Problem: Published in Journal of the ACM (JACM) Volume 22 Issue 2, April 1975. Important, unlike many edit distance algorithms out there, this one implements a true metric that satisfies the triangle inequality. (Unlike the "Optimal String Alignment" or "Restricted string edit distance" solutions which do not). This means this edit distance can be used in other domains that require the triangle inequality (like BKTrees). Specifically, this implementation satisfies the following inequality: D(x, y) + D(y, z) >= D(x, z) (where D is the edit distance). A covariant interface form of that lets you re-cast an to a more base type. This can include types that do not implement if you want to prevent a caller from accidentally disposing directly. Gets the target object. This call is not valid after is called. If this property or the target object is used concurrently with a call to , it is possible for the code to be using a disposed object. After the current instance is disposed, this property throws . However, the exact time when this property starts throwing after is called is unspecified; code is expected to not use this property or the object it returns after any code invokes . The target object. Increments the reference count for the disposable object, and returns a new disposable reference to it. The returned object is an independent reference to the same underlying object. Disposing of the returned value multiple times will only cause the reference count to be decreased once. A new pointing to the same underlying object, if it has not yet been disposed; otherwise, if this reference to the underlying object has already been disposed. 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. A lightweight mutual exclusion object which supports waiting with cancellation and prevents recursion (i.e. you may not call Wait if you already hold the lock) The provides a lightweight mutual exclusion class that doesn't use Windows kernel synchronization primitives. The implementation is distilled from the workings of The basic idea is that we use a regular sync object (Monitor.Enter/Exit) to guard the setting of an 'owning thread' field. If, during the Wait, we find the lock is held by someone else then we register a cancellation callback and enter a "Monitor.Wait" loop. If the cancellation callback fires, then it "pulses" all the waiters to wake them up and check for cancellation. Waiters are also "pulsed" when leaving the lock. All public members of are thread-safe and may be used concurrently from multiple threads. A synchronization object to protect access to the field and to be pulsed when is called and during cancellation. The of the thread that holds the lock. Zero if no thread is holding the lock. Constructor. If false (the default), then the class allocates an internal object to be used as a sync lock. If true, then the sync lock object will be the NonReentrantLock instance itself. This saves an allocation but a client may not safely further use this instance in a call to Monitor.Enter/Exit or in a "lock" statement. Shared factory for use in lazy initialization. Blocks the current thread until it can enter the , while observing a . Recursive locking is not supported. i.e. A thread may not call Wait successfully twice without an intervening . The token to observe. was canceled. The caller already holds the lock Exit the mutual exclusion. The calling thread must currently hold the lock. The lock is not currently held by the calling thread. Determine if the lock is currently held by the calling thread. True if the lock is currently held by the calling thread. Throw an exception if the lock is not held by the calling thread. The lock is not currently held by the calling thread. Checks if the lock is currently held. Checks if the lock is currently held by the calling thread. Take ownership of the lock (by the calling thread). The lock may not already be held by any other code. Release ownership of the lock. The lock must already be held by the calling thread. Action object passed to a cancellation token registration. Callback executed when a cancellation token is canceled during a Wait. The syncLock that protects a instance. Since we want to avoid boxing the return from , this type must be public. A reference-counting wrapper which allows multiple uses of a single disposable object in code, which is deterministically released (by calling ) when the last reference is disposed. Each instance of represents a counted reference (also referred to as a reference in the following documentation) to a target object. Each of these references has a lifetime, starting when it is constructed and continuing through its release. During this time, the reference is considered alive. Each reference which is alive owns exactly one reference to the target object, ensuring that it will not be disposed while still in use. A reference is released through either of the following actions: The reference is explicitly released by a call to . The reference is no longer in use by managed code and gets reclaimed by the garbage collector. While each instance of should be explicitly disposed when the object is no longer needed by the code owning the reference, this implementation will not leak resources in the event one or more callers fail to do so. When all references to an object are explicitly released (i.e. by calling ), the target object will itself be deterministically released by a call to when the last reference to it is released. However, in the event one or more references is not explicitly released, the underlying object will still become eligible for non-deterministic release (i.e. finalization) as soon as each reference to it is released by one of the two actions described previously. When using , certain steps must be taken to ensure the target object is not disposed early. Use consistently. In other words, do not mix code using reference-counted wrappers with code that references to the target directly. Only use the constructor one time per target object. Additional references to the same target object must only be obtained by calling . Do not call on the target object directly. It will be called automatically at the appropriate time, as described above. All public methods on this type adhere to their pre- and post-conditions and will not invalidate state even in concurrent execution. The type of disposable object. The target of this reference. This value is initialized to a non- value in the constructor, and set to when the current reference is disposed. This value is only cleared in order to support cases where one or more references is garbage collected without having called. The boxed reference count, which is shared by all references with the same object. This field serves as the synchronization object for the current type, since it is shared among all counted reference to the same target object. Accesses to should only occur when this object is locked. PERF DEV NOTE: A concurrent (but complex) implementation of this type with identical semantics is available in source control history. The use of exclusive locks was not causing any measurable performance overhead even on 28-thread machines at the time this was written. Initializes a new reference counting wrapper around an object. The reference count is initialized to 1. The object owned by this wrapper. If is . Gets the target object. This call is not valid after is called. If this property or the target object is used concurrently with a call to , it is possible for the code to be using a disposed object. After the current instance is disposed, this property throws . However, the exact time when this property starts throwing after is called is unspecified; code is expected to not use this property or the object it returns after any code invokes . The target object. Increments the reference count for the disposable object, and returns a new disposable reference to it. The returned object is an independent reference to the same underlying object. Disposing of the returned value multiple times will only cause the reference count to be decreased once. A new pointing to the same underlying object, if it has not yet been disposed; otherwise, if this reference to the underlying object has already been disposed. Provides the implementation for and . Releases the current reference, causing the underlying object to be disposed if this was the last reference. After this instance is disposed, the method can no longer be used to object a new reference to the target, even if other references to the target object are still in use. Represents a weak reference to a which is capable of obtaining a new counted reference up until the point when the object is no longer accessible. DO NOT DISPOSE OF THE TARGET. Increments the reference count for the disposable object, and returns a new disposable reference to it. Unlike , this method is capable of adding a reference to the underlying instance all the way up to the point where it is finally disposed. The returned object is an independent reference to the same underlying object. Disposing of the returned value multiple times will only cause the reference count to be decreased once. A new pointing to the same underlying object, if it has not yet been disposed; otherwise, if the underlying object has already been disposed. Implements a reference-counted cache, where key/value pairs are associated with a count. When the count of a pair goes to zero, the value is evicted. Values can also be explicitly evicted at any time. In that case, any new calls to will return a new value, and the existing holders of the evicted value will still dispose it once they're done with it. Container for a factory. Factory object that may be used for lazy initialization. Creates AsyncSemaphore instances with an initial count of 1. schedules task to run in sequence. An object to synchronize reads/writes of all mutable fields of this class. this represents soft crash request compared to hard crash which will bring down VS. by soft crash, it means everything same as hard crash except it should use NFW and info bar to inform users about unexpected condition instead of killing VS as traditional crash did. in other words, no one should ever try to recover from this exception. but they must try to not hard crash. this exception is based on cancellation exception since, in Roslyn code, cancellation exception is so far only safest exception to throw without worrying about crashing VS 99%. there is still 1% case it will bring down VS and those places should be guarded on this exception as we find such place. for now, this is an opt-in based. if a feature wants to move to soft crash (ex, OOP), one should catch exception and translate that to this exception and then add handler which report NFW and info bar in their code path and make sure it doesn't bring down VS. as we use soft-crash in more places, we should come up with more general framework. Whether or words should be considered similar if one is contained within the other (regardless of edit distance). For example if is true then IService would be considered similar to IServiceFactory despite the edit distance being quite high at 7. Returns true if 'originalText' and 'candidateText' are likely a misspelling of each other. Returns false otherwise. If it is a likely misspelling a similarityWeight is provided to help rank the match. Lower costs mean it was a better match. Stores the "path" from the root of a tree to a node, allowing the node to be recovered in a later snapshot of the tree, under certain circumstances. The implementation stores the child indices to represent the path, so any edit which affects the child indices could render this object unable to recover its node. NOTE: One thing C# IDE has done in the past to do a better job of this is to store the fully qualified name of the member to at least be able to descend into the same member. We could apply the same sort of logic here. Attempts to recover the node at this path in the provided tree. If the node is found then 'true' is returned, otherwise the result is 'false' and 'node' will be null. This value source keeps a strong reference to a value. A class that abstracts the accessing of a value A that keeps a weak reference to a value. Explicitly indicates result is void Creates an event handler that holds onto the target weakly. The target that is held weakly, and passed as an argument to the invoker. An action that will receive the event arguments as well as the target instance. The invoker itself must not capture any state. 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 . Parse the value provided to an MSBuild Feature option into a list of entries. This will leave name=value in their raw form. 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 simple Lisp-like immutable list. Good to use when lists are always accessed from the head. Names of well-known XML attributes and elements. Get maximum char count needed to decode the entire stream. Stream is so big that max char count can't fit in . This method is necessary to avoid an ambiguity between and . This method is necessary to avoid an ambiguity between and . 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. Convert a boxed primitive (generally of the backing type of an enum) into a ulong. 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 Null or empty. "file" ".\file" "..\file" "\dir\file" "C:dir\file" "C:\file" or "\\machine" (UNC). Creates an with information about an unexpected value. The unexpected value. The , which should be thrown by the caller. Represents a single item or many items. Used when a collection usually contains a single item but sometimes might contain multiple. 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. 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. Compares objects based upon their reference identity. 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. This is basically a lossy cache of strings that is searchable by strings, string sub ranges, character array ranges or string-builder. 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 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. 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. 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. An that deserializes objects from a byte stream. We start the version at something reasonably random. That way an older file, with some random start-bytes, has little chance of matching our version. When incrementing this version, just change VersionByte2. Map of reference id's to deserialized objects. These are not readonly because they're structs and we mutate them. Copy of the global binder data that maps from Types to the appropriate reading-function for that type. Types register functions directly with , but that means that is both static and locked. This gives us local copy we can work with without needing to worry about anyone else mutating. Creates a new instance of a . The stream to read objects from. Attempts to create a from the provided . If the does not start with a valid header, then will be returned. An reference-id to object map, that can share base data efficiently. An that serializes objects to a byte stream. Map of serialized object's reference ids. The object-reference-map uses reference equality for performance. While the string-reference-map uses value-equality for greater cache hits and reuse. These are not readonly because they're structs and we mutate them. When we write out objects/strings we give each successive, unique, item a monotonically increasing integral ID starting at 0. I.e. the first object gets ID-0, the next gets ID-1 and so on and so forth. We do *not* include these IDs with the object when it is written out. We only include the ID if we hit the object *again* while writing. During reading, the reader knows to give each object it reads the same monotonically increasing integral value. i.e. the first object it reads is put into an array at position 0, the next at position 1, and so on. Then, when the reader reads in an object-reference it can just retrieved it directly from that array. In other words, writing and reading take advantage of the fact that they know they will write and read objects in the exact same order. So they only need the IDs for references and not the objects themselves because the ID is inferred from the order the object is written or read in. Copy of the global binder data that maps from Types to the appropriate reading-function for that type. Types register functions directly with , but that means that is both static and locked. This gives us local copy we can work with without needing to worry about anyone else mutating. Creates a new instance of a . The stream to write to. Used so we can easily grab the low/high 64bits of a guid for serialization. An object reference to reference-id map, that can share base data efficiently. Indexed by EncodingKind. byte marker mask for encoding compressed uint byte marker bits for uint encoded in 1 byte. byte marker bits for uint encoded in 2 bytes. byte marker bits for uint encoded in 4 bytes. The null value A type An object with member values encoded as variants An object reference with the id encoded as 1 byte. An object reference with the id encode as 2 bytes. An object reference with the id encoded as 4 bytes. A string encoded as UTF8 (using BinaryWriter.Write(string)) A string encoded as UTF16 (as array of UInt16 values) A reference to a string with the id encoded as 1 byte. A reference to a string with the id encoded as 2 bytes. A reference to a string with the id encoded as 4 bytes. The boolean value true. The boolean value char. A character value encoded as 2 bytes. An Int8 value encoded as 1 byte. An Int16 value encoded as 2 bytes. An Int32 value encoded as 4 bytes. An Int32 value encoded as 1 byte. An Int32 value encoded as 2 bytes. The Int32 value 0 The Int32 value 1 The Int32 value 2 The Int32 value 3 The Int32 value 4 The Int32 value 5 The Int32 value 6 The Int32 value 7 The Int32 value 8 The Int32 value 9 The Int32 value 10 An Int64 value encoded as 8 bytes A UInt8 value encoded as 1 byte. A UIn16 value encoded as 2 bytes. A UInt32 value encoded as 4 bytes. A UInt32 value encoded as 1 byte. A UInt32 value encoded as 2 bytes. The UInt32 value 0 The UInt32 value 1 The UInt32 value 2 The UInt32 value 3 The UInt32 value 4 The UInt32 value 5 The UInt32 value 6 The UInt32 value 7 The UInt32 value 8 The UInt32 value 9 The UInt32 value 10 A UInt64 value encoded as 8 bytes. A float value encoded as 4 bytes. A double value encoded as 8 bytes. A decimal value encoded as 12 bytes. A DateTime value An array with length encoded as compressed uint An array with zero elements An array with one element An array with 2 elements An array with 3 elements The boolean type The string type 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. Objects that implement this interface know how to write their contents to an , so they can be reconstructed later by an . Returns 'true' when the same instance could be used more than once. Instances that return 'false' should not be tracked for the purpose of de-duplication while serializing/deserializing. is a registry that maps between arbitrary s and the 'reader' function used to deserialize serialized instances of those types. Registration must happen ahead of time using the method. Lock for all data in this type. Last created snapshot of our data. We hand this out instead of exposing our raw data so that and do not need to take any locks while processing. Map from a to the corresponding index in and . will write out the index into the stream, and will use that index to get the reader used for deserialization. Gets an immutable copy of the state of this binder. This copy does not need to be locked while it is used. An immutable unordered hash map implementation. The type of the key. The type of the value. The root node of the tree that stores this map. The comparer used to sort keys in this map. The comparer used to detect equivalent values in this map. Initializes a new instance of the class. The root. The comparer. The value comparer. Initializes a new instance of the class. The comparer. The value comparer. Gets an empty map with default equality comparers. See the interface. See the interface. See the interface. See the interface. Applies a given set of key=value pairs to an immutable dictionary, replacing any conflicting keys in the resulting dictionary. The key=value pairs to set on the map. Any keys that conflict with existing keys will overwrite the previous values. An immutable dictionary. See the interface. See the interface. Returns a hash map that uses the specified key and value comparers and has the same contents as this map. The key comparer. A value of null results in using the default equality comparer for the type. The value comparer. A value of null results in using the default equality comparer for the type. The hash map with the new comparers. In the event that a change in the key equality comparer results in a key collision, an exception is thrown. Returns a hash map that uses the specified key comparer and current value comparer and has the same contents as this map. The key comparer. A value of null results in using the default equality comparer for the type. The hash map with the new comparers. In the event that a change in the key equality comparer results in a key collision, an exception is thrown. Determines whether the ImmutableSortedMap<TKey,TValue> contains an element with the specified value. The value to locate in the ImmutableSortedMap<TKey,TValue>. The value can be null for reference types. true if the ImmutableSortedMap<TKey,TValue> contains an element with the specified value; otherwise, false. Gets the number of elements in this collection. Gets a value indicating whether this instance is empty. true if this instance is empty; otherwise, false. Gets the keys in the map. Gets the values in the map. Gets the with the specified key. Determines whether the specified key contains key. The key. true if the specified key contains key; otherwise, false. Determines whether this map contains the specified key-value pair. The key value pair. true if this map contains the key-value pair; otherwise, false. See the interface. See the interface. Returns an enumerator that iterates through the collection. A that can be used to iterate through the collection. Returns a that represents this instance. A that represents this instance. Exchanges a key for the actual key instance found in this map. The key to search for. Receives the equal key found in the map. A value indicating whether an equal and existing key was found in the map. Attempts to discover an instance beneath some enumerable sequence if one exists. The sequence that may have come from an immutable map. Receives the concrete typed value if one can be found. true if the cast was successful; false otherwise. Bulk adds entries to the map. The entries to add. true to allow the sequence to include duplicate keys and let the last one win; false to throw on collisions. true when being called from ToHashMap to avoid StackOverflow. The hash for this bucket. Initializes a new instance of the class. The hash. Initializes a new instance of the class. The key. The value. The hashcode. Initializes a new instance of the class. The buckets. Initializes a new instance of the class. The hash roll. The used. The buckets. The count. Initializes a new instance of the class. The suggested hash roll. The bucket1. The bucket2. A simple view of the immutable collection that the debugger can show to the developer. The collection to be enumerated. The simple view of the collection. Initializes a new instance of the class. The collection to display in the debugger Gets a simple debugger-viewable collection. 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. 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.