/// A separate V8 runtime is created for the new script engine instance.
/// </remarks>
publicV8ScriptEngine()
:this(null,null)
{
}
/// <summary>
/// Initializes a new V8 script engine instance with the specified name.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// </remarks>
publicV8ScriptEngine(stringname)
:this(name,null)
{
}
/// <summary>
/// Initializes a new V8 script engine instance with the specified resource constraints.
/// </summary>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name and resource constraints.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name and options.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name, options, and debug port.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <param name="debugPort">A TCP port on which to listen for a debugger connection.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name, resource constraints, and options.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name, resource constraints, options, and debug port.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <param name="debugPort">A TCP port on which to listen for a debugger connection.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// memory is allocated outside the runtime's heap and is therefore not tracked by heap
/// size monitoring. See <see cref="V8RuntimeConstraints.MaxArrayBufferAllocation"/> for
/// additional information.
/// </para>
/// </remarks>
publicUIntPtrMaxRuntimeHeapSize
{
get
{
VerifyNotDisposed();
returnproxy.MaxIsolateHeapSize;
}
set
{
VerifyNotDisposed();
proxy.MaxIsolateHeapSize=value;
}
}
/// <summary>
/// Gets or sets the minimum time interval between consecutive heap size samples.
/// </summary>
/// <remarks>
/// This property is effective only when heap size monitoring is enabled (see
/// <see cref="MaxRuntimeHeapSize"/>).
/// </remarks>
publicTimeSpanRuntimeHeapSizeSampleInterval
{
get
{
VerifyNotDisposed();
returnproxy.IsolateHeapSizeSampleInterval;
}
set
{
VerifyNotDisposed();
proxy.IsolateHeapSizeSampleInterval=value;
}
}
/// <summary>
/// Gets or sets the maximum amount by which the V8 runtime is permitted to grow the stack during script execution.
/// </summary>
/// <remarks>
/// <para>
/// This property is specified in bytes. When it is set to the default value, no stack
/// usage limit is enforced, and scripts with unchecked recursion or other excessive stack
/// usage can cause unrecoverable errors and process termination.
/// </para>
/// <para>
/// Note that the V8 runtime does not monitor stack usage while a host call is in progress.
/// Monitoring is resumed when control returns to the runtime.
/// </para>
/// </remarks>
publicUIntPtrMaxRuntimeStackUsage
{
get
{
VerifyNotDisposed();
returnproxy.MaxIsolateStackUsage;
}
set
{
VerifyNotDisposed();
proxy.MaxIsolateStackUsage=value;
}
}
/// <summary>
/// Enables or disables instance method enumeration.
/// </summary>
/// <remarks>
/// By default, a host object's instance methods are exposed as enumerable properties.
/// Setting this property to <c>true</c> causes instance methods to be excluded from
/// property enumeration. This affects all host objects exposed in the current script
/// engine. Note that instance methods remain both retrievable and invocable regardless of
/// this property's value.
/// </remarks>
publicboolSuppressInstanceMethodEnumeration
{
get=>suppressInstanceMethodEnumeration;
set
{
suppressInstanceMethodEnumeration=value;
OnEnumerationSettingsChanged();
}
}
/// <summary>
/// Enables or disables extension method enumeration.
/// </summary>
/// <remarks>
/// <para>
/// By default, all exposed extension methods appear as enumerable properties of all host
/// objects, regardless of type. Setting this property to <c>true</c> causes extension
/// methods to be excluded from property enumeration. This affects all host objects exposed
/// in the current script engine. Note that extension methods remain both retrievable and
/// invocable regardless of this property's value.
/// </para>
/// <para>
/// This property has no effect if <see cref="SuppressInstanceMethodEnumeration"/> is set
/// to <c>true</c>.
/// </para>
/// </remarks>
publicboolSuppressExtensionMethodEnumeration
{
get=>suppressExtensionMethodEnumeration;
set
{
suppressExtensionMethodEnumeration=value;
RebuildExtensionMethodSummary();
}
}
/// <summary>
/// Enables or disables interrupt propagation in the V8 runtime.
/// </summary>
/// <remarks>
/// By default, when nested script execution is interrupted via <see cref="Interrupt"/>, an
/// instance of <see cref="ScriptInterruptedException"/>, if not handled by the host, is
/// wrapped and delivered to the parent script frame as a normal exception that JavaScript
/// code can catch. Setting this property to <c>true</c> causes the V8 runtime to remain in
/// the interrupted state until its outermost script frame has been processed.
/// </remarks>
publicboolEnableRuntimeInterruptPropagation
{
get
{
VerifyNotDisposed();
returnproxy.EnableIsolateInterruptPropagation;
}
set
{
VerifyNotDisposed();
proxy.EnableIsolateInterruptPropagation=value;
}
}
/// <summary>
/// Creates a compiled script.
/// </summary>
/// <param name="code">The script code to compile.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
publicV8ScriptCompile(stringcode)
{
returnCompile(null,code);
}
/// <summary>
/// Creates a compiled script with an associated document name.
/// </summary>
/// <param name="documentName">A document name for the compiled script. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="code">The script code to compile.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
/// Creates a compiled script with an associated document name, generating cache data for accelerated recompilation.
/// </summary>
/// <param name="documentName">A document name for the compiled script. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="code">The script code to compile.</param>
/// <param name="cacheKind">The kind of cache data to be generated.</param>
/// <param name="cacheBytes">Cache data for accelerated recompilation.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
/// <remarks>
/// The generated cache data can be stored externally and is usable in other V8 script
/// engines and application processes.
/// </remarks>
/// <seealso cref="Compile(string, string, V8CacheKind, byte[], out bool)"/>
/// Creates a compiled script with an associated document name, consuming previously generated cache data.
/// </summary>
/// <param name="documentName">A document name for the compiled script. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="code">The script code to compile.</param>
/// <param name="cacheKind">The kind of cache data to be consumed.</param>
/// <param name="cacheBytes">Cache data for accelerated compilation.</param>
/// <param name="cacheAccepted"><c>True</c> if <paramref name="cacheBytes"/> was accepted, <c>false</c> otherwise.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
/// <remarks>
/// To be accepted, the cache data must have been generated for identical script code by
/// the same V8 build.
/// </remarks>
/// <seealso cref="Compile(string, string, V8CacheKind, out byte[])"/>