Skip to content

[Repo Assist] Fix #341: IFsiEvaluator inherits IDisposable; FsiEvaluator disposes FSI session#1034

Merged
dsyme merged 3 commits intomainfrom
repo-assist/fix-issue-341-ifsi-disposable-d30f8a38ca11886a
Feb 26, 2026
Merged

[Repo Assist] Fix #341: IFsiEvaluator inherits IDisposable; FsiEvaluator disposes FSI session#1034
dsyme merged 3 commits intomainfrom
repo-assist/fix-issue-341-ifsi-disposable-d30f8a38ca11886a

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #341.

Summary

IFsiEvaluator did not inherit IDisposable, so the underlying F# interactive session started by FsiEvaluator was never disposed. Since a new FsiEvaluator is created for each .fsx file processed by fsdocs build, this caused a session leak on every literate script file evaluation.

Changes

  • IFsiEvaluator now inherits System.IDisposable (breaking change — custom implementations must add Dispose())
  • FsiEvaluator implements IDisposable by forwarding to fsiSession.Dispose()
  • BuildCommand.fs wraps ParseAndTransformScriptFile in try/finally to guarantee the FSI session is disposed after each .fsx file is processed, even if evaluation throws
  • Updated call sites to use new FsiEvaluator(...) syntax as recommended for IDisposable types

Breaking Change Note

Adding inherit IDisposable to IFsiEvaluator is a breaking change for any user who has implemented the interface directly. The more common usage — constructing and using FsiEvaluator — is unaffected. This change should be noted in the release notes as a minor breaking addition.

Test Status

Passed!  - Failed: 0, Passed: 101, Skipped: 0, Total: 101  (FSharp.Literate.Tests)
Passed!  - Failed: 0, Passed: 72, Skipped: 4, Total: 76    (FSharp.ApiDocs.Tests)
Build succeeded. 0 Errors, 0 Warnings (FS0760 resolved).

Generated by Repo Assist

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

…SI session

- Add 'inherit System.IDisposable' to IFsiEvaluator interface
- Add Dispose() implementation in FsiEvaluator that calls fsiSession.Dispose()
- In BuildCommand.fs, wrap ParseAndTransformScriptFile in try/finally to
  guarantee the FSI session is disposed after each .fsx file is processed
- Update call sites to use 'new FsiEvaluator(...)' syntax as recommended
  when constructing IDisposable types

Breaking change: custom implementations of IFsiEvaluator must now add
a Dispose() method.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review February 26, 2026 18:31
@dsyme dsyme merged commit 5ebdeca into main Feb 26, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-341-ifsi-disposable-d30f8a38ca11886a branch February 26, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inherit IDisposable in IFsiEvaluator

1 participant