Click or drag to resize

VisualBasicCompilation Class



The Compilation object is an immutable representation of a single invocation of the compiler. Although immutable, a Compilation is also on-demand, in that a compilation can be created quickly, but will that compiler parts or all of the code in order to respond to method or properties. Also, a compilation can produce a new compilation with a small change from the current compilation. This is, in many cases, more efficient than creating a new compilation from scratch, as the new compilation can share information from the old compilation.
Inheritance Hierarchy
SystemObject
  Microsoft.CodeAnalysisCompilation
    Microsoft.CodeAnalysis.VisualBasicVisualBasicCompilation

Namespace:  Microsoft.CodeAnalysis.VisualBasic
Assembly:  Microsoft.CodeAnalysis.VisualBasic (in Microsoft.CodeAnalysis.VisualBasic.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public sealed class VisualBasicCompilation : Compilation

The VisualBasicCompilation type exposes the following members.

Properties
  NameDescription
Public propertyAssembly
The IAssemblySymbol that represents the assembly being created.
(Inherited from Compilation.)
Public propertyAssemblyName
Simple assembly name, or null if not specified.
(Inherited from Compilation.)
Public propertyDirectiveReferences (Overrides CompilationDirectiveReferences.)
Public propertyDynamicType
The TypeSymbol for the type 'dynamic' in this Compilation.
(Inherited from Compilation.)
Public propertyExternalReferences
Metadata references passed to the compilation constructor.
(Inherited from Compilation.)
Public propertyGlobalNamespace
The root namespace that contains all namespaces and types defined in source code or in referenced metadata, merged into a single namespace hierarchy.
(Inherited from Compilation.)
Public propertyIsCaseSensitive (Overrides CompilationIsCaseSensitive.)
Public propertyLanguage (Overrides CompilationLanguage.)
Public propertyLanguageVersion
The language version that was used to parse the syntax trees of this compilation.
Public propertyObjectType
The INamedTypeSymbol for the .NET System.Object type, which could have a TypeKind of Error if there was no COR Library in this Compilation.
(Inherited from Compilation.)
Public propertyOptions
Public propertyReferencedAssemblyNames (Overrides CompilationReferencedAssemblyNames.)
Public propertyReferences
All metadata references -- references passed to the compilation constructor as well as references specified via #r directives.
(Inherited from Compilation.)
Public propertyScriptClass
A symbol representing the implicit Script class. This is null if the class is not defined in the compilation.
(Inherited from Compilation.)
Public propertyScriptCompilationInfo (Inherited from Compilation.)
Public propertySourceModule
Gets the IModuleSymbol for the module being created by compiling all of the source code.
(Inherited from Compilation.)
Public propertySyntaxTrees
Get a read-only list of the syntax trees that this compilation was created with.
Top
Methods
  NameDescription
Public methodAddReferences(IEnumerableT) (Inherited from Compilation.)
Public methodAddReferences(IEnumerableT)
Public methodAddReferences(MetadataReference)
Public methodAddSyntaxTrees(IEnumerableT) (Inherited from Compilation.)
Public methodAddSyntaxTrees(IEnumerableT)
Public methodAddSyntaxTrees(SyntaxTree)
Public methodClassifyConversion
Determine what kind of conversion, if any, there is between the types "source" and "destination".
Public methodClone
Create a duplicate of this compilation with different symbol instances
Public methodContainsSymbolsWithName(FuncT, TResult, Boolean, String) (Inherited from Compilation.)
Public methodContainsSymbolsWithName(FuncT, TResult, Boolean, String)
Public methodContainsSyntaxTree
Is the passed in syntax tree in this compilation?
Public methodStatic memberCreate
Public methodCreateAnonymousTypeSymbol
Returns a new anonymous type symbol with the given member types member names. Anonymous type members will be readonly by default. Writable properties are supported in VB and can be created by passing in
false
in the appropriate locations in memberIsReadOnly. Source locations can also be provided through memberLocations
(Inherited from Compilation.)
Public methodCreateArrayTypeSymbol
Returns a new ArrayTypeSymbol representing an array type tied to the base types of the COR Library in this Compilation.
(Inherited from Compilation.)
Public methodCreateDefaultWin32Resources
Create a stream filled with default win32 resources.
(Inherited from Compilation.)
Public methodCreateErrorNamespaceSymbol
Returns a new INamespaceSymbol representing an error (missing) namespace with the given name.
(Inherited from Compilation.)
Public methodCreateErrorTypeSymbol
Returns a new INamedTypeSymbol representing an error type with the given name and arity in the given optional container.
(Inherited from Compilation.)
Public methodCreatePointerTypeSymbol
Returns a new PointerTypeSymbol representing a pointer type tied to a type in this Compilation.
(Inherited from Compilation.)
Public methodCreateTupleTypeSymbol(INamedTypeSymbol, ImmutableArrayString, ImmutableArrayLocation)
Returns a new INamedTypeSymbol with the given underlying type and (optional) element names.
(Inherited from Compilation.)
Public methodCreateTupleTypeSymbol(ImmutableArrayITypeSymbol, ImmutableArrayString, ImmutableArrayLocation)
Returns a new INamedTypeSymbol with the given element types and (optional) element names.
(Inherited from Compilation.)
Public methodEmit(Stream, Stream, Stream, Stream, IEnumerableT, Void, ResourceDescription) (Inherited from Compilation.)
Public methodEmit(Stream, Stream, Stream, Stream, IEnumerableT, Void, ResourceDescription, EmitOptions) (Inherited from Compilation.)
Public methodEmit(Stream, Stream, Stream, Stream, IEnumerableT, Void, ResourceDescription, EmitOptions, IMethodSymbol, Stream) (Inherited from Compilation.)
Public methodEmitDifference(EmitBaseline, IEnumerableT, Void, SemanticEdit, Stream, Stream, Stream) (Inherited from Compilation.)
Public methodEmitDifference(EmitBaseline, IEnumerableT, Void, SemanticEdit, FuncT, TResult, Boolean, ISymbol, Boolean) (Inherited from Compilation.)
Public methodGetAssemblyOrModuleSymbol
Gets the IAssemblySymbol or IModuleSymbol for a metadata reference used to create this compilation.
(Inherited from Compilation.)
Public methodGetCompilationNamespace
Gets the corresponding compilation namespace for the specified module or assembly namespace.
(Inherited from Compilation.)
Public methodGetDeclarationDiagnostics(CancellationToken)
Gets the diagnostics produced during symbol declaration.
(Inherited from Compilation.)
Public methodGetDeclarationDiagnostics(CancellationToken)
Get declarations diagnostics for the entire compilation. This includes diagnostics from declarations, BUT NOT the bodies of methods or initializers. The set of declaration diagnostics is cached, so calling this method a second time should be fast.
Public methodGetDiagnostics(CancellationToken)
Gets all the diagnostics for the compilation, including syntax, declaration, and binding. Does not include any diagnostics that might be produced during emit, see EmitResult.
(Inherited from Compilation.)
Public methodGetDiagnostics(CancellationToken)
Get all diagnostics for the entire compilation. This includes diagnostics from parsing, declarations, and the bodies of methods. Getting all the diagnostics is potentially a length operations, as it requires parsing and compiling all the code. The set of diagnostics is not caches, so each call to this method will recompile all methods.
Public methodGetEntryPoint
Returns the Main method that will serves as the entry point of the assembly, if it is executable (and not a script).
(Inherited from Compilation.)
Public methodGetMetadataReference
Gets the MetadataReference that corresponds to the assembly symbol.
(Inherited from Compilation.)
Public methodGetMethodBodyDiagnostics(CancellationToken)
Gets the diagnostics produced during the analysis of method bodies and field initializers.
(Inherited from Compilation.)
Public methodGetMethodBodyDiagnostics(CancellationToken)
Get method body diagnostics for the entire compilation. This includes diagnostics only from the bodies of methods and initializers. These diagnostics are NOT cached, so calling this method a second time repeats significant work.
Public methodGetParseDiagnostics(CancellationToken)
Gets the diagnostics produced during the parsing stage.
(Inherited from Compilation.)
Public methodGetParseDiagnostics(CancellationToken)
Get parse diagnostics for the entire compilation. This includes diagnostics from parsing BUT NOT from declarations and the bodies of methods or initializers. The set of parse diagnostics is cached, so calling this method a second time should be fast.
Public methodGetSemanticModel
Get a fresh SemanticModel. Note that each invocation gets a fresh SemanticModel, each of which has a cache. Therefore, one effectively clears the cache by discarding the SemanticModel.
Public methodGetSpecialType
Get the symbol for the predefined type from the Cor Library referenced by this compilation.
(Inherited from Compilation.)
Public methodGetSymbolsWithName(Void, ISymbol, FuncT, TResult) (Inherited from Compilation.)
Public methodGetSymbolsWithName(Void, ISymbol, FuncT, TResult)
Public methodGetTypeByMetadataName
Gets the type within the compilation's assembly and all referenced assemblies (other than those that can only be referenced via an extern alias) using its canonical CLR metadata name.
(Inherited from Compilation.)
Public methodGetUnreferencedAssemblyIdentities
Given a Diagnostic reporting unreferenced AssemblyIdentitys, returns the actual AssemblyIdentity instances that were not referenced.
(Inherited from Compilation.)
Public methodRemoveAllReferences
Public methodRemoveAllSyntaxTrees
Public methodRemoveReferences(IEnumerableT) (Inherited from Compilation.)
Public methodRemoveReferences(IEnumerableT)
Public methodRemoveReferences(MetadataReference)
Public methodRemoveSyntaxTrees(IEnumerableT) (Inherited from Compilation.)
Public methodRemoveSyntaxTrees(IEnumerableT)
Public methodRemoveSyntaxTrees(SyntaxTree)
Public methodReplaceReference
Public methodReplaceSyntaxTree
Public methodToMetadataReference(ImmutableArrayString, Boolean)
Creates a metadata reference for this compilation.
(Inherited from Compilation.)
Public methodToMetadataReference(ImmutableArrayString, Boolean)
Public methodWithAssemblyName
Creates a new compilation with the specified name.
Public methodWithOptions(CompilationOptions)
Creates a new compilation with the specified compilation options.
(Inherited from Compilation.)
Public methodWithOptions(VisualBasicCompilationOptions)
Public methodWithReferences(IEnumerableT) (Inherited from Compilation.)
Public methodWithReferences(IEnumerableT)
Public methodWithReferences(MetadataReference)
Public methodWithScriptCompilationInfo (Inherited from Compilation.)
Top
Extension Methods
  NameDescription
Public Extension MethodAliasImports
Gets the compilation AliasImports property.
(Defined by VisualBasicExtensions.)
Public Extension MethodClassifyConversion(ITypeSymbol, ITypeSymbol)Overloaded.
Determines what kind of conversion there is between the specified types.
(Defined by VisualBasicExtensions.)
Public Extension MethodClassifyConversion(ITypeSymbol, ITypeSymbol)Overloaded. (Defined by CSharpExtensions.)
Public Extension MethodEmit (Defined by FileSystemExtensions.)
Public Extension MethodGetSpecialType
Gets the special type symbol in current compilation.
(Defined by VisualBasicExtensions.)
Public Extension MethodMemberImports
Gets the compilation MemberImports property.
(Defined by VisualBasicExtensions.)
Public Extension MethodRootNamespace
Gets the compilation RootNamespace property.
(Defined by VisualBasicExtensions.)
Public Extension MethodWithAnalyzers(ImmutableArrayDiagnosticAnalyzer, CompilationWithAnalyzersOptions)Overloaded.
Returns a new compilation with attached diagnostic analyzers.
(Defined by DiagnosticAnalyzerExtensions.)
Public Extension MethodWithAnalyzers(ImmutableArrayDiagnosticAnalyzer, AnalyzerOptions, CancellationToken)Overloaded.
Returns a new compilation with attached diagnostic analyzers.
(Defined by DiagnosticAnalyzerExtensions.)
Top
See Also