Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3560,6 +3560,8 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
(tcImports :> IDisposable).Dispose()
uninstallMagicAssemblyResolution.Dispose()

member _.TryAbort() = controlledExecution.TryAbort()

/// Load the dummy interaction, load the initial files, and,
/// if interacting, start the background thread to read the standard input.
member _.Interrupt() = fsiInterruptController.Interrupt()
Expand Down
7 changes: 7 additions & 0 deletions src/Compiler/Interactive/fsi.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ type FsiEvaluationSession =
?legacyReferenceResolver: LegacyReferenceResolver ->
FsiEvaluationSession

/// A host calls this to request an abort of the evaluation thread.
/// This works only on net framework and on net7.0 or later.
/// On .NET Framework it calls thread.Abort() on the current thread, it also does the required ResetAbort. It reports a OperationCanceledException for the fsi evaluation.
/// On .NET 7 or higher it cancels an internal cancellation token passed to System.Runtime.ControlledExecution.Run(). It reports a OperationCanceledException for the fsi evaluation.
/// On .NET 6 or lower it does nothing.
member TryAbort: unit -> unit

/// A host calls this to request an interrupt on the evaluation thread.
member Interrupt: unit -> unit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4292,6 +4292,7 @@ FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: System.Tuple`3[FSharp.Co
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void AddBoundValue(System.String, System.Object)
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void EvalInteraction(System.String, Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken])
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void EvalScript(System.String)
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void TryAbort()
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void Interrupt()
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void ReportUnhandledException(System.Exception)
FSharp.Compiler.Interactive.Shell+FsiEvaluationSession: Void Run()
Expand Down