Microsoft.CodeAnalysis.Desktop Represents a non source code file. Path to the file. Returns a with the contents of this file, or null if there were errors reading the file. Errors encountered when trying to read the additional file. Always empty if has not been called. Represents analyzers stored in an analyzer assembly file. Analyzer are read from the file, owned by the reference, and doesn't change since the reference is accessed until the reference object is garbage collected. During this time the file is open and its content is read-only. If you need to manage the lifetime of the anayzer reference (and the file stream) explicitly use . Handles loading assemblies without locking the corresponding DLL on disk. This is achieved by copying the DLL into a byte array, and then calling to load the assembly from the byte array. Does not handle multi-module assemblies. The interesting bit is that objects loaded in this way are not placed in the Load or Load-From binding contexts. If one of these needs a dependency to be resolved and it isn't already loaded or available in the GAC, the runtime will not do any probing to find it. Since it doesn't know where the assembly came from, it doesn't assume it knows how to resolve its dependencies. This means we also need to hook the event and handle finding and loading dependencies ourselves. We also need to handle loading the dependencies' dependencies, and so on. Maps from a full path to a file to a corresponding that we've already loaded. Maps from an assembly full name to the directory where we found the corresponding file. Maps from an assembly full name to the corresponding . Maps from the full path to an assembly to the full path of the assembly that requested it. Controls access to the loader's data structures. Loads the at the given path without locking the file. Performs the actual loading of the assembly, updates data structures, and fires the event. Handles the event. This handler catches and swallow any and all exceptions that arise, and simply returns null when they do. Leaking an exception from the event handler may interrupt the entire assembly resolution process, which is undesirable. Attempts to find and load an when the requesting is unknown. In this case we simply look next to all the assemblies we have previously loaded for one with the correct name and a matching . Attempts to find and load an when the requesting is known. This method differs from in a couple of ways. First, we only attempt to handle the load if the requesting assembly is one we've loaded. If it isn't one of ours, then presumably some other component is hooking and will have a better idea of how to load the assembly. Second, we only look immediately next to the requesting assembly, instead of next to all the assemblies we've previously loaded. An analyzer needs to ship with all of its dependencies, and if it doesn't we don't want to mask the problem. Fired when an referred to by an (or a dependent ) is loaded. Maps from one assembly back to the assembly that requested it, if known. Creates an AnalyzerFileReference with the given . Full path of the analyzer assembly. An optional assembly loader to override the default assembly load mechanism. Adds the of of for all languages defined in this assembly reference. Adds the of defined in this assembly reference of given . Opens the analyzer dll with the metadata reader and builds a map of language -> analyzer type names. The PE image format is invalid. IO error reading the metadata. 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 Argument to '/keepalive' option is not a 32-bit integer.. Looks up a localized string similar to Arguments to '/keepalive' option below -1 are invalid.. Looks up a localized string similar to '/keepalive' option is only valid with '/shared' option.. Looks up a localized string similar to Roslyn compiler server reports different protocol version than build task.. Looks up a localized string similar to Missing argument for '/keepalive' option.. Converts this identity to . A new instance of . The culture specified in is not available on the current platform. Policy to be used when matching assembly reference to an assembly definition accross platforms. Converts to . Major, minor, build or revision number are less than 0 or greater than 0xFFFF. Describes a command line metadata reference (assembly or netmodule) specification. Metadata file path or an assembly display name. Metadata reference properties. Describes a source file specification stored on command line arguments. Resolved absolute path of the source file (does not contain wildcards). Although this path is absolute it may not be normalized. That is, it may contain ".." and "." in the middle. True if the file should be treated as a script file. The base class for representing command line arguments to a . Directory used to resolve relative paths stored in the arguments. Except for paths stored in , all paths stored in the properties of this class are resolved and absolute. This is the directory that relative paths specified on command line were resolved against. Sequence of absolute paths used to search for references. Sequence of absolute paths used to search for key files. If true, use UTF8 for output. Compilation name or null if not specified. Gets the emit options. Name of the output file or null if not specified. Path of the PDB file or null if same as output binary path with .pdb extension. True to emit PDB file. Absolute path of the output directory. Absolute path of the documentation comment XML file or null if not specified. An absolute path of the App.config file or null if not specified. Errors while parsing the command line arguments. References to metadata supplied on the command line. Includes assemblies specified via /r and netmodules specified via /addmodule. References to analyzers supplied on the command line. A set of additional non-code text files that can be used by analyzers. If true, prepend the command line header logo during . If true, append the command line help during The path to a Win32 resource. The path to a .ico icon file. The path to a Win32 manifest file to embed into the output portable executable (PE) file. If true, do not embed any Win32 manifest, including one specified by or any default manifest. Resources specified as arguments to the compilation. Encoding to be used for source files or 'null' for autodetect/default. Hash algorithm to use to calculate source file debug checksums. Arguments following script argument separator "--" or null if is false. Source file paths. Includes files specified directly on command line as well as files matching patterns specified on command line using '*' and '?' wildcards or /recurse option. Full path of a log of file paths accessed by the compiler, or null if file logging should be suppressed. Two log files will be created: One with path and extension ".read" logging the files read, and second with path and extension ".write" logging the files written to during compilation. If true, prints the full path of the file containing errors or warnings in diagnostics. Options to the . Options to the . Specify the preferred output language name. Resolves metadata references stored in using given file resolver and metadata provider. to use for assembly name and relative path resolution. Yields resolved metadata references or . is null. Resolves metadata references stored in using given file resolver and metadata provider. If a non-null diagnostic bag is provided, it catches exceptions that may be generated while reading the metadata file and reports appropriate diagnostics. Otherwise, if is null, the exceptions are unhandled. called by CommonCompiler with diagnostics and message provider Resolves analyzer references stored in using given file resolver. Yields resolved or . Enumerates files in the specified directory and subdirectories whose name matches the given pattern. Full path of the directory to enumerate. File name pattern. May contain wildcards '*' (matches zero or more characters) and '?' (matches any character). Specifies whether to search the specified only, or all its subdirectories as well. Sequence of file paths. Trims all '.' and whitespaces from the end of the path Returns false if any of the client arguments are invalid and true otherwise. The original args to the client. The original args minus the client args, if no errors were encountered. Only defined if no errors were encountered. True if '/shared' was an argument, false otherwise. Only defined if no errors were encountered. The value to the '/keepalive' argument if one was specified, null otherwise. Only defined if errors were encountered. The error message for the encountered error. Parse a response file into a set of arguments. Errors openening the response file are output into "errors". Take a string of lines from a response file, remove comments, and split into a set of command line arguments. Remove all double quote characters from the given string. Split a command line by the same rules as Main would get the commands. Rules for command line parsing, according to MSDN: Arguments are delimited by white space, which is either a space or a tab. A string surrounded by double quotation marks ("string") is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument. A double quotation mark preceded by a backslash (\") is interpreted as a literal double quotation mark character ("). Backslashes are interpreted literally, unless they immediately precede a double quotation mark. If an even number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is interpreted as a string delimiter. If an odd number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is "escaped" by the remaining backslash, causing a literal double quotation mark (") to be placed in argv. Split a string, based on whether "splitHere" returned true on each character. Condense double backslashes that precede a quotation mark to single backslashes. Add "count" backslashes to a StringBuilder. Split a string by a set of separators, taking quotes into account. Tries to parse a UInt64 from string in either decimal, octal or hex format. The string value. The result if parsing was successful. true if parsing was successful, otherwise false. Tries to parse a UInt16 from string in either decimal, octal or hex format. The string value. The result if parsing was successful. true if parsing was successful, otherwise false. Base class for csc.exe, csi.exe, vbc.exe and vbi.exe implementations. Return the path in which to look for response files. This should only be called on EXE entry points as the implementation relies on managed entry points. Called from a compiler exe entry point to get the full path to the response file for the given name. Will return a fully qualified path. Resolves metadata references stored in command line arguments and reports errors for those that can't be resolved. Reads content of a source file. Source file information. Storage for diagnostics. Encoding to use or 'null' for autodetect/default Hash algorithm used to calculate file checksum. File content or null on failure. Reads content of a source file. Source file information. Storage for diagnostics. Encoding to use or 'null' for autodetect/default Hash algorithm used to calculate file checksum. If given opens successfully, set to normalized absolute path of the file, null otherwise. File content or null on failure. csc.exe and vbc.exe entry point. Given a compilation and a destination directory, determine three names: 1) The name with which the assembly should be output (default = null, which indicates that the compilation output name should be used). 2) The path of the assembly/module file (default = destination directory + compilation output name). 3) The path of the pdb file (default = assembly/module path with ".pdb" extension). C# has a special implementation that implements idiosyncratic behavior of csc. Test hook for intercepting File.Open. csi.exe and vbi.exe entry point. When overriden by a derived class, this property can override the current thread's CurrentUICulture property for diagnostic message resource lookups. Looks for metadata references among the assembly file references given to the compilation when constructed. When scripts are included into a project we don't want #r's to reference other assemblies than those specified explicitly in the project references. When compiling to a file all unresolved assembly names have to match one of the file references specified on command line. When compiling to a file all relative paths have to match one of the file references specified on command line. This implementation of will delay the creation of the PE / PDB file until the compiler determines the compilation has succeeded. This prevents the compiler from deleting output from the previous compilation when a new compilation fails. Represents errors that occur while parsing RuleSet files. Represents a set of rules as specified in a rulset file. The file path of the ruleset file. The global option specified by the IncludeAll tag. Individual ruleids and their associated actions. List of rulesets included by this ruleset. Create a RuleSet. Create a RuleSet with a global effective action applied on it. Get the effective ruleset after resolving all the included rulesets. Get all the files involved in resolving this ruleset. Returns true if the action1 is stricter than action2. Load the ruleset from the specified file. This ruleset will contain all the rules resolved from the includes specified in the ruleset file as well. See also: . A ruleset that contains resolved rules or null if there were errors. Get the paths to all files contributing rules to the ruleset from the specified file. See also: . The full paths to included files, or an empty array if there were errors. Parses the ruleset file at the given and returns the following diagnostic options from the parsed file: 1) A map of from rule ID to option. 2) A global option for all rules in the ruleset file. Represents a Include tag in a RuleSet file. The path of the included file. The effective action to apply on this included ruleset. Create a RuleSetInclude given the includepath and the effective action. Gets the RuleSet associated with this ruleset include The parent of this ruleset include Returns a full path to the include file. Relative paths are expanded relative to the current rule set file. The parent of this rule set include This type is responsible for parsing a ruleset xml file and producing a object. Static constructor for initializing the schema object to be used for schema validation Creates and loads the rule set from a file The file path to load the rule set Load the rule set from the XML node The rule set node from which to create a rule set object The file path to the rule set file A rule set object with data from the given XML node Load the rules from the XML node The rules node from which to loop through each child rule node A list of rule objects with data from the given XML node Load the rule from the XML node The rule node from which to create a rule object The analyzer this rule belongs to The namespace this rule belongs to A rule object with data from the given XML node Load the included rule set from the XML node The include node from which to create a RuleSetInclude object A RuleSetInclude object with data from the given XML node Reads the action from the given node The node to read the action, it can be a rule node or an include node The rule action Load the IncludedAll from the XML node The IncludeAll node from which to create a IncludeAll object A IncludeAll object with data from the given XML node Reads an attribute from a node and validates that it is not empty. The XML node that contains the attribute The name of the attribute to read The attribute value Gets the default settings to read the ruleset xml file. Used for logging all the paths which are "touched" (used) in any way in the process of compilation. Adds a fully-qualified path to the Logger for a read file. Semantics are undefined after a call to . Adds a fully-qualified path to the Logger for a written file. Semantics are undefined after a call to . Adds a fully-qualified path to the Logger for a read and written file. Semantics are undefined after a call to . Writes all of the paths the TouchedFileLogger to the given TextWriter in upper case. After calling this method the logger is in an undefined state. Writes all of the paths the TouchedFileLogger to the given TextWriter in upper case. After calling this method the logger is in an undefined state. Emit the IL for the compilation into the specified stream. Compilation. Path of the file to which the compilation will be written. Path of the file to which the compilation's debug info will be written. Also embedded in the output file. Null to forego PDB generation. Path of the file to which the compilation's XML documentation will be written. Null to forego XML generation. Path of the file from which the compilation's Win32 resources will be read (in RES format). Null to indicate that there are none. List of the compilation's managed resources. Null to indicate that there are none. To cancel the emit process. Compilation or path is null. Path is empty or invalid. An error occurred while reading or writing a file. Assembly portability policy, usually provided through an app.config file. Loads information from XML with App.config schema. The stream doesn't contain a well formed XML. is null. Tries to find supportPortability elements in the given XML: ]]> Keeps the stream open. Returns true if the identity is a Framework 4.5 or lower assembly. Provides strong name and signs source assemblies. Creates an instance of . An ordered set of fully qualified paths which are searched when locating a cryptographic key file. Resolves assembly strong name key file path. Internal for testing. Normalized key file path or null if not found. Describes a command line analyzer assembly specification. Assembly file path. 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. 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 . 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 . Note that if the stream starts with Byte Order Mark the value of is ignored. 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. The decoded from the stream. The decoder was unable to decode the stream with the given encoding. internal for unit testing Some streams are easily represented as byte arrays. The stream The contents of as a byte array or null if the stream can't easily be read into a byte array. If the MemoryStream was created with publiclyVisible=true, then we can access its buffer directly and save allocations in StreamReader. The input MemoryStream is not closed on exit. True if a byte array could be created. Read the contents of a 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. Manages cache of the following information for Portable Executables loaded from files. For assemblies - a map from file name and timestamp to: 1) A weak reference to the corresponding PEAssembly object; 2) A list of weak references to instances of VB/CS AssemblySymbols based on the PEAssembly object. For modules - a map from file name and timestamp to a weak reference to the corresponding PEModule object Global cache for assemblies imported from files. Global cache for net-modules imported from files. Timer triggering compact operation for metadata cache. Period at which the timer is firing (30 seconds). compactTimer's procedure is in progress. Used to prevent multiple instances running in parallel. compactTimer is on, i.e. will fire. This field is changed to 'yes' only by EnableCompactTimer(), and is changed to 'no' only by CompactCache(). Collection count last time the cache was compacted. Lock that must be acquired for the duration of read/write operations on MetadataCache. Internal for testing. Return amount of GC collections occurred so far. Called by compactTimer to compact the cache. Trigger timer every 30 seconds. Cache must be locked before calling this method. For test purposes only. Trigger compact operation for the cache, meant to be used for test purpose only. Locking the cache prior to calling this method is a good way to get into a deadlock. For test purposes only!!! Called by compactTimer. Called by compactTimer. Global cache for assemblies imported from files. Internal accessibility is for test purpose only. For test purposes only. Global cache for net-modules imported from files. Internal accessibility is for test purpose only. For test purposes only. This class is meant to be used for test purpose only. It locks MetadataCache until the instance is disposed. Upon locking, the cache is swapped with an empty cache, original cache is restored before the cache is unlocked. Clean global metadata caches, meant to be used for test purpose only. Represents metadata stored in a file. Metadata image is read from the file, owned by the reference, and doesn't change since the reference is accessed by the compiler until the reference object is garbage collected. During this time the file is open and its content is read-only. If you need to manage the lifetime of the metadata (and the file stream) explicitly use or implement a custom subclass of . Resolves metadata references specified in source code (#r directives). 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. 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. Search paths used when resolving metadata references. All search paths are absolute. Directory used for resolution of relative paths. A full directory path or null if not available. This directory is only used if the base directory isn't implied by the context within which the path is being resolved. It is used, for example, when resolving a strong name key file specified in , or a metadata file path specified in . Resolution of a relative path that needs the base directory fails if the base directory is null. Resolves a metadata reference that is a path or an assembly name. Reference path. The base file path to use to resolve relative paths against. Null to use the as a base for relative paths. Normalized absolute path to the referenced file or null if it can't be resolved. Represents compilation options common to C# and VB. Represents parse options common to C# and VB. Resolves references to source files specified in source code. Resolves references to XML files specified in the source. Resolves XML document file path. Value of the "file" attribute of an <include> documentation comment element. Path of the source file () or XML document that contains the . If not null used as a base path of , if is relative. If is relative is used as the base path of . Normalized XML document file path or null if not found. Full case-insensitive path. Last write time (UTC). Constructor. Full path. Last write time (UTC). Resolves relative path and returns absolute path. The method depends only on values of its parameters and their implementation (for fileExists). It doesn't itself depend on the state of the current process (namely on the current drive directories) or the state of file system. Path to resolve. Base file path to resolve CWD-relative paths against. Null if not available. Base directory to resolve CWD-relative paths against if isn't specified. Must be absolute path. Null if not available. Sequence of paths used to search for unqualified relative paths. Method that tests existence of a file. The resolved path or null if the path can't be resolved. 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 Marks given file for automatic deletion when all its handles are closed. Note that after doing this the file can't be opened again, not even by the same process. Null or empty. "file" ".\file" "..\file" "\dir\file" "C:dir\file" "C:\file" or "\\machine" (UNC). Get directory name from path. Unlike it doesn't check for invalid path characters, doesn't strip any trailing directory separators (TODO: tomat), doesn't recognize UNC structure \\computer-name\share\directory-name\file-name (TODO: tomat). Prefix of path that represents a directory. Returns true if given path is absolute and starts with a drive specification ("C:\"). Get a prefix of given path which is the root of the path. Root of an absolute path or null if the path isn't absolute or has invalid format (e.g. "\\"). It may or may not end with a directory separator (e.g. "C:\", "C:\foo", "\\machine\share", etc.) . Calculates the length of root of an UNC path. "\\server\share" is root of UNC path "\\server\share\dir1\dir2\file". 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.