Header menu logo F# Compiler Guide

FsiEvaluationSession Type

Represents an F# Interactive evaluation session.

Instance members

Instance member Description

this.AddBoundValue

Full Usage: this.AddBoundValue

Parameters:
    name : string
    value : obj

Creates a root-level value with the given name and .NET object. If the .NET object contains types from assemblies that are not referenced in the interactive session, it will try to implicitly resolve them by default configuration. Name must be a valid identifier.

name : string
value : obj

this.CurrentPartialAssemblySignature

Full Usage: this.CurrentPartialAssemblySignature

Returns: FSharpAssemblySignature

Get a handle to the resolved view of the current signature of the incrementally generated assembly.

Returns: FSharpAssemblySignature

this.DynamicAssemblies

Full Usage: this.DynamicAssemblies

Returns: Assembly[]

Get all the dynamically generated assemblies

Returns: Assembly[]

this.EvalExpression

Full Usage: this.EvalExpression

Parameters:
    code : string
    scriptFileName : string

Returns: FsiValue option

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors are sent to the output writer. Parsing is performed on the current thread, and execution is performed synchronously on the 'main' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'. The scriptFileName parameter is used to report errors including this file name.

code : string
scriptFileName : string
Returns: FsiValue option

this.EvalExpression

Full Usage: this.EvalExpression

Parameters:
    code : string

Returns: FsiValue option

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors are sent to the output writer. Parsing is performed on the current thread, and execution is performed synchronously on the 'main' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

code : string
Returns: FsiValue option

this.EvalExpressionNonThrowing

Full Usage: this.EvalExpressionNonThrowing

Parameters:
    code : string
    scriptFileName : string

Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors and warnings are collected apart from any exception arising from execution which is returned via a Choice. Parsing is performed on the current thread, and execution is performed synchronously on the 'main' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'. The scriptFileName parameter is used to report errors including this file name.

code : string
scriptFileName : string
Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

this.EvalExpressionNonThrowing

Full Usage: this.EvalExpressionNonThrowing

Parameters:
    code : string

Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors and warnings are collected apart from any exception arising from execution which is returned via a Choice. Parsing is performed on the current thread, and execution is performed synchronously on the 'main' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

code : string
Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

this.EvalInteraction

Full Usage: this.EvalInteraction

Parameters:

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors are sent to the output writer, a 'true' return value indicates there were no errors overall. Execution is performed on the 'Run()' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'. The scriptFileName parameter is used to report errors including this file name.

code : string
scriptFileName : string
?cancellationToken : CancellationToken

this.EvalInteraction

Full Usage: this.EvalInteraction

Parameters:

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors are sent to the output writer, a 'true' return value indicates there were no errors overall. Execution is performed on the 'Run()' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

code : string
?cancellationToken : CancellationToken

this.EvalInteractionNonThrowing

Full Usage: this.EvalInteractionNonThrowing

Parameters:
Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors and warnings are collected apart from any exception arising from execution which is returned via a Choice. Execution is performed on the 'Run()' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'. The scriptFileName parameter is used to report errors including this file name.

code : string
scriptFileName : string
?cancellationToken : CancellationToken
Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

this.EvalInteractionNonThrowing

Full Usage: this.EvalInteractionNonThrowing

Parameters:
Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

Execute the code as if it had been entered as one or more interactions, with an implicit termination at the end of the input. Stop on first error, discarding the rest of the input. Errors and warnings are collected apart from any exception arising from execution which is returned via a Choice. Execution is performed on the 'Run()' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

code : string
?cancellationToken : CancellationToken
Returns: Choice<FsiValue option, exn> * FSharpDiagnostic[]

this.EvalScript

Full Usage: this.EvalScript

Parameters:
    filePath : string

Execute the given script. Stop on first error, discarding the rest of the script. Errors are sent to the output writer, a 'true' return value indicates there were no errors overall. Execution is performed on the 'Run()' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

filePath : string

this.EvalScriptNonThrowing

Full Usage: this.EvalScriptNonThrowing

Parameters:
    filePath : string

Returns: Choice<unit, exn> * FSharpDiagnostic[]

Execute the given script. Stop on first error, discarding the rest of the script. Errors and warnings are collected apart from any exception arising from execution which is returned via a Choice. Execution is performed on the 'Run()' thread. Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

filePath : string
Returns: Choice<unit, exn> * FSharpDiagnostic[]

this.FormatValue

Full Usage: this.FormatValue

Parameters:
    reflectionValue : obj
    reflectionType : Type

Returns: string

Format a value to a string using the current PrintDepth, PrintLength etc settings provided by the active fsi configuration object

reflectionValue : obj
reflectionType : Type
Returns: string

this.GetBoundValues

Full Usage: this.GetBoundValues

Returns: FsiBoundValue list

Gets the root-level values that are bound to an identifier

Returns: FsiBoundValue list

this.GetCompletions

Full Usage: this.GetCompletions

Parameters:
    longIdent : string

Returns: string seq

A host calls this to get the completions for a long identifier, e.g. in the console Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered by input from 'stdin'.

longIdent : string
Returns: string seq

this.InteractiveChecker

Full Usage: this.InteractiveChecker

Returns: FSharpChecker

The single, global interactive checker to use in conjunction with other operations on the FsiEvaluationSession. If you are using an FsiEvaluationSession in this process, you should only use this InteractiveChecker for additional checking operations.

Returns: FSharpChecker

this.Interrupt

Full Usage: this.Interrupt

A host calls this to request an interrupt on the evaluation thread.

this.IsGui

Full Usage: this.IsGui

Returns: bool

A host calls this to determine if the --gui parameter is active

Returns: bool

this.LCID

Full Usage: this.LCID

Returns: int option

A host calls this to get the active language ID if provided by fsi-server-lcid

Returns: int option

this.ParseAndCheckInteraction

Full Usage: this.ParseAndCheckInteraction

Parameters:
    code : string

Returns: FSharpParseFileResults * FSharpCheckFileResults * FSharpCheckProjectResults

Typecheck the given script fragment in the type checking context implied by the current state of F# Interactive. The results can be used to access intellisense, perform resolutions, check brace matching and other information. Operations may be run concurrently with other requests to the InteractiveChecker.

code : string
Returns: FSharpParseFileResults * FSharpCheckFileResults * FSharpCheckProjectResults

this.PartialAssemblySignatureUpdated

Full Usage: this.PartialAssemblySignatureUpdated

Returns: IEvent<unit>

Raised when an interaction is successfully typechecked and executed, resulting in an update to the type checking state. This event is triggered after parsing and checking, either via input from 'stdin', or via a call to EvalInteraction.

Returns: IEvent<unit>

this.ReportUnhandledException

Full Usage: this.ReportUnhandledException

Parameters:
    exn : exn

A host calls this to report an unhandled exception in a standard way, e.g. an exception on the GUI thread gets printed to stderr

exn : exn

this.Run

Full Usage: this.Run

 Load the dummy interaction, load the initial files, and,
 if interacting, start the background thread to read the standard input.

 Performs these steps:
    - Load the dummy interaction, if any
    - Set up exception handling, if any
    - Load the initial files, if any
    - Start the background thread to read the standard input, if any
    - Sit in the GUI event loop indefinitely, if needed

this.TryFindBoundValue

Full Usage: this.TryFindBoundValue

Parameters:
    name : string

Returns: FsiBoundValue option

Tries to find a root-level value that is bound to the given identifier

name : string
Returns: FsiBoundValue option

this.ValueBound

Full Usage: this.ValueBound

Returns: IEvent<obj * Type * string>

Event fires when a root-level value is bound to an identifier, e.g., via `let x = ...`.

Returns: IEvent<obj * Type * string>

Static members

Static member Description

FsiEvaluationSession.Create(fsiConfig, argv, inReader, outWriter, errorWriter, ?collectible, ?legacyReferenceResolver)

Full Usage: FsiEvaluationSession.Create(fsiConfig, argv, inReader, outWriter, errorWriter, ?collectible, ?legacyReferenceResolver)

Parameters:
    fsiConfig : FsiEvaluationSessionHostConfig - The dynamic configuration of the evaluation session
    argv : string[] - The command line arguments for the evaluation session
    inReader : TextReader - Read input from the given reader
    outWriter : TextWriter - Write output to the given writer
    errorWriter : TextWriter - Write errors to the given writer
    ?collectible : bool - Optionally make the dynamic assembly for the session collectible
    ?legacyReferenceResolver : LegacyReferenceResolver - An optional resolver for legacy MSBuild references

Returns: FsiEvaluationSession

Create an FsiEvaluationSession, reading from the given text input, writing to the given text output and error writers

fsiConfig : FsiEvaluationSessionHostConfig

The dynamic configuration of the evaluation session

argv : string[]

The command line arguments for the evaluation session

inReader : TextReader

Read input from the given reader

outWriter : TextWriter

Write output to the given writer

errorWriter : TextWriter

Write errors to the given writer

?collectible : bool

Optionally make the dynamic assembly for the session collectible

?legacyReferenceResolver : LegacyReferenceResolver

An optional resolver for legacy MSBuild references

Returns: FsiEvaluationSession

FsiEvaluationSession.GetDefaultConfiguration()

Full Usage: FsiEvaluationSession.GetDefaultConfiguration()

Returns: FsiEvaluationSessionHostConfig

Get a configuration that uses a private inbuilt implementation of the 'fsi' object and does not implicitly reference FSharp.Compiler.Interactive.Settings.dll.

Returns: FsiEvaluationSessionHostConfig

FsiEvaluationSession.GetDefaultConfiguration(fsiObj)

Full Usage: FsiEvaluationSession.GetDefaultConfiguration(fsiObj)

Parameters:
    fsiObj : obj

Returns: FsiEvaluationSessionHostConfig

Get a configuration that uses the 'fsi' object (normally from FSharp.Compiler.Interactive.Settings.dll, an object from another DLL with identical characteristics) to provide an implementation of the configuration. FSharp.Compiler.Interactive.Settings.dll is referenced by default.

fsiObj : obj
Returns: FsiEvaluationSessionHostConfig

FsiEvaluationSession.GetDefaultConfiguration(fsiObj, useFsiAuxLib)

Full Usage: FsiEvaluationSession.GetDefaultConfiguration(fsiObj, useFsiAuxLib)

Parameters:
    fsiObj : obj
    useFsiAuxLib : bool

Returns: FsiEvaluationSessionHostConfig

Get a configuration that uses the 'fsi' object (normally from FSharp.Compiler.Interactive.Settings.dll, an object from another DLL with identical characteristics) to provide an implementation of the configuration. The flag indicates if FSharp.Compiler.Interactive.Settings.dll is referenced by default.

fsiObj : obj
useFsiAuxLib : bool
Returns: FsiEvaluationSessionHostConfig

Type something to start searching.