Microsoft.CodeAnalysis.Scripting
Converts to with possibly missing name components.
An whose fields are be null if not present in .
Converts to with all metadata fields filled.
Assembly name with Version, Culture and PublicKeyToken components filled in:
"SimpleName, Version=#.#.#.#, Culture=XXX, PublicKeyToken=XXXXXXXXXXXXXXXX".
In addition Retargetable flag and ContentType are set.
Converts to an equivalent .
Creates object by parsing given display name.
Selects the candidate assembly with the largest version number. Uses culture as a tie-breaker if it is provided.
All candidates are assumed to have the same name and must include versions and cultures.
Provides APIs to enumerate and look up assemblies stored in the Global Assembly Cache.
Represents the current Processor architecture
Enumerates assemblies in the GAC returning those that match given partial name and
architecture.
Optional partial name.
Optional architecture filter.
Enumerates assemblies in the GAC returning those that match given partial name and
architecture.
The optional partial name.
The optional architecture filter.
Enumerates assemblies in the GAC returning their simple names.
Optional architecture filter.
Unique simple names of GAC assemblies.
Looks up specified partial assembly name in the GAC and returns the best matching .
The display name of an assembly
The optional processor architecture
The optional preferred culture information
An assembly identity or null, if can't be resolved.
is null.
Looks up specified partial assembly name in the GAC and returns the best matching .
The display name of an assembly
Full path name of the resolved assembly
The optional processor architecture
The optional preferred culture information
An assembly identity or null, if can't be resolved.
is null.
Extends to enable resolution of assembly
simple names in the GAC.
A resolver that is configured to resolve against the GAC associated
with the bitness of the currently executing process.
Constructs an instance of a
An ordered set of fully qualified
paths which are searched when resolving assembly names.
Directory used when resolving relative paths.
Supported architectures used to filter GAC assemblies.
A culture to use when choosing the best assembly from
among the set filtered by
Architecture filter used when resolving assembly references.
CultureInfo used when resolving assembly references.
Loads assemblies for Reflection based APIs.
Loads an assembly given its full name.
The identity of the assembly to load.
Location of the assembly.
The loaded assembly.
The result of loading an assembly reference to the interactive session.
True if the assembly was loaded by the assembly loader, false if has been loaded before.
Full path to the physical assembly file (might be a shadow-copy of the original assembly file).
Original assembly file path.
Object pretty printer.
String that describes "void" return type in the language.
String that describes "null" literal in the language.
Formats an array type name (vector or multidimensional).
Returns true if the member shouldn't be displayed (e.g. it's a compiler generated field).
Formats object members to a list.
Inline == false:
{ A=true, B=false, C=new int[3] { 1, 2, 3 } }
Inline == true:
{
A: true,
B: false,
C: new int[3] { 1, 2, 3 }
}
Enumerates sorted object members to display.
Evaluate a format string with possible member references enclosed in braces.
E.g. "foo = {GetFooString(),nq}, bar = {Bar}".
Although in theory any expression is allowed to be embedded in the string such behavior is in practice fundamentally broken.
The attribute doesn't specify what language (VB, C#, F#, etc.) to use to parse these expressions. Even if it did all languages
would need to be able to evaluate each other language's expressions, which is not viable and the Expression Evaluator doesn't
work that way today. Instead it evaluates the embedded expressions in the language of the current method frame. When consuming
VB objects from C#, for example, the evaluation migth fail due to language mismatch (evaluating VB expression using C# parser).
Therefore we limit the expressions to a simple language independent syntax: {clr-member-name} '(' ')' ',nq',
where parentheses and ,nq suffix (no-quotes) are optional and the name is an arbitrary CLR field, property, or method name.
We then resolve the member by name using case-sensitive lookup first with fallback to case insensitive and evaluate it.
If parentheses are present we only look for methods.
Only parameter less members are considered.
A delegate that will run a script when invoked.
An object instance whose members can be accessed by the script as global variables.
A class that represents a script that you can run.
Create a script using a language specific script class such as CSharpScript or VisualBasicScript.
A script that will run first when this script is run.
Any declarations made in the previous script can be referenced in this script.
The end state from running this script includes all declarations made by both scripts.
The options used by this script.
The source code of the script.
The path to the source if it originated from a file.
The type of an object whose members can be accessed by the script as global variables.
The expected return type of the script.
The that will be used to build the script before running.
Creates a new version of this script with the specified options.
Creates a new version of this script with the source code specified.
The source code of the script.
Creates a new version of this script with the path specified.
The path is optional. It can be used to associate the script code with a file path.
Creates a new version of this script with the specified globals type.
The members of this type can be accessed by the script as global variables.
The type that defines members that can be accessed by the script.
Creates a new version of this script with the specified return type.
The default return type for a script is .
Specifying a return type may be necessary for proper understanding of some scripts.
Creates a new version of this script with the previous script specified.
Creates a new verion of this script with the specified.
Creates a new instance of a script of this type.
Runs this script.
An object instance whose members can be accessed by the script as global variables,
or a instance that was the output from a previously run script.
A that represents the state after running the script, including all declared variables and return value.
Continue running script from the point after the intermediate state was produced.
Get's the that represents the semantics of the script.
Forces the script through the build step.
If not called directly, the build step will occur on the first call to Run.
Gets the references that need to be assigned to the compilation.
This can be different than the list of references defined by the instance.
Creates a instances based on script members.
Gets the executor that will run this portion of the script only. (does not include any previous scripts).
Creates a delegate that will execute this script when invoked.
Creates an executor that while run the entire aggregate script (all submissions).
Represents a runtime execution context for C# scripts.
Unique prefix for generated uncollectible assemblies.
The full names of uncollectible assemblies generated by this context must be unique,
so that we can resolve references among them. Note that CLR can load two different assemblies of the very
identity into the same load context.
We are using a certain naming scheme for the generated assemblies (a fixed name prefix followed by a number).
If we allowed the compiled code to add references that match this exact pattern it migth happen that
the user supplied reference identity conflicts with the identity we use for our generated assemblies and
the AppDomain assembly resolve event won't be able to correctly identify the target assembly.
To avoid this problem we use a prefix for assemblies we generate that is unlikely to conflict with user specified references.
We also check that no user provided references are allowed to be used in the compiled code and report an error ("reserved assembly name").
Lockable object only instance is knowledgeable about.
Builds a delegate that will execute just this scripts code.
Maps given assembly symbol to an assembly ref.
The compiler represents every submission by a compilation instance for which it creates a distinct source assembly symbol.
However multiple submissions might compile into a single dynamic assembly and so we need to map the corresponding assembly symbols to
the name of the dynamic assembly.
lock(_gate) on access.
lock(_gate) on access.
Manages uncollectible assemblies and resolves assembly references baked into CCI generated metadata.
The resolution is triggered by the CLR Type Loader.
Lockable object only instance is knowledgeable about.
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 Absolute path expected.
Looks up a localized string similar to Assembly not found..
Looks up a localized string similar to Can't assign '{0}' to '{1}'..
Looks up a localized string similar to Display name or path cannot be empty..
Looks up a localized string similar to Execution state is frozen and cannot be modified..
Looks up a localized string similar to Expected an assembly reference..
Looks up a localized string similar to The globals of type '{0}' is not assignable to '{1}'.
Looks up a localized string similar to Invalid assembly name.
Looks up a localized string similar to Invalid characters in assemblyName.
Looks up a localized string similar to !<Stack overflow while evaluating object>.
Looks up a localized string similar to Starting state was incompatible with script..
An exception thrown when the compilation stage of interactive execution produces compilation errors.
The list of diagnostics produced by compilation.
Emits the compilation into given using Reflection.Emit APIs.
Compilation.
The module builder to add the types into. Can be reused for multiple compilation units.
Loads an assembly given an .
This callback is used for loading assemblies referenced by the compilation.
is used if not specified.
Applied when converting assembly symbols to assembly references.
is mapped to its by default.
Can be used to cancel the emit process.
If false the method returns an unsuccessful result instead of falling back to CCI writer.
Assembly image, returned only if we fallback to CCI writer.
An entry point or null if not applicable or on failure.
Diagnostics.
True on success, false if a compilation error occurred or the compilation doesn't contain any code or declarations.
Reflection.Emit doesn't support all metadata constructs. If an unsupported construct is
encountered a metadata writer that procudes uncollectible code is used instead. This is
indicated by
flag on the result.
Reusing may be beneficial in certain
scenarios. For example, when emitting a sequence of code snippets one at a time (like in
REPL). All the snippets can be compiled into a single module as long as the types being
emitted have unique names. Reusing a single module/assembly reduces memory overhead. On
the other hand, collectible assemblies are units of collection. Defining too many
unrelated types in a single assemly might prevent the unused types to be collected.
No need to provide a name override when using Reflection.Emit, since the assembly already
exists.
Referenced assembly can't be resolved.
Emits types in a given to a .
Some types can't be emitted either due to the current Reflection.Emit implementation bugs/architecture or
due to limitations of collectible assemblies (http://msdn.microsoft.com/en-us/library/dd554932.aspx).
The main problem with Reflection.Emit is that it uses two-phase type creation process. s are defined in the first phase
and created (baked) one by one in the second. This isn't compatible with the way how CLR Type Loader loads cyclic type references.
The following rules apply and imply a partial order on the type baking (based upon observation and tests; they are not clearly documented anywhere) :
1) Before a type can be baked its derived type and all interfaces it implements needs to be baked.
2) Before a generic type can be baked the constraints of its generic type parameters need to be baked.
3) Before a type can be baked all types of its fields that are value types need to be baked (reference typed fields don't).
4) If a type is dependent on a generic type instantiation it is also dependent on its generic arguments.
5) If a type is dependent on a type nested in another type the outer type need to be baked first.
If these rule imply an order that is not satisfiable (there is a cycle) the emitter throws .
TODO (tomat):
Some of these rules can be circumvented by using AppDomain.TypeLoad event, but it's unclear which exactly (I suspect #4).
Examples of type topologies that can't be emitted today are:
class B{T} where T : A // B depends on A by rule #2
class A : B{A} // A depends on B by rule #1
public class E
{
public struct N2
{
public N3 n1; // E.N2 depends on E.N3 by rule #3 and thus on E by rule #5
}
public struct N3
{
}
N2 n2; // E depends on E.N2 by rule #3
}
Establishes a creation dependency of on .
The can't be baked before is.
The main worker. Emits all types.
An entry point to resolve and return. This could be an arbitrary method, not just PE entry point.
Token used to cancel the operation.
The entry point or null if there is none.
Reflection.Emit doesn't support the feature being emitted.
Bakes types in the order implied by . A type can't be baked until all of its dependencies are.
GetMemberRefToken is broken for non-runtime members.
This is to work around call to ResolveMethod:
methDef = method.Module.ResolveMethod(
method.MetadataToken,
method.DeclaringType != null ? method.DeclaringType.GetGenericArguments() : null,
null);
and to force call to GetMemberRefToken in GetMethodTokenInternal. Calling GetMethodTokenInternal produces incorrect token for
a reference to a method on a baked type in a dynamic assembly (the modules are compared equal). Method gf{T} in test CompilationChain_Ldftn.
if (!this.Equals(methodInfoUnbound.Module)
|| (methodInfoUnbound.DeclaringType != null AndAlso methodInfoUnbound.DeclaringType.IsGenericType))
{
tk = GetMemberRefToken(methodInfoUnbound, null);
}
else
{
tk = GetMethodTokenInternal(methodInfoUnbound).Token;
}
Implements an assembly loader for interactive compiler and REPL.
An assembly is loaded into CLR’s Load Context if it is in the GAC, otherwise it's loaded into No Context via .
automatically redirects to GAC if the assembly has a strong name and there is an equivalent assembly in GAC.
The class is thread-safe.
The original path of the assembly before it was shadow-copied.
For GAC'd assemblies, this is equal to Assembly.Location no matter what path was used to load them.
Loads assembly with given identity.
The assembly identity.
Location of the assembly.
Loaded assembly.
Loads an assembly from path.
Absolute assembly file path.
is null.
is not an exisiting assembly file path.
The assembly resolver threw an exception.
Notifies the assembly loader about a dependency that might be loaded in future.
Assembly identity.
Assembly location.
Associates a full assembly name with its location. The association is used when an assembly
is being loaded and its name needs to be resolved to a location.
is null.
is null or empty.
Display just a simple description of the object, like type name or ToString(). Don't
display any members or items of the object.
Display structure of the object on a single line.
Display structure of the object on a single line, where the object is displayed as a value of its container's member.
E.g. { a = ... }
Displays a siple description of the object followed by list of members. Each member is
displayed on a separate line.
Implements shadow-copying metadata file cache.
Specialize with path being the original path of the copy.
Logically this reference represents that file, the fact that we load the image from a copy is an implementation detail.
Creates an instance of .
The directory to use to store file copies.
Directories to exclude from shadow-copying.
is null.
is not an absolute path.
Determine whether given path is under the shadow-copy directory managed by this shadow-copy provider.
Absolute path.
is null.
is not an absolute path.
Clears shadow-copy cache, disposes all allocated metadata, and attempts to delete copied files.
Gets or creates metadata for specified file path.
Full path to an assembly manifest module file or a standalone module file.
Metadata kind (assembly or module).
Metadata for the specified file.
Error reading file . See for details.
Gets or creates a copy of specified assembly or standalone module.
Full path to an assembly manifest module file or a standalone module file.
Metadata kind (assembly or module).
Copy of the specified file, or null if the file doesn't need a copy ().
Returns the same object if called multiple times with the same path.
is null.
is not an absolute path.
Error reading file . See for details.
is null.
is not an absolute path.
Suppresses shadow-coping of specified path.
Full path.
is null.
is not an absolute path.
Doesn't affect files that have already been shadow-copied.
Determines whether given file is a candidate for shadow-copy.
An absolute path.
True if the shadow-copy policy applies to the specified path.
is null.
is not absolute.
Represents the submission states and globals that get passed to a script entry point when run.
Run's the submission with this state. Submission's state get added to this as a side-effect.
A collection that holds the final state of all global variables used by the script.
Returns the global variable with the specified name.
Determines if a global variable with the specified name exists.
A list the global variable names.
Gets an enumerator over all the variables.
Options for creating and running scripts.
The set of 's used by the script.
The namespaces automatically imported by the script.
The paths used when searching for references.
The base directory used when searching for references.
The scripts will use to translate assembly names into metadata file paths. (#r syntax)
True if the script is interactive.
Interactive scripts may contain a final expression whose value is returned when the script is run.
Creates a new with the references changed.
Creates a new with the references changed.
Creates a new with the references changed.
Creates a new with references added.
Creates a new with references added.
Creates a new with the references changed.
Creates a new with the references changed.
Creates a new with references added.
Creates a new with references added.
Creates a new with the references changed.
Creates a new with the references changed.
Creates a new with references added.
Creates a new with references added.
Creates a new with the namespaces changed.
Creates a new with the namespaces changed.
Creates a new with the namespaces changed.
Creates a new with namespaces added.
Creates a new with namespaces added.
Creates a new with the search paths changed.
Creates a new with the search paths changed.
Creates a new with search paths added.
Creates a new with search paths added.
Creates a new with the base directory changed.
Creates a new with the reference resolver specified.
Creates a new with the reference provider specified.
Create a new with the interactive state specified.
Interactive scripts may contain a final expression whose value is returned when the script is run.
The result of running a script.
The script that ran to produce this result.
The final value produced by running the script.
The global variables accessible to or declared by the script.
Invoke a method declared by the script.
Create a delegate to a method declared by the script.
A variable declared by the script.
The name of the variable.
The type of the variable.
The value of the variable after running the script.
Gets method information about the entrypoint of the emitted assembly.
Indicates whether the emitted assembly can be garbage collected.
Represents a shadow copy of an assembly or a standalone module.
Assembly manifest module copy or a standalone module copy.
Documentation file copy or null if there is none.
Represents a shadow copy of a single file.